-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Avx2 code causes AccessViolationExceptions with AVX512 available #92357
Comments
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue DetailsDescriptionAvx2 code seems to throw unexpected AccessViolations when AVX512 is available. Reproduction Steps
Expected behaviorNo crash. Actual behavior
Regression?Regression in net8, worked on net7 and net6. Known WorkaroundsSetting Configuration.NET: 8.0.0-rc.1.23419.4 Other informationThere seems to be a single codegen difference: C4E2793DC1 vpmaxsd xmm0, xmm0, xmm1
- C4E2793905EC070000 vpminsd xmm0, xmm0, xmmword ptr [reloc @RWD80] # DOTNET_EnableAVX512F=0
+ 62F27D183905EB070000 vpminsd xmm0, xmm0, dword ptr [reloc @RWD80] {1to4} # DOTNET_EnableAVX512F=1
C5F8298590FCFFFF vmovaps xmmword ptr [rbp-0x370], xmm0
|
Just at a glance, the raw decoding is: - vpminsd xmm0, xmm0, XMMWORD PTR [rip+0x7ec]
+ vpminsd xmm0, xmm0, DWORD PTR [rip+0x7eb] {1to4} and so that looks to be fine/generally correct. It's possible that the address being encoded is somehow incorrect and that's probably the thing that needs to be checked first |
Here is codegen for
|
I'm not able to reproduce on my Zen4 machine. Edit: Nevermind, the checked in project had |
Looks like, It is non deterministic across runs when AVX512 is enabled. Still investigating to determine where that is being corrupted |
Looks like the broadcast is getting dropped from and its trying to load the index directly: Vector256<int> firstBlockIdx = Avx2.Add(Avx2.MultiplyLow(minY.AsInt16(), Vector256.Create((int)m_blocksX).AsInt16()).AsInt32(), minX);
Avx.StoreAligned((int*)firstBlocks, firstBlockIdx); |
Simple repro: Avx2.MultiplyLow(x + x, Vector256.Create(y).AsInt16()) the Create(int).AsInt16() breaks it, likely because the broadcast is over a 32-bit value |
Hi @tannergooding, did you have a chance to look into this? |
This was already resolved with #92414 it just didn’t get linked/auto-closed on merge |
Description
Avx2 code seems to throw unexpected AccessViolations when AVX512 is available.
Reproduction Steps
Expected behavior
No crash.
Actual behavior
Regression?
Regression in net8, worked on net7 and net6.
Known Workarounds
Setting
DOTNET_EnableAVX512F=0
makes it work as expected in Release mode. The project also works in Debug mode.Configuration
.NET: 8.0.0-rc.1.23419.4
OS: Microsoft Windows 11 Home (10.0.22621 version 22621)
CPU: 11th Gen Intel(R) Core(TM) i3-1115G4 @ 3.00GHz
Arch: x64
Other information
There seems to be a single codegen difference:
DOTNET_EnableAVX512F=0
: working disasm.txtDOTNET_EnableAVX512F=1
: broken disasm.txtThe text was updated successfully, but these errors were encountered: