Allow enregistering more structs args#39326
Conversation
234c49f to
444c139
Compare
|
This results in improvements primarily for Arm targets. Here are the crossgen diffs for frameworks & benchmarks (using altjits for x64UX, Arm and Arm64):
The regressions result primarily from register allocation issues (we don't prefer callee-save for floating point registers, so promoting a floating point field is not always profitable if it's live across a call). |
|
@dotnet/jit-contrib PTAL |
444c139 to
56ca049
Compare
sandreenko
left a comment
There was a problem hiding this comment.
It looks like a risky change, but I understand that it is better to get it into the Prev rather that an RC.
I have a few small question and hope you could run stress tests before the merge.
LGTM in case I don't wake up before the snap.
src/coreclr/src/jit/lclvars.cpp
Outdated
There was a problem hiding this comment.
Nit: This is a perfect logical expression, but took me some time to check all cases. Maybe it could be rephrased a little bit? Maybe "A struct field that is not an opaque SIMD type blocks promotion if it it is not the only field." or delete the comment here and put it near !compiler->isOpaqueSIMDType(structPromotionInfo.fields[i].fldTypeHnd) saying that `opaque SIMD fields can be promoted'.
There was a problem hiding this comment.
This comment was reworded, hopefully it's more clear now.
src/coreclr/src/jit/lclvars.cpp
Outdated
There was a problem hiding this comment.
Does not it create aljit issues similar to #38980?
There was a problem hiding this comment.
It may, though I haven't run into them. That, however, is an altjit-specific issue so I don't think it should hold up this PR.
src/coreclr/src/jit/lclvars.cpp
Outdated
There was a problem hiding this comment.
| // varDsc - the local variable | |
| // varDsc - the local variable descriptor? |
src/coreclr/src/jit/lclvars.cpp
Outdated
There was a problem hiding this comment.
Do we leave it set to BAD_STK_OFFS after this change?
There was a problem hiding this comment.
No, this was duplicative; the field offsets are set in the promoted struct case, and don't need to be set again when they are encountered.
src/coreclr/src/jit/morph.cpp
Outdated
There was a problem hiding this comment.
I think I am not following it. Could you please explain? structPromotionHelper has structPromotionInfo that is a private temporary buffer that we use to keep information about the last analyzed type. We access it only in TryPromoteStructVar and nowhere else.
Where could we access structPromotionHelper->structPromotionInfo.typeHnd that is cleared here?
There was a problem hiding this comment.
The cache is used by the inliner, during which it is conservative about looking up SIMD info. I clarified the comment a bit.
There was a problem hiding this comment.
Nit: extract regArgTab[nextArgNum] to avoid the line break and use it in the next line as well.
cf4f903 to
b67b73d
Compare
7fbf6b0 to
a05526c
Compare
|
@dotnet/jit-contrib PTAL Prior to the latest push, I ran jitStressRegs, and there were some test build failures. There were no actual test failures, but having rebased, once the normal CI tests complete I'll run jitStressRegs again and hopefully the test build will succeed. |
|
ping @dotnet/jit-contrib |
|
Does this fix the lack of enregistration/promotion in It would show up in PMI diffs, I think (for arm64). |
src/coreclr/src/jit/morph.cpp
Outdated
There was a problem hiding this comment.
Thanks for the explanation and the comment, I would probably rephrase it as: since it is used during importation for inlining decisions.
the place that uses it before we call struct promotion is:
runtime/src/coreclr/src/jit/importer.cpp
Lines 18651 to 18658 in 334bd84
|
@AndyAyersMS - this doesn't fix the Here are the diffs:
I'll have a look at |
Allow HFAs and other structs with matching fields and registers. Contributes to dotnet#37924
a05526c to
134dd48
Compare
|
It turns out that these changes only support enregistering HFAs for Arm64; other multi-reg structs aren't promoted. I have a change that handles them, but will submit a separate PR for that. |
Allow HFAs and other structs with matching fields and registers.
Fix #37924