Skip to content

Optimizing generics by using ILCompiler dependency graph and profile guided optimization in Mono AOT #80941

Closed
@kotlarmilos

Description

@kotlarmilos

Description

Use ILCompiler (NativeAOT compiler) to perform the “pre-pass” analysis and instruct Mono AOT compiler about all the referenced generic types in the program which are only statically reachable. The exchanged information could a list of inflated methods of a generic type for which it can be proven that is not accessed dynamically, in MIBC format as an input for Mono AOT compiler.

To determine which specific instances of generic methods are to be used during runtime and provide this information to the Mono AOT compiler, profile guided optimization (PGO) approach could be used.

This would remove the need for generating generic sharing methods and additional specific instantiations for generic methods and reduce application’s footprint. It should be possible to reuse some of the managed code comprising the dotnet-pgo tool. It would be good to pull the shared code out into a separate assembly (or continue with the current approach that ilc/dotnet-pgo use - share source files).

Tasks

  • ILCompiler dumps dependency graph in a .mibc format
  • Enable PGO in Mono AOT engine full-LLVM mode
  • Integration and testing of the ILCompiler's dependency graph and the PGO
  • PGO with ILCompiler in Mono AOT available as an experimental feature

We still have open questions related to the integration and what is required to introduce it as an experimental feature in .NET 8, so comments and feedback are welcome.

/cc: @lambdageek @SamMonoRT

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions