Skip to content
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

JIT ARM64-SVE: Add Sve.ConditionalExtract* APIs #104150

Merged
merged 13 commits into from
Jul 6, 2024

Conversation

mikabl-arm
Copy link
Contributor

Testing

Regular tests pass successfully. Stress testing highlights two issues. The first one as I believe is already know and decided to be fixed later. It results in a method returning a value as if a mask/predicate register were all false despite that error output show that it's not, e.g.

..........................................                                                                                                                                                                                                                                                                                  
Sve.ConditionalExtractAfterLastActiveElement<Single>(Vector<Single>, Vector<Single>, Vector<Single>): RunBasicScenario_UnsafeRead failed:                                                                                                                                                                                   
 firstOp: (0.5192283, 0.9884118, 0.82198954, 0.9887928)                                                                                                                                                                                                                                                                     
secondOp: (0.8492061, 0.0695965, 0.808431, 0.13326836)                                                                                                                                                                                                                                                                      
 thirdOp: (0.5630198, 0.66229504, 0.9790988, 0.4338469)                                                                                                                                                                                                                                                                     
  result: (0.8492061, 0, 0, 0)                                                                                                                                                                                                                                                                                              
..........................................                                                                                                                                                                                                                                                                                  
System.Exception: One or more scenarios did not complete as expected.                                                                                                                                                                                                                                                       
   at JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractAfterLastActiveElement_float() in /home/mikabl01/dotnet/runtime/artifacts/tests/coreclr/obj/linux.arm64.Checked/Managed/JIT/HardwareIntrinsics/Arm/Sve/Sve_ro/Sve_ro/gen/Sve.ConditionalExtractAfterLastActiveElement.float.cs:line 77                  
   at Program.<<Main>$>g__TestExecutor3475|0_3476(StreamWriter tempLogSw, StreamWriter statsCsvSw, <>c__DisplayClass0_0&) in /home/mikabl01/dotnet/runtime/artifacts/tests/coreclr/obj/linux.arm64.Checked/Managed/JIT/HardwareIntrinsics/HardwareIntrinsics_Arm_ro/generated/XUnitWrapperGenerator/XUnitWrapperGenerator.XU  nitWrapperGenerator/FullRunner.g.cs:line 87163

The second one manifests in a form of a method returning a zeroed vector. It generally looks like the following and appears for all kinds of types and ConditinalExtract* APIs but only for RunBasicScenario_Load tests:

Sve.ConditionalExtractAfterLastActiveElementAndReplicate<SByte>(Vector<SByte>, Vector<SByte>, Vector<SByte>): RunBasicScenario_Load failed:                                                                                                                                                                                 
 firstOp: (62, 10, 95, 125, 108, 92, 8, 12, 62, 43, 77, 48, 65, 39, 95, 116)
secondOp: (83, 22, 34, 122, 111, 34, 25, 103, 44, 98, 37, 4, 13, 85, 93, 12)
 thirdOp: (92, 68, 96, 4, 124, 101, 2, 122, 122, 87, 121, 76, 43, 42, 11, 44)
  result: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
So a one would expect the result to be (92, ... , 92)  here or (83, 22, 34, 122, 111, 34, 25, 103, 44, 98, 37, 4, 13, 85, 93, 12) (same as secondOp) if the predicate bug manifest here. But all zeros are something different.

A one would expect the result to be (92, ... , 92) here or (83, 22, 34, 122, 111, 34, 25, 103, 44, 98, 37, 4, 13, 85, 93, 12) (same as secondOp) if the first issue discussed above manifested here. But all zeros are something different. This behavior can be attributed to the first issue if we consider how it can interfere with RunBasicScenario_Load: if loadMask3 is all false (incorrectly as the effect of the first issue), then both the third arg and the result of ConditionalExtractAfterLastActiveElementAndReplicate would be all zeroes. The same would happen in case all loadMask* s are all false. We would see different results if only either loadMask1 or loadMask2 is all false, but I can't see anything like that in the logs.

Test logs

ConditionalExtract-stress.txt

Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

1 similar comment
Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Jun 28, 2024
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-runtime-intrinsics
See info in area-owners.md if you want to be subscribed.

@mikabl-arm
Copy link
Contributor Author

@kunalspathak @dotnet/arm64-contrib @a74nh

@kunalspathak
Copy link
Member

@TIHan - can you please take a preliminary look?

@kunalspathak
Copy link
Member

Stress testing highlights two issues

Did you already synced with main that contains my changes to handle the caller save registers?

