Skip to content
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 stress apple arm64 assertion '(thisFieldOffset + EA_SIZE_IN_BYTES(attr)) <= areaSize' #48936

Merged
merged 2 commits into from
Mar 5, 2021

Conversation

sandreenko
Copy link
Contributor

Fixes #48787

@sandreenko sandreenko added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Mar 2, 2021
@sandreenko
Copy link
Contributor Author

/azp run runtime-coreclr jitstress

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@sandreenko
Copy link
Contributor Author

PTAL @dotnet/jit-contrib

src/coreclr/jit/codegenlinear.cpp Outdated Show resolved Hide resolved
#endif // FEATURE_SIMD
{
emitAttr attr = emitTypeSize(type);
GetEmitter()->emitIns_S_R(ins_Store(type), attr, reg, outArgVarNum, thisFieldOffset);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sandreenko Correct me if I am wrong - on non macos-arm64 TYP_SIMD12 is going to take 16 bytes on the stack and the JIT uses str Qd, [Xn] instruction

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@echesakovMSFT there are different cases:

  1. pass in regs;
  2. pass on stack;
    x
  3. LCL_VAR
  4. LCL_FLD
  5. OBJ/IND
  6. FIELD_LIST

usually, if we pass LCL_VAR SIMD12 we will use str Qd, [Xn], because we know that LCL_VAR has 4 bytes after 12 bytes of SIMD that we can read, but if SIMD12 is a field of a struct then we will have to read exactly 12 bytes, so we will have IND SIMD12(ADDR(LCL_FLD)) and it has similar logic.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thanks!

Copy link
Contributor

@echesakov echesakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

#endif // FEATURE_SIMD
{
emitAttr attr = emitTypeSize(type);
GetEmitter()->emitIns_S_R(ins_Store(type), attr, reg, outArgVarNum, thisFieldOffset);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thanks!

void emitStoreSIMD12ToLclOffset(unsigned varNum, unsigned offset, regNumber opReg, regNumber tmpReg)
{
assert(varNum != BAD_VAR_NUM);
assert((opReg != REG_NA) && (tmpReg != REG_NA));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you validating incoming opReg ad tmpReg you also check here that they have right types, i.e. opReg is SIMD, and tmpReg is a general purpose register.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added assert for opReg is SIMD but for tmp the type is unknown: for x86 we require an xmm register, for other it looks random, some places allocate integer, the other xmm.

@sandreenko sandreenko merged commit 04ff9bd into dotnet:main Mar 5, 2021
@sandreenko sandreenko deleted the fixStressArm64 branch March 5, 2021 16:22
@ghost ghost locked as resolved and limited conversation to collaborators Apr 4, 2021
@JulieLeeMSFT JulieLeeMSFT added this to the 6.0.0 milestone Apr 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Apple Silicon jitstress1 assertion
3 participants