-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[Mono] Add the capability of trimming IL code of individual methods #86722
Conversation
int allowedParallelism = DisableParallelStripping ? 1 : Math.Min(Assemblies.Length, Environment.ProcessorCount); | ||
if (BuildEngine is IBuildEngine9 be9) | ||
allowedParallelism = be9.RequestCores(allowedParallelism); |
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.
int allowedParallelism = DisableParallelStripping ? 1 : Math.Min(Assemblies.Length, Environment.ProcessorCount); | |
if (BuildEngine is IBuildEngine9 be9) | |
allowedParallelism = be9.RequestCores(allowedParallelism); | |
int allowedParallelism = DisableParallelStripping ? 1 : BuildEngine9.RequestCores(Math.Min(Assemblies.Length, Environment.ProcessorCount)); |
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.
I hit an error when applying your change
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
int allowedParallelism = DisableParallelStripping ? 1 : Math.Min(MethodTokenFiles.Length, Environment.ProcessorCount); | ||
if (BuildEngine is IBuildEngine9 be9) | ||
allowedParallelism = be9.RequestCores(allowedParallelism); |
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.
int allowedParallelism = DisableParallelStripping ? 1 : Math.Min(MethodTokenFiles.Length, Environment.ProcessorCount); | |
if (BuildEngine is IBuildEngine9 be9) | |
allowedParallelism = be9.RequestCores(allowedParallelism); | |
int allowedParallelism = DisableParallelStripping ? 1 : BuildEngine9.RequestCores(Math.Min(Assemblies.Length, Environment.ProcessorCount)); |
It would be nice to include a specification/documentation of how this feature is used/enabled (possibly with an example of |
Co-authored-by: Ankit Jain <[email protected]>
Co-authored-by: Ankit Jain <[email protected]>
Co-authored-by: Ankit Jain <[email protected]>
Co-authored-by: Ankit Jain <[email protected]>
Co-authored-by: Ankit Jain <[email protected]>
Co-authored-by: Ankit Jain <[email protected]>
Co-authored-by: Ankit Jain <[email protected]>
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.
Looks great, thank you!
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.
Looks great 👍
CI failures are not related to this PR. |
Context: dotnet/runtime#86722 This adds an `<ILStrip/>` step after the `<MonoAOTCompiler/>` task. This trims away IL of AOT-compiled methods. This is WIP. Builds work currently, but the app crashes at runtime with: 07-06 16:57:07.413 8865 8865 E companyname.foo: * Assertion at /__w/1/s/src/mono/mono/mini/mini-trampolines.c:1416, condition `invoke' not met
Contributes to #44855
@jonathanpeppers After this is merged. It should be adoptable by Android. I have updated the HelloWorld sample as an example to showcase how to use this feature.
Usage of this feature:
CollectCompiledMethods
andCompiledMethodsOutputDirectory
forMonoAOTCompiler
ILStrip
afterMonoAOTCompiler
For more details, please refer to the HelloWorld sample app change included in this PR.