-
Notifications
You must be signed in to change notification settings - Fork 5.4k
fix #105969 #106218
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
Merged
Merged
fix #105969 #106218
Changes from 2 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
78d6f56
fix #105969
Ruihan-Yin e17c891
formatting
Ruihan-Yin 4c63c15
reset the base type of some intrinsics when the actual base type mism…
Ruihan-Yin 9c74ed4
Merge branch 'main' into runtime_105969
tannergooding cfa61e5
Move the normalization to import.
Ruihan-Yin 1a60820
clean up
Ruihan-Yin f62ef56
bug fix
Ruihan-Yin 98f7f1d
formatting.
Ruihan-Yin b158fb5
bug fix
Ruihan-Yin 9ab0d58
resolve comments.
Ruihan-Yin c8682a4
Ensure that we're computing the correct memory operand size for disas…
tannergooding c2e4a82
Merge remote-tracking branch 'dotnet/main' into runtime_105969
tannergooding 9bd684f
Ensure that we correctly handled rewriting PTESTM to account for a ne…
tannergooding File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/tests/JIT/Regression/JitBlue/Runtime_105969/Runtime_105969.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System; | ||
| using System.Runtime.CompilerServices; | ||
| using System.Numerics; | ||
| using System.Runtime.Intrinsics; | ||
| using System.Runtime.Intrinsics.X86; | ||
| using Xunit; | ||
|
|
||
| // Generated by Fuzzlyn v2.2 on 2024-08-04 15:50:11 | ||
| // Run on X64 Linux | ||
| // Seed: 9513455124659677293-vectort,vector128,vector256,vector512,x86aes,x86avx,x86avx2,x86avx512bw,x86avx512bwvl,x86avx512cd,x86avx512cdvl,x86avx512dq,x86avx512dqvl,x86avx512f,x86avx512fvl,x86avx512fx64,x86avx512vbmi,x86avx512vbmivl,x86bmi1,x86bmi1x64,x86bmi2,x86bmi2x64,x86fma,x86lzcnt,x86lzcntx64,x86pclmulqdq,x86popcnt,x86popcntx64,x86sse,x86ssex64,x86sse2,x86sse2x64,x86sse3,x86sse41,x86sse41x64,x86sse42,x86sse42x64,x86ssse3,x86x86base | ||
| // Reduced from 26.0 KiB to 1.1 KiB in 00:00:56 | ||
| // Debug: Outputs <0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0> | ||
| // Release: Outputs <0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0> | ||
|
|
||
| public class Runtime_105969 | ||
| { | ||
| public static byte s_5; | ||
|
|
||
| [Fact] | ||
| public static void TestEntryPoint() | ||
| { | ||
| if (Avx512BW.IsSupported) | ||
| { | ||
| var vr16 = Vector512.CreateScalar(s_5); | ||
| var vr17 = Vector512.Create<byte>(1); | ||
| var vr18 = (byte)0; | ||
| var vr19 = Vector512.CreateScalar(vr18); | ||
| var vr20 = Vector128.Create<byte>(0); | ||
| var vr21 = Avx512BW.BroadcastScalarToVector512(vr20); | ||
| var vr22 = Vector256.Create<byte>(1); | ||
| var vr23 = Avx512F.InsertVector256(vr21, vr22, 0); | ||
| var vr24 = Vector512.Create(249, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0); | ||
| var vr25 = Avx512BW.BlendVariable(vr19, vr23, vr24); | ||
| var vr26 = Avx512BW.Min(vr17, vr25); | ||
| Vector512<byte> vr27 = Avx512BW.UnpackLow(vr16, vr26); | ||
| Vector512<byte> expected = Vector512.Create(0, (byte)1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); | ||
| Assert.Equal(expected, vr27); | ||
| } | ||
| } | ||
| } |
8 changes: 8 additions & 0 deletions
8
src/tests/JIT/Regression/JitBlue/Runtime_105969/Runtime_105969.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
| <PropertyGroup> | ||
| <Optimize>True</Optimize> | ||
| </PropertyGroup> | ||
| <ItemGroup> | ||
| <Compile Include="$(MSBuildProjectName).cs" /> | ||
| </ItemGroup> | ||
| </Project> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
This will fix the issue, but I'm not sure its entirely the "right" fix (and may miss some other similar cases).
We have a few instructions (namely those listed here: https://github.com/dotnet/runtime/blob/main/src/coreclr/jit/instr.cpp#L110) where they effectively operate "bitwise" without masking but which need to consider the actual operand size when masking (or broadcast, if supported) is used.
So we probably need to ensure all of these are handled and are picking the "right" operand size (generally 4 when the input is of a "small type").
In the particular case of
Insert/ExtractVector256we should probably be usingvinserti32x8instead ofvinserti64x4for the small types and forint/uint. Those are technicallyAVX512DQ, but the JIT relies on all ofF+BW+CD+DQ+VLbeing available together, so it should be fine to just adjust them inhwintrinsiclistxarch.hand get the "better" codegen. Some of the other intrinsics that need special handling may be in the same boat.-- Alternatively we could just explicitly lower cases like
NI_AVX512F_InsertVector256to beNI_AVX512DQ_InsertVector256and change the base type toint/uintforbyte/ubyte,short/ushort, andint/uint. We could similarly lower cases likeNI_AVX512F_Andto normalize the base type toint/uint, which would likely also fix the issueThere 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.
Thanks for the inputs,
At a quick glance on the instructions on the list,
and/andn/or/xor/insert/extractmay hit the same bug,movudqx/round/broadcastdoes not have EmbMask support yet. Do we consider fix them all? or leave those unsupported instructions for now (those instructions intrinsically have the support for embedded masking).I would try to use the first option, as this is how those logical instructions (And/Or/AndN/Xor) are designed as well and based on how Avx512 ISA family is being checked, it should safe to use DQ instructions. These might still need to be handled together during lowering to normalize the base data type to
int/uintunless it is a long type. (did some extensive testing,Andwith base type to be byte will have the same bug.)