Skip to content
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

NativeAOT: investigate if we want _AggressiveAttributeTrimming set for NativeAOT #18479

Closed
Tracked by #17339
rolfbjarne opened this issue Jun 21, 2023 · 1 comment
Closed
Tracked by #17339
Assignees
Labels
enhancement The issue or pull request is an enhancement
Milestone

Comments

@rolfbjarne
Copy link
Member

rolfbjarne commented Jun 21, 2023

Ref: #17374 (comment)
Ref: dotnet/runtime#86649 (comment)

@rolfbjarne rolfbjarne added the enhancement The issue or pull request is an enhancement label Jun 21, 2023
@rolfbjarne rolfbjarne added this to the .NET 8 milestone Jun 21, 2023
@ivanpovazan ivanpovazan self-assigned this Jul 11, 2023
dalexsoto added a commit that referenced this issue Jul 17, 2023
In the current setup with NativeAOT, during app build we run both ILLink
and ILCompiler in cascade.
When `_AggressiveAttributeTrimming` feature switch is set to `true`
ILLink removes `IsTrimmable` attribute from assemblies, which means that
when we are also running in `TrimMode=partial` (which translates to
`--defaultrooting` ILC command-line arguments) ILC trimming is disabled
completely.

This PR disables `_AggressiveAttributeTrimming` in the first pass ie
during trimming by ILLink and enables it in the second trimming pass
performed by ILCompiler.

Additionally, to workaround ILCompiler incompatibility with
`Microsoft.iOS` (and friends) this platform assembly is explicitly
rooted when passed to ILCompiler for trimming (this will be fixed once
dotnet/runtime#86649 is resolved).

Estimated savings: This change reduces the size of the application
bundle by `0,58Mb` (or ~4,3% compared to the baseline)

| MAUI ios app | Base | This PR | diff (%) |
|--------------|-----------|-----------|----------|
| SOD (Mb)     | 41,93 | 40,5      | -3,4% |
| .ipa (Mb)    | 13,43  | 12,85    | -4,3% |


Fixes: #18479

---------

Co-authored-by: Alex Soto <alex@alexsoto.me>
@ivanpovazan
Copy link
Contributor

Fixed via: b68efbe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue or pull request is an enhancement
Projects
None yet
Development

No branches or pull requests

2 participants