-
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
JIT: Avoid reporting call-sites in MinOpts on all targets #103950
base: main
Are you sure you want to change the base?
Conversation
When the call-sites have no interesting GC information we avoid reporting them, but this behavior was enabled only for x86/x64. Enable this on other platforms too. Fix dotnet#103917
src/coreclr/jit/gcencode.cpp
Outdated
@@ -4065,13 +4065,7 @@ void GCInfo::gcMakeRegPtrTable( | |||
{ | |||
GCENCODER_WITH_LOGGING(gcInfoEncoderWithLog, gcInfoEncoder); | |||
|
|||
// TODO: Decide on whether we should enable this optimization for all | |||
// targets: https://github.com/dotnet/runtime/issues/103917 | |||
#ifdef TARGET_XARCH | |||
const bool noTrackedGCSlots = compiler->opts.MinOpts() && !compiler->opts.jitFlags->IsSet(JitFlags::JIT_FLAG_PREJIT); |
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.
@jkotas do you know if there is any dependency on the call site locations by crossgen2? I'm not sure if the PREJIT
condition can also be removed here.
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 do not think crossgen2 has any dependency on that. NativeAOT might have (unintentional) dependency on it - you may want to run NativeAOT outer loop.
The primary motivation for this feature was JIT throughput improvement. This condition is likely result of that thinking - spending the extra cycles for AOT is no big deal.
I do not see a problem with removing this condition.
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.
The change in https://github.com/dotnet/runtime/pull/102680/files#r1653150895 may make us sensitive to missing safepoints.
Mostly just a matter of changing asserts though. We know the caller site is GC-safe. (since we are in a GC-capable callee)
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.
Do you want me to revert the PREJIT
change for now?
/azp run runtime-nativeaot-outerloop, runtime-coreclr gcstress0x3-gcstress0xc |
Azure Pipelines successfully started running 2 pipeline(s). |
/azp run runtime-nativeaot-outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run runtime-coreclr gcstress0x3-gcstress0xc |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run runtime-nativeaot-outerloop, runtime-coreclr gcstress0x3-gcstress0xc |
Azure Pipelines successfully started running 2 pipeline(s). |
@VSadov Do we need to do any adjustments for native AOT? Coverage for minopts + native AOT is likely very minimal, so I am not sure whether we can depend on tests to find all issues. @jakobbotsch It may be worth pushing a temporary change that unconditionally enables minopts for naot to see whether there are any real issues. |
I think NativeAOT at this point should be compatible with this change. This mostly affects decoder and that is shared.
I think it would be interesting. Maybe we will find issues related to this change or even unrelated ones… |
Do you know what the simplest way to do that would be? I imagine I can't just do it on the JIT side due to IL scanner mismatches? |
You should be able to do it in the JIT. IL scanner is not aware of minopts vs. full opts differences. It has to assume the worst case. It has no control over when the JIT decides to degrade to minopts on its own. |
Hmm, that didn't seem to work. Any other ideas? |
This shows that there are pre-existing issues with minopts and IL scanner. cc @MichalStrehovsky |
The scanner makes an assumption that runtime/src/coreclr/tools/aot/ILCompiler.Compiler/IL/ILImporter.Scanner.cs Lines 434 to 437 in 3116db9
If I mark this as Smoke tests don't run with this change however, we're hitting |
This is a bit strange. This is an assert in a leaf frame checking that we were interrupted on a safe point. This change indeed removes safe points from the GC info, but then how could the execution be interrupted if the safe point is missing? |
Ah, yes, it could be interrupted via hijacking. The helper was specifically introduced to be more permissive in asserts and allow cases where safepoints are possibly missing due to MinOpts. |
I think we should do it unconditionally. (It would be more correct to treat it as @jakobbotsch Are you fine with doing this and the change that @VSadov suggested in this PR, or would you like those changes to be submitted separately? |
I think we should fix the ILScanner/ If you think we should expand this unconditionally the intrinsic should just be made recursive in the C# sources, right? (Hmm, no.. we don't really have prior art to unconditionally expanded intrinsics in callers outside of NAOT. I would probably suggest we just add this one to the list of ones expanded for NAOT.) |
/azp run runtime-nativeaot-outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
When the call-sites have no interesting GC information we avoid reporting them, but this behavior was enabled only for x86/x64. Enable this on other platforms too.
Fix #103917