-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Enregister structs on win x64. #55045
Conversation
/azp run runtime-coreclr jitstress, runtime-coreclr outerloop |
Azure Pipelines successfully started running 2 pipeline(s). |
PTAL @BruceForstall @dotnet/jit-contrib |
The failures are not related, I will run jitstressregs as well later when the failing test is disabled. |
/azp run runtime-coreclr jitstressregs |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run runtime-coreclr outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
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.
LGTM...but I will let Bruce take another look.
@@ -1210,13 +1210,6 @@ void CodeGen::genUnspillRegIfNeeded(GenTree* tree) | |||
assert(!varTypeIsGC(varDsc)); | |||
spillType = lclActualType; | |||
} | |||
#elif defined(TARGET_ARM64) | |||
var_types targetType = unspillTree->gtType; | |||
if (spillType != genActualType(varDsc->lvType) && !varTypeIsGC(spillType) && !varDsc->lvNormalizeOnLoad()) |
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.
nit: could you also update the comment about to genActualType GetActualRegisterType()?
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.
sure, what would you like to add there? now it looks like:
runtime/src/coreclr/jit/lclvars.cpp
Lines 3824 to 3830 in 96ef64d
//------------------------------------------------------------------------ | |
// GetActualRegisterType: Determine an actual register type for this local var. | |
// | |
// Return Value: | |
// TYP_UNDEF if the layout is not enregistrable, the register type otherwise. | |
// | |
var_types LclVarDsc::GetActualRegisterType() const |
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.
Sorry - didn't notice your comment.
I was suggesting to update the comment right above where you changed the code:
runtime/src/coreclr/jit/codegenlinear.cpp
Lines 1195 to 1200 in 656775f
// Load local variable from its home location. | |
// In most cases the tree type will indicate the correct type to use for the load. | |
// However, if it is NOT a normalizeOnLoad lclVar (i.e. NOT a small int that always gets | |
// widened when loaded into a register), and its size is not the same as genActualType of | |
// the type of the lclVar, then we need to change the type of the tree node when loading. | |
// This situation happens due to "optimizations" that avoid a cast and |
and its size is not the same as genActualType of the type of the lclVar,
and its size is not the same as actual register type,
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.
thanks, fixed
10259df
to
4256a28
Compare
What's the plan for structs that contain floating point values or that might be more efficiently enregistered in a SIMD local (e.g. |
|
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.
LGTM
This PR enables struct enregistration for x64 windows (the only platform without multiregs).
Contributes to #43867.
The regressions are expected, they are caused by:
There are tiny changes on other platforms because of improved lowering (
IsEnregisterableLcl
return false oftener and allows more contained cases) not worth mentioning here (all improvements, no regressions).Note that it is not the final state, the biggest beast is
call(obj(addr(lcl_var)))
and I will be dealing with it separately.Benchmarks improvement (for improvements analysis)
Improvement example
for such test where we init/copy a struct that fits into a register and doesn't access its fields (7.0 maybe) and do not pass it as a call argument (next step, hopefully, 6.0)
we have such diffs: