-
Notifications
You must be signed in to change notification settings - Fork 533
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
See if we can use $(AndroidAotMode)=full
MONO_AOT_MODE_FULL
#9469
Comments
If we got this working, it would probably solve: |
After some conversation, it may be more appropriate for Android to use Some conversation here: Of course, the drawback to using
Startup time was also either slightly worse (or the same, within margin of error), when using |
I would rather prefer to have an opportunity to opt into the interpreter on Android - all depends on whether it's faster than JIT specifically on app startup. And if we assume Profiled AOT works (ok, currently it doesn't, but maybe you'll end up fixing this), the % of methods to interpret should be relatively small. |
@alexyakunin this feels a bit off-topic, but you can do this today in a <PropertyGroup>
<RunAOTCompilation>false</RunAOTCompilation>
<UseInterpreter>true</UseInterpreter>
</PropertyGroup> But I suspect you will see worse performance with this combination. Startup might be OK, but as soon as there is a complicated There is no combination of "Normal" AOT mode with interpreter: We are consumers of the runtime, so we can only use what they provide. |
Yes, it is - we tried this option. As far as I remember, it's worse on Android vs even JIT w/o AOT. |
@jonathanpeppers What about |
It looks like We'd need to update: Build time: android/src/Xamarin.Android.Build.Tasks/Tasks/GetAotArguments.cs Lines 82 to 109 in aa668a5
Runtime: android/src/native/runtime-base/android-system.cc Lines 582 to 602 in 4266c2b
|
Context: #9469 (comment) I don't think this actually works, as the AOT compiler fails with: > dotnet build -c Release -p:AndroidAotMode=FullInterp -p:AndroidEnableProfiledAot=false -bl -t:Install -r android-x64 helloandroid failed with 1 error(s) (8.9s) D:\src\xamarin-android\bin\Debug\lib\packs\Microsoft.Android.Sdk.Windows\35.99.0\targets\Microsoft.Android.Sdk.Aot.targets(110,5): error : Precompiling failed for D:\src\helloandroid\obj\Release\net9.0-android\android-x64\linked\System.Private.CoreLib.dll with exit code -1073740791. Mono Ahead of Time compiler - compiling assembly D:\src\helloandroid\obj\Release\net9.0-android\android-x64\linked\System.Private.CoreLib.dll AOTID 7FACD039-CD91-2136-1ACD-BC2EDF417C8D * Assertion: should not be reached at D:\a\_work\1\s\src\mono\mono\mini\tramp-amd64.c:1216 helloandroid failed (0.7s) → bin\Release\net9.0-android\android-x64\helloandroid.dll Which is the assertion here: https://github.com/dotnet/runtime/blob/7dab903b20269d78c6bc08d5269947db7d35c22b/src/mono/mono/mini/tramp-amd64.c#L1216
I got an impression iOS uses these modes, + yeah, there is an incompatibility (well, only partial compatibility) between the modes available in Mono runtime & modes you can specify in Android .targets. |
Android framework version
net9.0-android
Affected platform version
.NET 9 RC 2
Description
I was trying to enable "full AOT" and disable JIT on Android:
dotnet new maui
- remove the other platforms beside Androiddotnet build build -c Release -p:AndroidAotMode=full -p:AndroidEnableProfiledAot=false -p:RunAOTCompilation=true -r android-arm64 -bl -t:Run
This should "AOT everything" and also toggle
MONO_AOT_MODE_FULL
at runtime.This appears to pass the right flags to the
<MonoAOTCompiler/>
task:And at runtime:
android/src/native/monodroid/monodroid-glue.cc
Line 1479 in aa668a5
But then the JIT is still used and we crash:
Perhaps it fails on the first generic method?
Steps to Reproduce
See above.
Did you find any workaround?
No.
Relevant log output
aot-mode-full.txt
The text was updated successfully, but these errors were encountered: