Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Fixing encodeXmmRegAsIval to ensure the result meets the 'fits in imm8' check #18849

Merged
merged 1 commit into from
Jul 10, 2018
Merged

Fixing encodeXmmRegAsIval to ensure the result meets the 'fits in imm8' check #18849

merged 1 commit into from
Jul 10, 2018

Conversation

tannergooding
Copy link
Member

FYI. @CarolEidt, @fiigii, @eerhardt

This resolves #18815

@tannergooding
Copy link
Member Author

This is the same as #18820, but in a new PR as the old one seems to have gotten into some weird state that caused the perf correctness jobs to fail (even with a whitespace only change).

@tannergooding
Copy link
Member Author

@dotnet-bot test Windows_NT x64 Checked jitincompletehwintrinsic please
@dotnet-bot test Windows_NT x64 Checked jitx86hwintrinsicnoavx please
@dotnet-bot test Windows_NT x64 Checked jitx86hwintrinsicnoavx2 please
@dotnet-bot test Windows_NT x64 Checked jitx86hwintrinsicnosimd please
@dotnet-bot test Windows_NT x64 Checked jitnox86hwintrinsic please

@dotnet-bot test Windows_NT x86 Checked jitincompletehwintrinsic please
@dotnet-bot test Windows_NT x86 Checked jitx86hwintrinsicnoavx please
@dotnet-bot test Windows_NT x86 Checked jitx86hwintrinsicnoavx2 please
@dotnet-bot test Windows_NT x86 Checked jitx86hwintrinsicnosimd please
@dotnet-bot test Windows_NT x86 Checked jitnox86hwintrinsic please

@dotnet-bot test Ubuntu x64 Checked jitincompletehwintrinsic please
@dotnet-bot test Ubuntu x64 Checked jitx86hwintrinsicnoavx please
@dotnet-bot test Ubuntu x64 Checked jitx86hwintrinsicnoavx2 please
@dotnet-bot test Ubuntu x64 Checked jitx86hwintrinsicnosimd please
@dotnet-bot test Ubuntu x64 Checked jitnox86hwintrinsic please

@@ -111,7 +111,7 @@ IF_DEF(RRW_RRW_CNS, IS_R1_RW|IS_R2_RW, SCNS) // r/w reg , r/w r
IF_DEF(RWR_RRD_RRD, IS_R1_WR|IS_R2_RD|IS_R3_RD, NONE) // write reg , read reg2 , read reg3
IF_DEF(RWR_RRD_RRD_CNS, IS_R1_WR|IS_R2_RD|IS_R3_RD, SCNS) // write reg , read reg2 , read reg3, const

IF_DEF(RWR_RRD_RRD_RRD, IS_R1_WR|IS_R2_RD|IS_R3_RD|IS_R4_RD, NONE) // write reg , read reg2 , read reg3 , read reg4
IF_DEF(RWR_RRD_RRD_RRD, IS_R1_WR|IS_R2_RD|IS_R3_RD|IS_R4_RD, CNS) // write reg , read reg2 , read reg3 , read reg4
Copy link
Member Author

Choose a reason for hiding this comment

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

@fiigii, @CarolEidt. This was causing the additional assert, we need to ensure that RWR_RRD_RRD_RRD is marked as carrying a constant (for encoding reg4) so that the debug only id size checks succeed.

This seems to only matter when reg4 is an extended register and generates "large" constant (which is really just a sign-extended byte constant)

assert(opReg >= XMMBASE);
int ival = (opReg - XMMBASE) << 4;

assert((ival >= 0) && (ival <= 255));
Copy link
Member Author

Choose a reason for hiding this comment

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

But I would at least not cast to a signed type (int8_t) when you're using an unsigned range above.

@CarolEidt, we actually can't do that and both are required.

The JIT does signed check (value must be in range of -128 to 127) for "fits in byte". However, the value returned by the computation, (opReg - XMMBASE) << 4, is within the unsigned range (0 to 255).

If we cast to uint8_t, then the value is zero-extended, rather than sign-extended, and we will fail the "fits in byte" check. This was the same problem that was plaguing the HWIntrinsic APIs that directly take an immediate parameter (as they take a byte). -- I think we also discussed, briefly, that this may cause us to emit code that is larger than necessary in some cases (but I don't see an issue tracking that)...

@tannergooding
Copy link
Member Author

@CarolEidt, do you know who to tag on the Perf Tests Correctness failures? I can't get them to fail locally and it seems to be persistent no matter what the PR contains (it failed last night, on the previous PR with a whitespace only change).

@tannergooding
Copy link
Member Author

For reference, the jenkins logs are indicating that submission-metadata.json can't be found in the workspace directory:

23:03:59 Traceback (most recent call last):
23:03:59 File "tests\scripts\run-xunit-perf.py", line 530, in
23:03:59 sys.exit(main(Args))
23:03:59 File "tests\scripts\run-xunit-perf.py", line 521, in main
23:03:59 upload_to_benchview(python, coreclrRepo, benchviewPath, uploadToBenchview, benchviewGroup, runType, configuration, operatingSystem, etwCollection, optLevel, jitName, pgoOptimized, arch)
23:03:59 File "tests\scripts\run-xunit-perf.py", line 285, in upload_to_benchview
23:03:59 raise Exception('%s does not exist. There is no data to be uploaded.' % jsonFile)
23:03:59 Exception: D:\j\w\perf_perflab_---89ec9f56\submission-metadata.json does not exist. There is no data to be uploaded.

@CarolEidt
Copy link

So ... perhaps @adiaaida or @noahfalk who have most recently touched the tests\scripts\run-xunit-perf.py script.

@tannergooding
Copy link
Member Author

@CarolEidt, @adiaaida, @noahfalk. I found the issue. My PR title contains quotes, which break the tools\submission-metadata.py script

@tannergooding tannergooding changed the title Fixing encodeXmmRegAsIval to ensure the result meets the "fits in imm8" check Fixing encodeXmmRegAsIval to ensure the result meets the 'fits in imm8' check Jul 10, 2018
@tannergooding
Copy link
Member Author

@dotnet-bot test Windows_NT x64 full_opt ryujit CoreCLR Perf Tests Correctness please
@dotnet-bot test Windows_NT x64 min_opt ryujit CoreCLR Perf Tests Correctness please
@dotnet-bot test Windows_NT x86 full_opt ryujit CoreCLR Perf Tests Correctness please
@dotnet-bot test Windows_NT x86 min_opt ryujit CoreCLR Perf Tests Correctness please

@tannergooding
Copy link
Member Author

Logged https://github.com/dotnet/coreclr/issues/18855 to track the issue and changed my PR title in the meantime.

Copy link

@CarolEidt CarolEidt left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RyuJIT] Assert failure "unexpected operand size" when folding LCL_FLD into Avx.BlendVariable
2 participants