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

[Mono]: Reduce Mono AOT cross compiler x64 memory footprint. #97096

Merged

Commits on Feb 9, 2024

  1. Reduce Mono AOT cross compiler x64 memory footprint.

    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.
    lateralusX authored and vargaz committed Feb 9, 2024
    Configuration menu
    Copy the full SHA
    f090a34 View commit details
    Browse the repository at this point in the history
  2. Fix review feedback.

    lateralusX authored and vargaz committed Feb 9, 2024
    Configuration menu
    Copy the full SHA
    cfaf8d9 View commit details
    Browse the repository at this point in the history
  3. Minor cleanups.

    vargaz committed Feb 9, 2024
    Configuration menu
    Copy the full SHA
    5ab0d94 View commit details
    Browse the repository at this point in the history