-
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
Fix SIMD data overallocation #71043
Fix SIMD data overallocation #71043
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7384,6 +7384,7 @@ void Lowering::LowerSIMD(GenTreeSIMD* simdNode) | |
|
||
if (arg->IsCnsFltOrDbl()) | ||
{ | ||
noway_assert(constArgCount < ArrLen(constArgValues)); | ||
constArgValues[constArgCount] = static_cast<float>(arg->AsDblCon()->gtDconVal); | ||
constArgCount++; | ||
} | ||
|
@@ -7396,10 +7397,14 @@ void Lowering::LowerSIMD(GenTreeSIMD* simdNode) | |
BlockRange().Remove(arg); | ||
} | ||
|
||
assert(sizeof(constArgValues) == 16); | ||
// For SIMD12, even though there might be 12 bytes of constants, we need to store 16 bytes of data | ||
// since we've bashed the node the TYP_SIMD16 and do a 16-byte indirection. | ||
assert(varTypeIsSIMD(simdNode)); | ||
const unsigned cnsSize = genTypeSize(simdNode); | ||
assert(cnsSize <= sizeof(constArgValues)); | ||
|
||
unsigned cnsSize = sizeof(constArgValues); | ||
unsigned cnsAlign = (comp->compCodeOpt() != Compiler::SMALL_CODE) ? cnsSize : 1; | ||
const unsigned cnsAlign = | ||
(comp->compCodeOpt() != Compiler::SMALL_CODE) ? cnsSize : emitter::dataSection::MIN_DATA_ALIGN; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I peeked at This change looks good/correct to me, but it would probably be better if we lowered this to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Looks fine to me. |
||
|
||
CORINFO_FIELD_HANDLE hnd = | ||
comp->GetEmitter()->emitBlkConst(constArgValues, cnsSize, cnsAlign, simdNode->GetSimdBaseType()); | ||
|
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.
Is there an example of what this displayed previously vs what it displays now?
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.
+1
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.
If you set
COMPlus_JitDasmWithAddress=1
you'll see:where the
; @ ...
lines are new.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'd assume those be excluded in
DiffableDasm
(I've never usedJitDasmWithAddress
, didn't know it existed 👍)?Also its worth noting that the address shown there is a multiple of
4
, but I would have expected it to be a multiple of16
(should probably be000002cc_0d8d4fd0
, not000002cc_0d8d4fc4
). Was this done withMIN_DATA_ALIGN
or is there a different bug 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.
If you set JitDasmWithAddress, you've given up on diffable (and JitDasmWithAddress is normally not set).
As for the multiple of 4 issue: that's what I've fixed with #71044.