-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Arm64/Sve: Implement LoadVector*NonFaultingSignExtendTo* APIs #102903
Conversation
Note regarding the
|
@dotnet/arm64-contrib @TIHan PTAL |
Tagging subscribers to this area: @dotnet/area-system-runtime-intrinsics |
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. Minor comment on the category. Test template works great.
("SveLoadMaskedUnOpTest.template", new Dictionary<string, string> { ["TestName"] = "SveLoadVectorUInt16ZeroExtendToUInt64", ["Isa"] = "Sve", ["Method"] = "LoadVectorUInt16ZeroExtendToUInt64", ["RetVectorType"] = "Vector", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "UInt64", ["Op2BaseType"] = "UInt16", ["LargestVectorSize"] = "64", ["NextValueOp2"] = "TestLibrary.Generator.GetUInt16()", ["ValidateIterResult"] = "firstOp[i] != result[i]"}), | ||
("SveLoadMaskedUnOpTest.template", new Dictionary<string, string> { ["TestName"] = "SveLoadVectorUInt32ZeroExtendToInt64", ["Isa"] = "Sve", ["Method"] = "LoadVectorUInt32ZeroExtendToInt64", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Int64", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Int64", ["Op2BaseType"] = "UInt32", ["LargestVectorSize"] = "64", ["NextValueOp2"] = "TestLibrary.Generator.GetUInt32()", ["ValidateIterResult"] = "firstOp[i] != result[i]"}), | ||
("SveLoadMaskedUnOpTest.template", new Dictionary<string, string> { ["TestName"] = "SveLoadVectorUInt32ZeroExtendToUInt64", ["Isa"] = "Sve", ["Method"] = "LoadVectorUInt32ZeroExtendToUInt64", ["RetVectorType"] = "Vector", ["RetBaseType"] = "UInt64", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "UInt64", ["Op2BaseType"] = "UInt32", ["LargestVectorSize"] = "64", ["NextValueOp2"] = "TestLibrary.Generator.GetUInt32()", ["ValidateIterResult"] = "firstOp[i] != result[i]"}), | ||
("SveLoadMaskedUnOpTest.template", new Dictionary<string, string> { ["TestName"] = "Sve_LoadVector_float", ["Isa"] = "Sve", ["Method"] = "LoadVector", ["RetVectorType"] = "Vector", ["RetBaseType"] = "Single", ["Op1VectorType"] = "Vector", ["Op1BaseType"] = "Single", ["Op2BaseType"] = "Single", ["LargestVectorSize"] = "64", ["NextValueOp2"] = "TestLibrary.Generator.GetSingle()", ["ValidateIterResult"] = "firstOp[i] != result[i]"}), |
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.
What did you change on these lines? Was it just the TestName
?
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.
yes, just to have them consistent naming of Sve_*
// Validates passing an instance member of a struct works | ||
test.RunStructFldScenario(); | ||
|
||
// Validates using inside ConditionalSelect with value falseValue |
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'm surprised we've not hit this before - there are other instructions that are Pg/Z.
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.
All the APIs we have implemented that has Pg/Z
are either the ones that explicitly takes mask
as first argument like LoadVector
for which we don't use it inside ConditionalSelect or the ones that operates on purely predicate registers like EOR Presult.B, Pg/Z, Pop1.B, Pop2.B
which we have not exposed it via API. This is the first API that implicitly has a mask
argument and has Pg/Z
format in the instruction.
|
||
// Validates using inside ConditionalSelect with zero falseValue | ||
test.ConditionalSelect_ZeroOp(); | ||
} |
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.
Maybe not for this PR, but I remember discussion about testing with addresses that fault. Use an address that is invalid/partially invalid, then test an exception is not raised.
Then maybe add the same test to the normal loads and check it does fault.
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.
Yes, @TIHan added that in #102180
runtime/src/tests/JIT/HardwareIntrinsics/Arm/Shared/SveLoad2xVectorAndUnzipTest.template
Lines 190 to 207 in 3750ac5
//TODO-SVE: Once register allocation exists for predicates, move loadMask into DataTable | |
{Op1VectorType}<{Op1BaseType}> loadTrueMask = Sve.CreateTrueMask{RetBaseType}(SveMaskPattern.All); | |
{Op1VectorType}<{Op1BaseType}> loadFalseMask = Sve.CreateFalseMask{RetBaseType}(); | |
var result = {Isa}.{Method}(loadTrueMask, ({Op1BaseType}*)(_dataTable.inArrayPtr)); | |
try | |
{ | |
result = {Isa}.{Method}(loadFalseMask, default); | |
Unsafe.Write(_dataTable.outArray1Ptr, result.Item1); | |
Unsafe.Write(_dataTable.outArray2Ptr, result.Item2); | |
ValidateZeroResult(_dataTable.outArray1Ptr, _dataTable.outArray2Ptr, _dataTable.inArrayPtr); | |
} | |
catch | |
{ | |
Succeeded = false; | |
} |
@@ -0,0 +1,413 @@ | |||
// Licensed to the .NET Foundation under one or more agreements. | |||
// The .NET Foundation licenses this file to you under the MIT license. |
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.
What's special about this template that means it can't use the standard load template?
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.
Having a RunBasicScenario_LoadNonFaulting() test case that will make sure we do not fault even for invalid memory.
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 was looking for a try/catch ... but we don't need to add that.
/ba-g opened #102919 |
All stress tests passing: https://gist.github.com/kunalspathak/355fa828453c9f4fbe76c7d4dbfa0d9a
Contributes to #99957