-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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][mini] Prefer calling llvmaot compiled method instead of inlining it with JIT #107401
Conversation
Tagging subscribers to this area: @lambdageek, @steveisok |
For example, for the following api:
If no HW intrinsic support is enabled, the SearchValues will be a While we have some support at emitting certain intrinsics with JIT, the overall simd support in jit is disabled. Bringing it on par with llvm might be work we don't want to invest in. Some of the methods making use of simd api are decorated with |
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.
This feels like it will cause perf regressions - I think this will mean we never inline hot methods that were also emitted into the AOT image. Can we add a MonoAotMethodFlags flag like MONO_AOT_METHOD_FLAG_HAS_LLVM_INTRINSICS
and avoid inlining only those methods?
Thank you Vlad for investigating this issue. Do I understand the issue correctly that we only hit this in AOT-llvm scenario where JIT (mini) is allowed? Would we hit the same issue if we run fullAOT-llvm which uses mini codegen (less intrinsics support) for the parts that are not possible to AOT compile? The same if we would use fullAOT-llvm with interpreter fallback (also less intrinsics support)? |
The issue was triggered by using normal aot I think, in the wild, this issue would be visible on android, where we could use some partial/profiled aot with llvm enabled, with JIT fallback for everything else. |
https://github.com/dotnet/runtime/blob/main/docs/design/coreclr/botr/vectors-and-intrinsics.md has some information on how these attributes are used. They are primarily for R2R (since its partial compilation) as normal JIT or NAOT usage is "full" and self-consistent. It sounds like this would indeed be a place for the partial AOT scenario on Mono could utilize this information as well. Notably none of these paths should be actually reachable if one of the So it's also possible that the partial AOT scenario could handle this by ensuring the relevant dead code elimination happens, by ensuring that use of the platform specific intrinsics correctly throws |
11c6a33
to
cbcb694
Compare
/azp run runtime-llvm |
Azure Pipelines successfully started running 1 pipeline(s). |
…th JIT The motivation for this is to fix crashes due to different HW intrinsics support between llvm and JIT. For example, a llvmaot compiled method might check if we have a set of HW intrinsics available and proceed with a code path that will end up calling a method that assumes intrinsics support that is not present in the aot image (because the gsharedvt version is not emitted for example). In this scenario, the called method will end up being compiled with JIT where we would crash due to missing HW intrinsics support.
We include a new flag when compiling aot method. When loading aot method, we will include mapping from code to flags so we can look it up later.
cbcb694
to
335464b
Compare
/azp run runtime-llvm |
Azure Pipelines successfully started running 1 pipeline(s). |
/backport to release/9.0 |
Started backporting to release/9.0: https://github.com/dotnet/runtime/actions/runs/10879961822 |
…ng it with JIT (dotnet#107401) * [mono][mini] Prefer llvmaot compiled method instead of inlining it with JIT The motivation for this is to fix crashes due to different HW intrinsics support between llvm and JIT. For example, a llvmaot compiled method might check if we have a set of HW intrinsics available and proceed with a code path that will end up calling a method that assumes intrinsics support that is not present in the aot image (because the gsharedvt version is not emitted for example). In this scenario, the called method will end up being compiled with JIT where we would crash due to missing HW intrinsics support. * [mono][mini] Prefer llvm compiled method only if it uses simd intrinsics We include a new flag when compiling aot method. When loading aot method, we will include mapping from code to flags so we can look it up later.
…ng it with JIT (dotnet#107401) * [mono][mini] Prefer llvmaot compiled method instead of inlining it with JIT The motivation for this is to fix crashes due to different HW intrinsics support between llvm and JIT. For example, a llvmaot compiled method might check if we have a set of HW intrinsics available and proceed with a code path that will end up calling a method that assumes intrinsics support that is not present in the aot image (because the gsharedvt version is not emitted for example). In this scenario, the called method will end up being compiled with JIT where we would crash due to missing HW intrinsics support. * [mono][mini] Prefer llvm compiled method only if it uses simd intrinsics We include a new flag when compiling aot method. When loading aot method, we will include mapping from code to flags so we can look it up later.
The motivation for this is to fix crashes due to different HW intrinsics support between llvm and JIT. For example, a llvmaot compiled method might check if we have a set of HW intrinsics available and proceed with a code path that will end up calling a method that assumes intrinsics support that is not present in the aot image (because the gsharedvt version is not emitted for example). In this scenario, the called method will end up being compiled with JIT where we would crash due to missing HW intrinsics support.
#106914