@mikabl-arm
Copy link
Contributor Author

Stress testing highlights two issues

Did you already synced with main that contains my changes to handle the caller save registers?

I'm not sure, could you specify the commit in question so I can check?

@kunalspathak
Copy link
Member

Stress testing highlights two issues

Did you already synced with main that contains my changes to handle the caller save registers?

I'm not sure, could you specify the commit in question so I can check?

#104065. Please sync with main and confirm if the tests still fail.

@mikabl-arm mikabl-arm force-pushed the ConditionalExtract-github branch from 5400b45 to 97c9682 Compare July 1, 2024 13:48
@mikabl-arm
Copy link
Contributor Author

Thank you, @kunalspathak , I can confirm that the tests pass successfully now:

Starting test: /home/mikabl01/dotnet/runtime/artifacts/tests/coreclr/linux.arm64.Checked/Tests/Core_Root/corerun -p System.Reflection.Metadata.MetadataUpdater.IsSupported=false -p System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization=true ./artifacts/tests/coreclr/linux.arm64.Checked/JIT/HardwareIntrinsics/HardwareIntrinsics_Arm_ro/HardwareIntrinsics_Arm_ro.dll ConditionalExtract
===================Running default===================
------------------- {} -------------------
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractAfterLastActiveElement_float() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractAfterLastActiveElement_float_scalar() : 7
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractAfterLastActiveElement_double() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractAfterLastActiveElement_double_scalar() : 7
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractAfterLastActiveElement_sbyte() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractAfterLastActiveElement_sbyte_scalar() : 7
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractAfterLastActiveElement_short() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractAfterLastActiveElement_short_scalar() : 7
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractAfterLastActiveElement_int() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractAfterLastActiveElement_int_scalar() : 7
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractAfterLastActiveElement_long() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractAfterLastActiveElement_long_scalar() : 7
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractAfterLastActiveElement_byte() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractAfterLastActiveElement_byte_scalar() : 7
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractAfterLastActiveElement_ushort() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractAfterLastActiveElement_ushort_scalar() : 7
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractAfterLastActiveElement_uint() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractAfterLastActiveElement_uint_scalar() : 7
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractAfterLastActiveElement_ulong() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractAfterLastActiveElement_ulong_scalar() : 7
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractAfterLastActiveElementAndReplicate_float() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractAfterLastActiveElementAndReplicate_double() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractAfterLastActiveElementAndReplicate_sbyte() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractAfterLastActiveElementAndReplicate_short() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractAfterLastActiveElementAndReplicate_int() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractAfterLastActiveElementAndReplicate_long() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractAfterLastActiveElementAndReplicate_byte() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractAfterLastActiveElementAndReplicate_ushort() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractAfterLastActiveElementAndReplicate_uint() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractAfterLastActiveElementAndReplicate_ulong() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractLastActiveElemen_float() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractLastActiveElement_float_scalar() : 7
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractLastActiveElement_double() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractLastActiveElement_double_scalar() : 7
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractLastActiveElement_sbyte() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractLastActiveElement_sbyte_scalar() : 7
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractLastActiveElement_short() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractLastActiveElement_short_scalar() : 7
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractLastActiveElement_int() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractLastActiveElement_int_scalar() : 7
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractLastActiveElement_long() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractLastActiveElement_long_scalar() : 7
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractLastActiveElement_byte() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractLastActiveElement_byte_scalar() : 7
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractLastActiveElement_ushort() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractLastActiveElement_ushort_scalar() : 7
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractLastActiveElement_uint() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractLastActiveElement_uint_scalar() : 7
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractLastActiveElement_ulong() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractLastActiveElement_ulong_scalar() : 7
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractLastActiveElementAndReplicate_float() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractLastActiveElementAndReplicate_double() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractLastActiveElementAndReplicate_sbyte() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractLastActiveElementAndReplicate_short() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractLastActiveElementAndReplicate_int() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractLastActiveElementAndReplicate_long() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractLastActiveElementAndReplicate_byte() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractLastActiveElementAndReplicate_ushort() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractLastActiveElementAndReplicate_uint() : 22
Passed test: _Sve_ro::JIT.HardwareIntrinsics.Arm._Sve.Program.Sve_ConditionalExtractLastActiveElementAndReplicate_ulong() : 22
===================Running jitstress===================
------------------- {'JitMinOpts': '1'} -------------------
------------------- {'JitStress': '1'} -------------------
------------------- {'JitStress': '2'} -------------------
------------------- {'JitStress': '1', 'TieredCompilation': '1'} -------------------
------------------- {'JitStress': '2', 'TieredCompilation': '1'} -------------------
------------------- {'TailcallStress': '1'} -------------------
------------------- {'ReadyToRun': '0'} -------------------
===================Running jitstressregs===================
------------------- {'JitStressRegs': '1'} -------------------
------------------- {'JitStressRegs': '2'} -------------------
------------------- {'JitStressRegs': '3'} -------------------
------------------- {'JitStressRegs': '4'} -------------------
------------------- {'JitStressRegs': '8'} -------------------
------------------- {'JitStressRegs': '0x10'} -------------------
------------------- {'JitStressRegs': '0x80'} -------------------
------------------- {'JitStressRegs': '0x1000'} -------------------
------------------- {'JitStressRegs': '0x2000'} -------------------
===================Running jitstress2-jitstressregs===================
------------------- {'JitStress': '2', 'JitStressRegs': '1'} -------------------
------------------- {'JitStress': '2', 'JitStressRegs': '2'} -------------------
------------------- {'JitStress': '2', 'JitStressRegs': '3'} -------------------
------------------- {'JitStress': '2', 'JitStressRegs': '4'} -------------------
------------------- {'JitStress': '2', 'JitStressRegs': '8'} -------------------
------------------- {'JitStress': '2', 'JitStressRegs': '0x10'} -------------------
------------------- {'JitStress': '2', 'JitStressRegs': '0x80'} -------------------
------------------- {'JitStress': '2', 'JitStressRegs': '0x1000'} -------------------
------------------- {'JitStress': '2', 'JitStressRegs': '0x2000'} -------------------


