-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Fixing the x86 HWIntrinsic tests to not leave a GC hole #16957
Conversation
FYI. @fiigii, @CarolEidt, @BruceForstall |
Is this something that we could readily detect/assert? |
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 it fixes the issue, I'm happy with it.
Note that you will very likely not get clean gcstress runs, but if the HW intrinsics tests don't fail, that's good enough for this change.
Don't know the answer to your question about an assert.
It seems like we should be able to, but I couldn't say for sure without looking at it more closely. FWIW, it might be worthwhile in future, when changing the templates, to mention (for those who don't review these all the time) that the bulk of the change is auto-generated tests, and only the templates need review. |
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
@tannergooding - there are still a number of failures in the intrinsics tests, though fewer than before (at least in the test runs I looked at). Have you investigated this? |
Not yet. I should get to this sometime later tonight. |
Rebased to include the new tests added. Still investigating the remaining issue with the AVX tests |
…returned is correct
Remaining failures are from tests that work with both 128-bit and 256-bit types. There are a few that are reading/writing too many fields. |
Are you planning to merge this and work on those separately? |
@CarolEidt, we can if you feel that is better. I am working on resolving the issues in either case and will have either this PR fixed up or a new one up shortly. |
I can go either way - feel free to merge or wait. |
3 new commits:
|
Hmm, all our jitstress jobs seem to be "missing" and there are no generator jobs pending.... CC. @dotnet/dnceng, @mmitche |
Looks like the last generator job timed out and left us in some indeterminate state. I've re-queued the job to see if it will complete this time. |
New generator job succeeded and jobs are back. Link to one of the previous failures (where the initial job existed, but the downstream job was missing): https://ci.dot.net/job/dotnet_coreclr/job/master/job/x64_checked_osx10.12_innerloop_flow_prtest/1875/console There isn't a link to one of the jobs where the test phrase worked, but the actual job didn't exist (all the jitstress fell into this category) |
@CarolEidt, this should hopefully be ready and let all the jobs succeed now |
There were a handful of tests which basically use modified template code without actually being generated from a template. Those are fixed now as well. |
Remaining test failures all look to deal with Ex: Fails with:
Further investigation shows that it is specifically JitDump.txt <-- I haven't finished investigating this yet. @fiigii, can you assist with this? It seems to be a more general issue with |
Fixing this removes the GCStress failure, but causes the tests to start failing with "incorrect" results |
And the "incorrect" results are because the instruction is being encoded incorrectly (it was encoded correctly before, with the operands swapped). |
Ok, the extract instructions have been updated to have an encoding in the The SSE4.1 tests were all passing locally, hopefully they do the same in CI now. |
Sorry for the delay to reply.
According to the manual, integral extract instructions have |
@@ -1183,7 +1183,7 @@ void CodeGen::genSSE41Intrinsic(GenTreeHWIntrinsic* node) | |||
if (baseType == TYP_FLOAT) | |||
{ | |||
// extract instructions return to GP-registers, so it needs int size as the emitsize | |||
emit->emitIns_SIMD_R_R_I(ins, emitTypeSize(TYP_INT), op1Reg, tmpTargetReg, (int)i); | |||
emit->emitIns_SIMD_R_R_I(ins, emitTypeSize(TYP_INT), tmpTargetReg, op1Reg, (int)i); |
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.
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 don't think that those letters are meant to describe 'how' it is encoded:
The entry explicitly calls out that Operand 1
is encoded in the ModRM byte in the r/m
field and that Operand 2
is encoded in the ModRM byte in the reg
field. Since Operand 1
is encoded in the r/m
field, this makes it an MRI
instruction.
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.
That is, the only difference between MR and RM is whether Op1 or Op2 is encoded in the r/m
field of the ModRM byte. MR encodes Op1
there and RM encodes Op2
there.
src/jit/instrsxarch.h
Outdated
INST3( pextrb, "pextrb" , 0, IUM_WR, 0, 0, SSE3A(0x14), BAD_CODE, SSE3A(0x14)) // Extract Byte | ||
INST3( pextrd, "pextrd" , 0, IUM_WR, 0, 0, SSE3A(0x16), BAD_CODE, SSE3A(0x16)) // Extract Dword | ||
INST3( pextrq, "pextrq" , 0, IUM_WR, 0, 0, SSE3A(0x16), BAD_CODE, SSE3A(0x16)) // Extract Qword | ||
INST3( extractps, "extractps" , 0, IUM_WR, 0, 0, SSE3A(0x17), BAD_CODE, SSE3A(0x17)) // Extract Packed Floating-Point Values |
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 do not think the can have MR
and RM
encoding both.
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 you're right. I had originally added both in order to mimic the pre-existing vextractf128
table entries; however, those look to be causing issues as well. Testing locally to see if everything passes.
Still a failure in the Sse2 tests, looks to be issues with the |
The However, the logic was also way complicated since these tests all took just |
test Windows_NT x64 Checked gcstress0x3 test Windows_NT x86 Checked gcstress0x3 test Ubuntu x64 Checked gcstress0x3 |
@dotnet-bot test Windows_NT x64 Checked jitstressregs0x1000 @dotnet-bot test Windows_NT x86 Checked jitstressregs0x1000 @dotnet-bot test Ubuntu x64 Checked jitstressregs0x1000 |
Ok, the failing tests are mostly not related, but they should still be investigated. The exceptions are:
I'm going to keep investigating the remaining HWIntrinsic failures, but will plan on addressing them seperately. I will also work on logging bugs for the unrelated failures |
FYI. @CarolEidt, @BruceForstall. I have logged a general issue (https://github.com/dotnet/coreclr/issues/17027) to track the further investigation required on the various unrelated JIT Stress failures. Ideally they would be further investigated and then split out into their own work items, as appropriate. |
@tannergooding - the JIT changes look good. I reviewed the template changes, and they also LGTM. I'm fine with merging this at this point, but let me know if you want me to review the test files you changed manually (unless you converted those to templates?) |
@CarolEidt, They have not been converted to templates yet. |
Looks like a lot of jobs are affected by #17008 |
Yes, this is by far the most widespread and consistent failure. |
After this went in I am starting to work on porting remaining tests to templated versions. It would be helpful if we could coordinate our work to avoid overlaps. Right now I plan to work on all scalar tests comprising conversions, loads, stores and comparisons. Any suggestions? |
This resolves https://github.com/dotnet/coreclr/issues/16938, https://github.com/dotnet/coreclr/issues/16370
The tests were incorrectly calling
AsPointer
on a managed ref.