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
Building .net8 S.P.C using Mono AOT cross compiler in full AOT consumes
a large amount of memory (up to 6 GB). This is mainly due to generated
LLVM module not being optimized at all while kept in memory during
full module generation. Mono x64 also lacks support for several
intrinsics as well as Vector 256/512 that in turn leads to massive
inlining of intrinsics functions generating a very large LLVM module,
where majority of this code ends up as dead code due to
IsSupported/IsHardwareAccelerated returning false.
The follow commit adjusts several things that will bring down the
memory usage, compiling .net8/.net9 Mono S.P.C on x64 Windows
from 6 GB down to ~750 MB.
* Use PSNE implementations on intrinsics not supported on Mono.
* Add ILLinker substitutions for intrinsics not supported on Mono. Enables
ILLinker to do dead code elimination, reduce code to AOT compile.
* Prevent aggressive inlining for a couple of unsupported intrinsics types
making sure we don't end up with excessive inlining, exploding code size.
* Run a couple of LLVM optimization passes on each generated method doing
early code simplification and dead code elimination during LLVM module
generation.
* Explicit SN_get_IsHardwareAccelerated/SN_get_IsSupported intrinsics
implementation for all unsupported Mono x64 SIMD intrinsics.
* Fixed numerous memory leaks in Mono AOT cross compiler code.
* Fix a couple of sequence points free after use errors.
* Fix an anonymous struct build warning triggering build error for
LLVM enabled cross compiler on Windows.
---------
Co-authored-by: Zoltan Varga <vargaz@gmail.com>
if (constrained_generic_param&&type->data.generic_param->gshared_constraint&&MONO_TYPE_IS_VECTOR_PRIMITIVE (type->data.generic_param->gshared_constraint))
0 commit comments