-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Add a --aot-lazy-assembly-load command line option to load assemblies… #67024
Conversation
This option can either be set on the command line, or from C code before
|
24b01b3
to
f99f7c0
Compare
Does this need to be documented anywhere? nvm that! |
/backport to release/6.0 |
Started backporting to release/6.0: https://github.com/dotnet/runtime/actions/runs/2028463178 |
@lambdageek backporting to release/6.0 failed, the patch most likely resulted in conflicts: $ git am --3way --ignore-whitespace --keep-non-patch changes.patch
Applying: Add a --aot-lazy-assembly-load command line option to load assemblies referenced by AOT images lazily.
Using index info to reconstruct a base tree...
M src/mono/mono/mini/aot-runtime.c
M src/mono/mono/utils/options-def.h
Falling back to patching base and 3-way merge...
Auto-merging src/mono/mono/utils/options-def.h
CONFLICT (content): Merge conflict in src/mono/mono/utils/options-def.h
Auto-merging src/mono/mono/mini/aot-runtime.c
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Add a --aot-lazy-assembly-load command line option to load assemblies referenced by AOT images lazily.
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Error: The process '/usr/bin/git' failed with exit code 128 Please backport manually! |
@vargaz these options are a little bit difficult for embedders to use - Here's how XA does it now: https://github.com/xamarin/xamarin-android/blob/169838082a55f8a280d4179ca3a12f852ef6002c/src/monodroid/jni/monodroid-glue.cc#L835 @steveisok is there some way to pass options to our Android template? It would be nice if we could modify one of the functional tests to use this https://github.com/dotnet/runtime/tree/main/src/tests/FunctionalTests/Android/Device_Emulator |
We'd have to tweak a few things, but it shouldn't be too difficult. |
Will fix that. I think it is parsed when parsing MONO_ENV_OPTIONS. |
Also, options.h could become part of the embedding api in the future if the api looks ok. |
… referenced by AOT images lazily. Note that this requires the assemblies used at AOT time to exactly match the assemblies loaded at runtime, otherwise the runtime will abort when it loads the mismatching reference.
f99f7c0
to
3a7d049
Compare
@@ -58,6 +58,7 @@ DEFINE_BOOL_READONLY(readonly_flag, "readonly-flag", FALSE, "Example") | |||
*/ | |||
|
|||
DEFINE_BOOL(wasm_exceptions, "wasm-exceptions", FALSE, "Enable codegen for wasm exceptions") | |||
DEFINE_BOOL(aot_lazy_assembly_load, "aot-lazy-assembly-load", FALSE, "Load assemblies referenced by AOT images lazily") |
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.
Should we make the default true for HOST_ANDROID, HOST_WASM, HOST_DARWIN && !HOST_OSX?
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.
I think platforms should set it themselves.
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.
Or maybe we can set it in the runtime startup code.
Have we tried using this on Maui Android and gotten any before/after startup perf numbers? |
@eerhardt we haven't tried |
dotnet#67024) * Add a --aot-lazy-assembly-load command line option to load assemblies referenced by AOT images lazily. Note that this requires the assemblies used at AOT time to exactly match the assemblies loaded at runtime, otherwise the runtime will abort when it loads the mismatching reference. * Handle the options added by options.h in mono_jit_parse_options ().
dotnet#67024) * Add a --aot-lazy-assembly-load command line option to load assemblies referenced by AOT images lazily. Note that this requires the assemblies used at AOT time to exactly match the assemblies loaded at runtime, otherwise the runtime will abort when it loads the mismatching reference. * Handle the options added by options.h in mono_jit_parse_options ().
#67024) (#67103) * Add a --aot-lazy-assembly-load command line option to load assemblies referenced by AOT images lazily. Note that this requires the assemblies used at AOT time to exactly match the assemblies loaded at runtime, otherwise the runtime will abort when it loads the mismatching reference. * Handle the options added by options.h in mono_jit_parse_options (). Co-authored-by: Zoltan Varga <vargaz@gmail.com>
Fixes: dotnet#6935 Context: dotnet/runtime#67024 Add support for enabling lazy loading of AOTd assemblies and their associated shared libraries, when targetting .NET6+. The feature is enabled by default when AOT is enabled for `Release` builds and can be disabled by setting the new `$(AndroidAotEnableLazyLoad)` MSBuild property to `false`.
Fixes: dotnet#6935 Context: dotnet/runtime#67024 Add support for enabling lazy loading of AOTd assemblies and their associated shared libraries, when targetting .NET6+. The feature is enabled by default when AOT is enabled for `Release` builds and can be disabled by setting the new `$(AndroidAotEnableLazyLoad)` MSBuild property to `false`.
Fixes: dotnet#6935 Context: dotnet/runtime#67024 Add support for enabling lazy loading of AOTd assemblies and their associated shared libraries, when targetting .NET6+. The feature is enabled by default when AOT is enabled for `Release` builds and can be disabled by setting the new `$(AndroidAotEnableLazyLoad)` MSBuild property to `false`.
… referenced by AOT images lazily.
Note that if this is enabled, and a referenced assembly is not found or its not
the exact version used to AOT the referencing assembly, the runtime will abort
because these kinds of errors can only be handled when loading the AOT image,
not later.