-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[mono] Enable configuration at runtime of the compressed interface bitmap feature #119881
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
Conversation
This optimization is disabled by default. Enable it with `MONO_COMPRESSED_INTERFACE_BITMAP=1`
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.
Pull Request Overview
This PR enables runtime configuration of the compressed interface bitmap feature in Mono through a new environment variable MONO_COMPRESSED_INTERFACE_BITMAP
. The feature was previously enabled by default but caused performance regressions in interface checking microbenchmarks, so this change allows users to toggle it at runtime for easier transition.
Key changes:
- Add runtime option
compressed-interface-bitmap
that can be controlled via environment variable - Replace compile-time
#ifdef COMPRESSED_INTERFACE_BITMAP
conditionals with runtime checks usingmono_opt_compressed_interface_bitmap
- Update AOT file format version and add compatibility checks to ensure AOT images match runtime configuration
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
src/mono/mono/utils/options-def.h | Adds new boolean option for compressed interface bitmap |
src/mono/mono/metadata/metadata.c | Implements environment variable parsing to set the runtime option |
src/mono/mono/mini/type-checking.c | Converts compile-time conditional to runtime check for interface bitmap generation |
src/mono/mono/mini/mini-runtime.c | Makes icall registration conditional on runtime option |
src/mono/mono/mini/aot-runtime.h | Updates AOT file version and adds new flag for compressed interface bitmap |
src/mono/mono/mini/aot-runtime.c | Adds compatibility check between AOT image and runtime configuration |
src/mono/mono/mini/aot-compiler.c | Sets AOT flag based on runtime option during compilation |
src/mono/mono/metadata/marshal.c | Converts compile-time conditional to runtime check for stelemref optimization |
src/mono/mono/metadata/jit-icall-reg.h | Updates icall name from mono_class_interface_match to mono_class_interface_match_compressed |
src/mono/mono/metadata/class-setup-vtable.c | Converts compile-time conditionals to runtime checks for bitmap allocation and compression |
src/mono/mono/metadata/class-internals.h | Updates interface matching macros to use runtime checks and renames compressed matching function |
src/mono/mono/metadata/class-init.c | Renames compressed interface matching function and removes compile-time conditional |
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.
LGTM - thanks!
4d53eb5
to
be40699
Compare
/ba-g llvm and ios-like failures are all unrelated |
/backport to release/10.0 |
Started backporting to release/10.0: https://github.com/dotnet/runtime/actions/runs/17916304867 |
@BrzVlad backporting to "release/10.0" failed, the patch most likely resulted in conflicts: $ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch
Applying: Add option to configure use of compressed interface bitmaps
Using index info to reconstruct a base tree...
M src/mono/mono/metadata/class-init.c
M src/mono/mono/metadata/class-internals.h
M src/mono/mono/metadata/class-setup-vtable.c
M src/mono/mono/metadata/marshal.c
M src/mono/mono/metadata/metadata.c
M src/mono/mono/mini/type-checking.c
Falling back to patching base and 3-way merge...
Auto-merging src/mono/mono/metadata/class-init.c
Auto-merging src/mono/mono/metadata/class-internals.h
CONFLICT (content): Merge conflict in src/mono/mono/metadata/class-internals.h
Auto-merging src/mono/mono/metadata/class-setup-vtable.c
CONFLICT (content): Merge conflict in src/mono/mono/metadata/class-setup-vtable.c
Auto-merging src/mono/mono/metadata/marshal.c
Auto-merging src/mono/mono/metadata/metadata.c
Auto-merging src/mono/mono/mini/type-checking.c
CONFLICT (content): Merge conflict in src/mono/mono/mini/type-checking.c
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 Add option to configure use of compressed interface bitmaps
Error: The process '/usr/bin/git' failed with exit code 128 Please backport manually! |
…tmap feature (dotnet#119881) * Add option to configure use of compressed interface bitmaps This optimization is disabled by default. Enable it with `MONO_COMPRESSED_INTERFACE_BITMAP=1` * Add support for detecting mismatch with aot images
…able (#119953) * [mono][metadata] Enable compressed interface bitmap by default (#119694) * [mono][metadata] Enable compressed interface bitmap by default * Fix build on windows * Fix publishing of compressed bitmap Before this commit we were doing changes on the published data which is problematic for multithreaded environments. We ensure the bitmap is fully processed before publishing it so that we can rely on the data dependency memory ordering constraint for correctness. * [mono] Enable configuration at runtime of the compressed interface bitmap feature (#119881) * Add option to configure use of compressed interface bitmaps This optimization is disabled by default. Enable it with `MONO_COMPRESSED_INTERFACE_BITMAP=1` * Add support for detecting mismatch with aot images
…tmap feature (dotnet#119881) * Add option to configure use of compressed interface bitmaps This optimization is disabled by default. Enable it with `MONO_COMPRESSED_INTERFACE_BITMAP=1` * Add support for detecting mismatch with aot images
…ble (#120154) * [mono][metadata] Enable compressed interface bitmap by default (#119694) * [mono][metadata] Enable compressed interface bitmap by default * Fix build on windows * Fix publishing of compressed bitmap Before this commit we were doing changes on the published data which is problematic for multithreaded environments. We ensure the bitmap is fully processed before publishing it so that we can rely on the data dependency memory ordering constraint for correctness. * [mono] Enable configuration at runtime of the compressed interface bitmap feature (#119881) * Add option to configure use of compressed interface bitmaps This optimization is disabled by default. Enable it with `MONO_COMPRESSED_INTERFACE_BITMAP=1` * Add support for detecting mismatch with aot images
After enabling this by default in #119694, a few microbenchmark regression can be seen with checking if an object implements an interface. In order to make an easier transition into this feature, add a new env var
MONO_COMPRESSED_INTERFACE_BITMAP
which can be checked at runtime to enable this feature. AOT compiled code must have identical feature enabling so that the images are compatible at runtime.