/// <summary>
/// svint16_t svclasta[_s16](svbool_t pg, svint16_t fallback, svint16_t data)
/// CLASTA Ztied.H, Pg, Ztied.H, Zdata.H
Copy link
Member

Choose a reason for hiding this comment

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

This instruction maps to the API that takes Vector<T> for defaultValue parameter. Please remove it from here and at other places.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

src/coreclr/jit/hwintrinsiclistarm64sve.h Outdated Show resolved Hide resolved
src/coreclr/jit/hwintrinsiclistarm64sve.h Outdated Show resolved Hide resolved
src/coreclr/jit/hwintrinsiclistarm64sve.h Outdated Show resolved Hide resolved
{
opt = emitter::optGetSveInsOpt(emitTypeSize(node->GetSimdBaseType()));

if (emitter::isGeneralRegisterOrZR(targetReg))
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't this be an assert instead? assert(emitter::isGeneralRegisterOrZR(targetReg));?

Copy link
Member

Choose a reason for hiding this comment

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

Or are we using the term *Scalar for instructions that are generated for https://docsmirror.github.io/A64/2023-06/clasta_r_p_z.html and https://docsmirror.github.io/A64/2023-06/clasta_v_p_z.html?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

CLASTA (scalar) is emitted only for integer *Scalar APIs. For floating-point *Scalar APIs we have to emit CLASTA (SIMD&FP scalar) instead.

@@ -3914,6 +3917,67 @@
("SveVecReduceUnOpTest.template",new Dictionary<string, string> {["TestName"] = "Sve_ZeroExtendWideningUpper_uint_ushort", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ZeroExtendWideningUpper", ["RetVectorType"] = "Vector", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "UInt16", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt16()", ["ValidateReduceOpResult"] = "Helpers.ZeroExtendWideningUpper(firstOp, 0) != result[0]", ["ValidateRemainingResults"] = "Helpers.ZeroExtendWideningUpper(firstOp, i) != result[i]"}),
("SveVecReduceUnOpTest.template",new Dictionary<string, string> {["TestName"] = "Sve_ZeroExtendWideningUpper_ulong_uint", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ZeroExtendWideningUpper", ["RetVectorType"] = "Vector", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "UInt32", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt32()", ["ValidateReduceOpResult"] = "Helpers.ZeroExtendWideningUpper(firstOp, 0) != result[0]", ["ValidateRemainingResults"] = "Helpers.ZeroExtendWideningUpper(firstOp, i) != result[i]"}),

("SveVecTernOpTest.template",new Dictionary<string, string> {["TestName"] = "Sve_ConditionalExtractAfterLastActiveElement_float", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConditionalExtractAfterLastActiveElement", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "Single", ["Op3VectorType"] = "Vector", ["Op3BaseType"] = "Single", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["NextValueOp2"] = "TestLibrary.Generator.GetSingle()", ["NextValueOp3"] = "TestLibrary.Generator.GetSingle()", ["ValidateIterResult"] = "Helpers.ConditionalExtractAfterLastActiveElement(firstOp, secondOp, thirdOp)[i] != result[i]", ["GetIterResult"] = "Helpers.ConditionalExtractAfterLastActiveElement(first, second, third)[i]", ["ConvertFunc"] = ""}),
Copy link
Member

Choose a reason for hiding this comment

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

Please place these in alphabetical order.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -3914,6 +3917,67 @@
("SveVecReduceUnOpTest.template",new Dictionary<string, string> {["TestName"] = "Sve_ZeroExtendWideningUpper_uint_ushort", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ZeroExtendWideningUpper", ["RetVectorType"] = "Vector", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "UInt16", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt16()", ["ValidateReduceOpResult"] = "Helpers.ZeroExtendWideningUpper(firstOp, 0) != result[0]", ["ValidateRemainingResults"] = "Helpers.ZeroExtendWideningUpper(firstOp, i) != result[i]"}),
("SveVecReduceUnOpTest.template",new Dictionary<string, string> {["TestName"] = "Sve_ZeroExtendWideningUpper_ulong_uint", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ZeroExtendWideningUpper", ["RetVectorType"] = "Vector", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "UInt32", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt32()", ["ValidateReduceOpResult"] = "Helpers.ZeroExtendWideningUpper(firstOp, 0) != result[0]", ["ValidateRemainingResults"] = "Helpers.ZeroExtendWideningUpper(firstOp, i) != result[i]"}),

("SveVecTernOpTest.template",new Dictionary<string, string> {["TestName"] = "Sve_ConditionalExtractAfterLastActiveElement_float", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConditionalExtractAfterLastActiveElement", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "Single", ["Op3VectorType"] = "Vector", ["Op3BaseType"] = "Single", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["NextValueOp2"] = "TestLibrary.Generator.GetSingle()", ["NextValueOp3"] = "TestLibrary.Generator.GetSingle()", ["ValidateIterResult"] = "Helpers.ConditionalExtractAfterLastActiveElement(firstOp, secondOp, thirdOp)[i] != result[i]", ["GetIterResult"] = "Helpers.ConditionalExtractAfterLastActiveElement(first, second, third)[i]", ["ConvertFunc"] = ""}),
("SveScalarTernOpTest.template",new Dictionary<string, string> {["TestName"] = "Sve_ConditionalExtractAfterLastActiveElement_float_scalar", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConditionalExtractAfterLastActiveElement", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Single", ["Op2BaseType"] = "Single", ["Op3VectorType"] = "Vector", ["Op3BaseType"] = "Single", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["NextValueOp2"] = "TestLibrary.Generator.GetSingle()", ["NextValueOp3"] = "TestLibrary.Generator.GetSingle()", ["ValidateScalarResult"] = "Helpers.ConditionalExtractAfterLastActiveElement(firstOp, secondOp, thirdOp) != result"}),
("SveVecTernOpTest.template",new Dictionary<string, string> {["TestName"] = "Sve_ConditionalExtractAfterLastActiveElement_double", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConditionalExtractAfterLastActiveElement", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Double", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Double", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "Double", ["Op3VectorType"] = "Vector", ["Op3BaseType"] = "Double", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetDouble()", ["NextValueOp2"] = "TestLibrary.Generator.GetDouble()", ["NextValueOp3"] = "TestLibrary.Generator.GetDouble()", ["ValidateIterResult"] = "Helpers.ConditionalExtractAfterLastActiveElement(firstOp, secondOp, thirdOp)[i] != result[i]", ["GetIterResult"] = "Helpers.ConditionalExtractAfterLastActiveElement(first, second, third)[i]", ["ConvertFunc"] = ""}),
Copy link
Member

Choose a reason for hiding this comment

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

also, it will be good to group the same APIs under test together.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@mikabl-arm mikabl-arm requested a review from kunalspathak July 3, 2024 15:23
@mikabl-arm
Copy link
Contributor Author

Looks like I missed several issues while testing the updated changes locally. Please wait 'till they are resolved before re-reviewing.

Copy link
Member

@kunalspathak kunalspathak left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@kunalspathak
Copy link
Member

Looks like I missed several issues while testing the updated changes locally. Please wait 'till they are resolved before re-reviewing.

Ah just seeing this message. Will reset the approval status.

@kunalspathak kunalspathak self-requested a review July 3, 2024 18:51
@mikabl-arm mikabl-arm force-pushed the ConditionalExtract-github branch from 0b82f53 to b0212ca Compare July 5, 2024 16:12
@mikabl-arm
Copy link
Contributor Author

Updated, the stress testing passes.

NI_Sve_GatherVectorUInt16WithByteOffsetsZeroExtend, NI_Sve_GatherVectorUInt16ZeroExtend,
NI_Sve_GatherVectorUInt32WithByteOffsetsZeroExtend, NI_Sve_GatherVectorUInt32ZeroExtend));
assert(varTypeIsI(addr) || (varTypeIsSIMD(addr) && ((intrinsicId >= NI_Sve_GatherVector) &&
AreContiguous(NI_Sve_GatherPrefetch16Bit, NI_Sve_GatherPrefetch32Bit, NI_Sve_GatherPrefetch64Bit,
Copy link
Member

Choose a reason for hiding this comment

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

This is not needed after #104396. Can you please merge the main and revert this?

@@ -4087,6 +4090,67 @@
("SveVecReduceUnOpTest.template",new Dictionary<string, string> {["TestName"] = "Sve_ZeroExtendWideningUpper_uint_ushort", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ZeroExtendWideningUpper", ["RetVectorType"] = "Vector", ["RetBaseType"] = "UInt32", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "UInt16", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt16()", ["ValidateReduceOpResult"] = "Helpers.ZeroExtendWideningUpper(firstOp, 0) != result[0]", ["ValidateRemainingResults"] = "Helpers.ZeroExtendWideningUpper(firstOp, i) != result[i]"}),
("SveVecReduceUnOpTest.template",new Dictionary<string, string> {["TestName"] = "Sve_ZeroExtendWideningUpper_ulong_uint", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ZeroExtendWideningUpper", ["RetVectorType"] = "Vector", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "UInt32", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetUInt32()", ["ValidateReduceOpResult"] = "Helpers.ZeroExtendWideningUpper(firstOp, 0) != result[0]", ["ValidateRemainingResults"] = "Helpers.ZeroExtendWideningUpper(firstOp, i) != result[i]"}),

("SveVecTernOpTest.template", new Dictionary<string, string> { ["TestName"] = "Sve_ConditionalExtractAfterLastActiveElement_float", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConditionalExtractAfterLastActiveElement", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Single", ["Op2VectorType"] = "Vector", ["Op2BaseType"] = "Single", ["Op3VectorType"] = "Vector", ["Op3BaseType"] = "Single", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["NextValueOp2"] = "TestLibrary.Generator.GetSingle()", ["NextValueOp3"] = "TestLibrary.Generator.GetSingle()", ["ValidateIterResult"] = "Helpers.ConditionalExtractAfterLastActiveElement(firstOp, secondOp, thirdOp)[i] != result[i]",["GetIterResult"] = "Helpers.ConditionalExtractAfterLastActiveElement(first, second, third)[i]", ["ConvertFunc"] = " ",}),
("SveScalarTernOpTest.template", new Dictionary<string, string> { ["TestName"] = "Sve_ConditionalExtractAfterLastActiveElement_float_scalar", ["Isa"] = "Sve", ["LoadIsa"] = "Sve", ["Method"] = "ConditionalExtractAfterLastActiveElement", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Single", ["Op2BaseType"] = "Single", ["Op3VectorType"] = "Vector", ["Op3BaseType"] = "Single", ["LargestVectorSize"] = "64", ["NextValueOp1"] = "TestLibrary.Generator.GetSingle()", ["NextValueOp2"] = "TestLibrary.Generator.GetSingle()", ["NextValueOp3"] = "TestLibrary.Generator.GetSingle()", ["ValidateScalarResult"] = "Helpers.ConditionalExtractAfterLastActiveElement(firstOp, secondOp, thirdOp) != result",}),
Copy link
Member

Choose a reason for hiding this comment

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

please align the lines for the newly added tests.

Copy link
Member

@kunalspathak kunalspathak left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@kunalspathak kunalspathak merged commit 67e1983 into dotnet:main Jul 6, 2024
165 of 167 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Aug 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Runtime.Intrinsics arm-sve Work related to arm64 SVE/SVE2 support community-contribution Indicates that the PR has been added by a community member new-api-needs-documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants