You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The build time for Apple mobile apps has significantly regressed in .NET 9: #110406.
Problem
Apple mobile apps use the Mono AOT llvm compiler. The Mono compiler generates specialized versions of generic methods for each value type, alongside the gsharedvt fallback. In .NET 9, increased use of generics and enabling of ISimdVector intrinsics in the BCL have led to a significant increase in the number of generated methods, causing the regression.
Additionally, the dedup optimization makes the problem worse. It collects all methods (around 200k) and emits them into a single assembly. This approach prevents parallel compilation and negatively impacts both JIT and code generation times.
Proposed solution
To improve the overall build time, we propose modifying how dedup assemblies are compiled by emitting dedup-ed methods directly in their source assemblies.
During assembly compilation, the AOT compiler can determine if a method can be dedup-ed and record this information in a hash table.
Collected methods can be included in source assemblies, enabling parallel compilation. Also, this should simplify the compilation process by avoiding the generation of artificial aot-instances.dll assembly.
Experiment
We want to validate potential impact of improvements before making changes by:
Measuring the build times of a MAUI template app with and without dedup optimization: Indicate the potential improvement from the proposed changes.
Collecting the number of generics and wrappers in .NET 8 and .NET 9: Quantify build time regression, regardless of dedup.
The text was updated successfully, but these errors were encountered:
Description
The build time for Apple mobile apps has significantly regressed in .NET 9: #110406.
Problem
Apple mobile apps use the Mono AOT llvm compiler. The Mono compiler generates specialized versions of generic methods for each value type, alongside the gsharedvt fallback. In .NET 9, increased use of generics and enabling of ISimdVector intrinsics in the BCL have led to a significant increase in the number of generated methods, causing the regression.
Additionally, the dedup optimization makes the problem worse. It collects all methods (around 200k) and emits them into a single assembly. This approach prevents parallel compilation and negatively impacts both JIT and code generation times.
Proposed solution
To improve the overall build time, we propose modifying how dedup assemblies are compiled by emitting dedup-ed methods directly in their source assemblies.
During assembly compilation, the AOT compiler can determine if a method can be dedup-ed and record this information in a hash table.
runtime/src/mono/mono/mini/aot-compiler.c
Lines 15848 to 15849 in d7e85d9
Collected methods can be included in source assemblies, enabling parallel compilation. Also, this should simplify the compilation process by avoiding the generation of artificial
aot-instances.dll
assembly.Experiment
We want to validate potential impact of improvements before making changes by:
The text was updated successfully, but these errors were encountered: