-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Removing the legacy helper intrinsics and adding tests for their replacements #20994
Conversation
So, this PR just tests the software fallback, and you will make the JIT implementation in another PR, right? |
Exactly right. |
@@ -79,7 +79,7 @@ unsafe static int Main() | |||
|
|||
if (Sse41.IsSupported) | |||
{ | |||
Vector128<float> rgb = Sse.SetVector128(0, 1, 2, 3); | |||
Vector128<float> rgb = Vector128.Create(3f, 2f, 1f, 0f); |
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.
The Create
methods take args from lowest index to highest index; which is opposite what SetVector
did
var _Xs = SetHighLow(m1, m0); | ||
var _ys = SetHighLow(m3, m2); | ||
var _Zs = SetHighLow(m5, m4); | ||
var _Xs = Vector256.Create(m0, m1); |
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.
Same with Create
vs SetHighLow
, it takes lower then upper; rather than upper then lower
Still TODO for the tests:
|
@CarolEidt, @fiigii. This should provide templated test coverage for all the new helper APIs. As with most of these HWIntrinsic test PRs, I recommend only viewing the product changes, the new templates, and the changes to the GenerateTests.csx file. The actual tests, being generated from templates, are all the same and have been contained to the final commit (and represent the bulk, 45k lines, of the changes). |
Also CC. @eerhardt, who was helped reviews these in the past |
tests/src/JIT/HardwareIntrinsics/General/Vector128/Create.Byte.cs
Outdated
Show resolved
Hide resolved
tests/src/JIT/HardwareIntrinsics/General/Shared/VectorGetAndWithElementTest.template
Show resolved
Hide resolved
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 second @fiigii's suggestion to add testing for exceptional cases, and have a question and another comment. Otherwise, LGTM, though I confess I got a little cross-eyed reading through all this ;-)
tests/src/JIT/HardwareIntrinsics/General/Shared/VectorAsTest.template
Outdated
Show resolved
Hide resolved
Also ensured we had scenarios for all methods in the
|
Something broken in ARM64 (CC. @CarolEidt):
Noting that the current code is just doing the following and I'm working on getting a JIT Dump public Vector128<T> ToVector128()
{
ThrowIfUnsupportedType();
Vector128<T>.ThrowIfUnsupportedType();
Vector128<T> result = Vector128<T>.Zero;
Unsafe.As<Vector128<T>, Vector64<T>>(ref result) = this;
return result;
} |
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, thanks!
I guess this failure is unrelated to this PR, so we can track it in another issue. |
I'm not seeing this same failure in recent runs - they are either infrastructure failures or they pass. We should figure out why this is only failing on this with this PR. |
Yes, let's take a look at the JIT dump at first. |
Because the relevant code wasn't being compiled by the JIT before this PR (no tests/etc covered this code).
|
JitDump is here: JitDump.txt I'm only able to get the issue to repro on Checked Arm/Arm64 (both Linux and Windows, including the AltJit). It only repros with TieredCompilation disabled. |
The minimal repro I have gotten so far is: public static void Main(string[] args)
{
Vector128<double> x = default(Vector64<double>).ToVector128();
} Where public Vector128<T> ToVector128()
{
Vector128<T> result = Vector128<T>.Zero;
Unsafe.As<Vector128<T>, Vector64<T>>(ref result) = this;
return result;
} It only occurs for Here is another, slightly smaller JIT Dump, with the throw helpers removed: |
Also worth noting is that this appears to be an issue with the return value of the Changing the code to the following removes the assert: public Vector128<T> ToVector128()
{
Vector128<T> result = Vector128<T>.Zero;
ref Vector64<T> temp = ref Unsafe.As<Vector128<T>, Vector64<T>>(ref result);
temp = this;
return result;
} |
(rebased the code, no other changes) |
AFAICT from the dump, it seems that things are going wrong in the morphing of the assignment to the lower 8 bytes of |
So, given that this is an arm64-only issue, and that it's only in the new tests, I guess the right thing to do is to exclude them for arm64 and open an issue to track fixing it. |
Just to clarify, it occurs on both ARM and ARM64 and for the |
@jashook, what is the current "correct" way to exclude a particular test on ARM/ARM64? We seem to have a few files (including |
Changed just |
Hmm, that doesn't appear to work either |
Issues.targets should be correct. I can’t take a look atm but when I’m back near a machine I can help out. Prolly a 2 hr eta. |
I seem to have figured it out, even though the include has a To cover both:
and you instead have to list out the folder that contains the test files directly. |
…acements (dotnet/coreclr#20994) * Removing helper intrinsics from the x86 APIs in S.P.Corelib * Removing JIT support for the removed x86 helper intrinsics * Removing the x86 HardwareIntrinsics tests for the removed helper APIs * Fixing up existing usages to no longer use the removed x86 helper intrinsics * Skip CoreFX tests dependent on the removed x86 helper intrinsics * Adding a GenerateTests.csx and templates for the new shared helper intrinsics * Generating the new shared helper intrinsics from their templates * Disabling some tests for arm and arm64 that are failing due to an assert Commit migrated from dotnet/coreclr@29f8190
CC. @CarolEidt, @fiigii
All the new tests are templated and should also be running on ARM (given the software fallback).
I will address the JIT hookups in a follow-up PR, given the size of the PR already.