-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Make it possible to order methods by specifying symbolic names #117537
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Text file with an ordered list of symbol names is much easier to emit based on sampling than MIBC (that requires methods in IL terms). Methods that are listed are generated in the specified order. Methods that are not listed are sorted by the compiler. Things that are listed but don't exist are silently skipped.
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces support for ordering emitted methods by providing a symbol list file, plus a corresponding smoke test and build integration.
- Adds a new
--order
option to ILCompiler and wires it through to the RyuJIT builder and file layout optimizer. - Implements an explicit layout algorithm in
FileLayoutOptimizer
that reads symbol names from the specified order file. - Updates the test suite with
Ordering.cs
,order.txt
, and MSBuild targets to exercise and pass the order file to the native AOT compilation.
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
src/tests/nativeaot/SmokeTests/UnitTests/order.txt | New order file listing symbols for explicit layout |
src/tests/nativeaot/SmokeTests/UnitTests/UnitTests.csproj | Added <IlcOrderFile> property and include Ordering.cs |
src/tests/nativeaot/SmokeTests/UnitTests/Ordering.cs | Smoke test sorting method pointers by address |
src/tests/nativeaot/SmokeTests/UnitTests/Main.cs | Added Ordering.Run to the test sequence |
src/coreclr/tools/aot/ILCompiler/Program.cs | Integrated .UseSymbolOrder into the compilation builder |
src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs | Defined the --order CLI option |
src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilationBuilder.cs | Added UseSymbolOrder and _orderFile field |
src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs | Propagated orderFile to FileLayoutOptimizer |
src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/FileLayoutOptimizer.cs | Implemented Explicit layout by reading the order file |
src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets | Passed --order and --method-layout:explicit and included order file in inputs |
Comments suppressed due to low confidence (2)
src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/FileLayoutOptimizer.cs:208
- There are no existing tests validating that the
Explicit
layout algorithm actually applies the file's symbol order; consider adding unit or integration tests that inspect the generated layout to ensure the feature works as intended.
case MethodLayoutAlgorithm.Explicit:
src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/FileLayoutOptimizer.cs:223
- [nitpick] Normalize or trim symbol names (e.g. strip leading underscores) when comparing against
GetMangledName
to ensure cross-platform consistency and avoid silent skips.
string symbolName = sr.ReadLine();
src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/FileLayoutOptimizer.cs
Show resolved
Hide resolved
@dotnet/ilc-contrib could someone have a look at this? This is for a first party customer and I'd like this to make the next preview. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, a few questions about perf that aren't critical
Text file with an ordered list of symbol names is much easier to emit based on sampling than MIBC (that requires methods in IL terms). Methods that are listed are generated in the specified order. Methods that are not listed are sorted by the compiler. Things that are listed but don't exist are silently skipped.
Cc @dotnet/ilc-contrib