-
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
Skip FP registers processing if method don't have floating points use #85744
Conversation
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue Detailsnull
|
src/coreclr/jit/lsra.h
Outdated
@@ -733,6 +733,7 @@ class LinearScan : public LinearScanInterface | |||
unsigned int currentSpill[TYP_COUNT]; | |||
bool needFloatTmpForFPCall; | |||
bool needDoubleTmpForFPCall; | |||
bool needFloatingRegisters; |
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.
A safe change would be to have needFloatingRegisters |= (theRegisterType != IntRegisterType);
in newInterval()
method but want to see if my current changes achieve the purpose.
Nice TP Diffs |
/azp run runtime-coreclr jitstress-jitstressregs, runtime-coreclr jitstress |
Azure Pipelines successfully started running 1 pipeline(s). |
Do we know what causes the potential hit to Arm64 minopts? Seems odd that we see such huge improvements elsewhere, but not always in minopts but only on Arm64 I see |
Jitstress is green. |
I will try to find it out. |
@dotnet/jit-contrib |
It also occurred to me that for xarch, we already updated the definition of |
// For that `compFloatingPointUsed` should be set accurately | ||
// before invoking allocator. |
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 this bit in particular is a bit difficult as we need to pre-emptively set compFloatingPointUsed
for any SIMD code. But that can't really account for dead code elimination or other factors that might later remove or transforms the nodes to no longer need it.
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.
Would it instead be possible to have regMaskTP LinearScan::internalFloatRegCandidates()
lazily do the below, or is there other factors that require it?
That is, have it do something like:
regMaskTP LinearScan::internalFloatRegCandidates()
{
if (!needNonIntegerRegisters)
{
// lazily initialize fpreg state here
for (unsigned int i = 0; i < lsraRegOrderFltSize; i++)
{
regNumber reg = lsraRegOrderFlt[i];
RegRecord* curr = &physRegs[reg];
curr->regOrder = (unsigned char)i;
}
needNonIntegerRegisters = true;
}
if (compiler->compFloatingPointUsed)
{
return availableFloatRegs;
}
else
{
return RBM_FLT_CALLEE_TRASH;
}
}
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.
Unfortunately we need the physRegRecord early right after identifying candidates.
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.
But that can't really account for dead code elimination or other factors that might later remove or transforms the nodes to no longer need it.
True, but this is the best we can do I suppose, unless you are proposing to just start from scratch in LSRA and set it to true
during BuildNode()
if tree->GetType() != TYP_INT
.
Edit: Doing the check in BuildNode()
might prove costly though because we will be doing that for every single GenTree*
node and not sure how many cases we will optimize for the scenarios where we didn't account for dead code elimination.
Fixes: #83109
Contributes to #83946