-
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: Implement SVE APIs #99957
Comments
Recommendation for how to implement. API
Copy/paste contents from files in https://github.com/a74nh/runtime/tree/api_github/sve_api/out_cs_api/ . There should be no need to edit these changes. Keep alphabetical ordering. The same files have been given additional annotation and can be found in https://github.com/a74nh/runtime/tree/api_github/sve_api/out_helper_api . These are for development use only and are not for commiting. HW Intrinsics
Copy/paste from https://github.com/a74nh/runtime/blob/api_github/sve_api/out_hwintrinsiclistarm64sve.h
For any special case where there is no flag, you have options:
Testing
Copy/paste from https://raw.githubusercontent.com/a74nh/runtime/api_github/sve_api/out_GenerateHWIntrinsicTests_Arm.cs LinuxTests can be build using:
Tests can then be run:
Generated C# files are in There are a lot of tests that will be run. To make life easier run the .dll directly and pass it the name of the test (a substring will do). Eg:
WindowsTests can be build using:
Tests can then be run:
Generated C# files are in There are a lot of tests that will be run. To make life easier run the .dll directly and pass it the name of the test (a substring will do). Eg:
AltjitAll the testing works as usual using Stress testingAll the tests should be run using all the various stress modes.
Writing Tests
|
For choosing APIs.
|
As the testing grows it will increasingly become difficult to test just a single API. this is ok during CI, but painful during development and bug fixing. I recommend someone writes a patch so that a testname can be passed in as an argument so that only that test will run. Eg: |
I have not looked at this yet, but can this week. |
Just noting such support should already exist if you invoke the underlying The exact argument that matches a filter may be a bit different due to it now using the underlying You can then see some of the logic that gets setup via https://github.com/dotnet/runtime/blob/main/src/tests/Common/XUnitWrapperGenerator/XUnitWrapperGenerator.cs and the corresponding logic of how the test filtering works here: https://github.com/dotnet/runtime/blob/main/src/tests/Common/XUnitWrapperLibrary/TestFilter.cs The actual filter is constructed like: System.Collections.Generic.Dictionary<string, string> testExclusionTable = XUnitWrapperLibrary.TestFilter.LoadTestExclusionTable();
XUnitWrapperLibrary.TestFilter filter = new (args, testExclusionTable); A given void TestExecutor1(System.IO.StreamWriter tempLogSw, System.IO.StreamWriter statsCsvSw)
{
if (filter is null || filter.ShouldRunTest(@"JIT.HardwareIntrinsics.Arm._AdvSimd.Program.AddDouble", "_AdvSimd_r::JIT.HardwareIntrinsics.Arm._AdvSimd.Program.AddDouble()"))
{
System.TimeSpan testStart = stopwatch.Elapsed;
try
{
summary.ReportStartingTest("_AdvSimd_r::JIT.HardwareIntrinsics.Arm._AdvSimd.Program.AddDouble()", System.Console.Out);
outputRecorder.ResetTestOutput();
_AdvSimd_r::JIT.HardwareIntrinsics.Arm._AdvSimd.Program.AddDouble();
summary.ReportPassedTest("_AdvSimd_r::JIT.HardwareIntrinsics.Arm._AdvSimd.Program.AddDouble()", "JIT.HardwareIntrinsics.Arm._AdvSimd.Program", @"AddDouble", stopwatch.Elapsed - testStart, outputRecorder.GetTestOutput(), System.Console.Out, tempLogSw, statsCsvSw);
}
catch (System.Exception ex)
{
summary.ReportFailedTest("_AdvSimd_r::JIT.HardwareIntrinsics.Arm._AdvSimd.Program.AddDouble()", "JIT.HardwareIntrinsics.Arm._AdvSimd.Program", @"AddDouble", stopwatch.Elapsed - testStart, ex, outputRecorder.GetTestOutput(), System.Console.Out, tempLogSw, statsCsvSw);
}
}
else
{
string reason = filter.GetTestExclusionReason("_AdvSimd_r::JIT.HardwareIntrinsics.Arm._AdvSimd.Program.AddDouble()");
summary.ReportSkippedTest("_AdvSimd_r::JIT.HardwareIntrinsics.Arm._AdvSimd.Program.AddDouble()", "JIT.HardwareIntrinsics.Arm._AdvSimd.Program", @"AddDouble", System.TimeSpan.Zero, reason, tempLogSw, statsCsvSw);
}
} where |
If that's the case, can you or @TIHan can come up with the exact command line that is needed to run a particular case. I don't want engineer to hack around a test to make it working for every API. |
It appears to work:
I'm happy with this as a solution then! |
Updated the implementation instructions with stress testing and how to write the tests. |
Updated for Windows. |
Closing this as completed. Will open a new issue for items that will be included in .NET 10. |
Now that all the SVE instructions encoding is completed in #94549, it is time to expose these instructions through .NET APIs. Here is the list of categorized APIs with links to the issue where they were approved.
.NET 9 Goal: We aim to complete SVE APIs in .NET 9. SVE2 APIs will be pushed out to .NET 10.
SVE APIs
High Priority SVE APIs
Sve mask (Complete)
Full list
CreateBreak*
APIs #104184 (Future work) Add optimization for CndSelCreateBreak*
APIs #104184 (Future work) Add optimization for CndSelCreateBreak*
APIs #104184 (Future work) Add optimization for CndSelCreateBreak*
APIs #104184 (Future work) Add optimization for CndSelCreateMaskForFirstActiveElement
andCreateMaskForNextActiveElement
#104002CreateMaskForFirstActiveElement
andCreateMaskForNextActiveElement
#104002ExtractLastVector
,ExtractLastScalar
,ExtractAfterLastVector
,ExtractAfterLastScalar
#103847ExtractLastVector
,ExtractLastScalar
,ExtractAfterLastVector
,ExtractAfterLastScalar
#103847ExtractLastVector
,ExtractLastScalar
,ExtractAfterLastVector
,ExtractAfterLastScalar
#103847ExtractLastVector
,ExtractLastScalar
,ExtractAfterLastVector
,ExtractAfterLastScalar
#103847Test*
,ExtractVector
#103739Test*
,ExtractVector
#103739Test*
,ExtractVector
#103739Test*
,ExtractVector
#103739Sve bitwise (Complete)
Full list
ShiftLeftLogical
,ShiftRightArithmetic
,ShiftRightLogical
#104119ShiftLeftLogical
,ShiftRightArithmetic
,ShiftRightLogical
#104119ShiftLeftLogical
,ShiftRightArithmetic
,ShiftRightLogical
#104119Sve bitmanipulate (Complete)
Full list
Sve loads (Complete)
Full list
Sve.LoadVectorNonTemporal/NonFaulting/128AndReplicateToVector
APIs #103392Sve.LoadVectorNonTemporal/NonFaulting/128AndReplicateToVector
APIs #103392Sve.LoadVectorNonTemporal/NonFaulting/128AndReplicateToVector
APIs #103392Load2xVectorAndUnzip
,Load3xVectorAndUnzip
,Load4xVectorAndUnzip
APIs #102180Load2xVectorAndUnzip
,Load3xVectorAndUnzip
,Load4xVectorAndUnzip
APIs #102180Load2xVectorAndUnzip
,Load3xVectorAndUnzip
,Load4xVectorAndUnzip
APIs #102180Prefetch*
APIs. #103094Prefetch*
APIs. #103094Prefetch*
APIs. #103094Prefetch*
APIs. #103094Sve stores (Complete)
Full list
Sve maths (Complete)
Full list
Sve counting (Complete)
Full list
Low Priority SVE APIs
Sve scatterstores (Complete)
Full list
Sve gatherloads (Complete)
Full list
Sve fp (Complete)
Full list
AddRotateComplex
,MultiplyAddRotateComplex
#104926AddSequentialAcross
#104640ConvertToSingle
,ConvertToDouble
; fixCovertTo*
tests #104478ConvertToInt32
andConvertToUInt32
for float #103098ConvertToint64
andConvertToUInt64
#104069ConvertToSingle
,ConvertToDouble
; fixCovertTo*
tests #104478ConvertToInt32
andConvertToUInt32
for float #103098ConvertToint64
andConvertToUInt64
#104069FloatingPointExponentialAccelerator
#104649AddRotateComplex
,MultiplyAddRotateComplex
#104926MultiplyAddRotateComplexBySelectedScalar
#105002ReciprocalEstimate
,ReciprocalExponent
,ReciprocalSqrtEstimate
,ReciprocalSqrtStep
, andReciprocalStep
#103673ReciprocalEstimate
,ReciprocalExponent
,ReciprocalSqrtEstimate
,ReciprocalSqrtStep
, andReciprocalStep
#103673ReciprocalEstimate
,ReciprocalExponent
,ReciprocalSqrtEstimate
,ReciprocalSqrtStep
, andReciprocalStep
#103673ReciprocalEstimate
,ReciprocalExponent
,ReciprocalSqrtEstimate
,ReciprocalSqrtStep
, andReciprocalStep
#103673ReciprocalEstimate
,ReciprocalExponent
,ReciprocalSqrtEstimate
,ReciprocalSqrtStep
, andReciprocalStep
#103673RoundAwayFromZero
,RoundToNearest
,RouteToNegativeInfininty
,RoundToPositiveInfinity
,RoundToZero
#103588RoundAwayFromZero
,RoundToNearest
,RouteToNegativeInfininty
,RoundToPositiveInfinity
,RoundToZero
#103588RoundAwayFromZero
,RoundToNearest
,RouteToNegativeInfininty
,RoundToPositiveInfinity
,RoundToZero
#103588RoundAwayFromZero
,RoundToNearest
,RouteToNegativeInfininty
,RoundToPositiveInfinity
,RoundToZero
#103588RoundAwayFromZero
,RoundToNearest
,RouteToNegativeInfininty
,RoundToPositiveInfinity
,RoundToZero
#103588Scale
andSqrt
#103663Scale
andSqrt
#103663TrigonometricMultiplyAddCoefficient
#104697TrigonometricSelectCoefficient
,TrigonometricStartingValue
#104681TrigonometricSelectCoefficient
,TrigonometricStartingValue
#104681Sve firstfaulting (Complete)
Full list
GetFfr
,SetFfr
,LoadVectorFirstFaulting
,GatherVectorFirstFaulting
#104502GatherVectorWithByteOffsetFirstFaulting
#106199GetFfr
,SetFfr
,LoadVectorFirstFaulting
,GatherVectorFirstFaulting
#104502GetFfr
,SetFfr
,LoadVectorFirstFaulting
,GatherVectorFirstFaulting
#104502GetFfr
,SetFfr
,LoadVectorFirstFaulting
,GatherVectorFirstFaulting
#104502SVE2 APIs
Full list
Sve2 scatterstores
Sve2 maths
Sve2 mask
Sve2 gatherloads
Sve2 fp
Sve2 counting
Sve2 bitwise
Sve2 bitmanipulate
SveBf16
SveF32mm
SveF64mm
SveFp16
SveI8mm
Sha3
Sm4
SveAes
SveBitperm
SveSha3
SveSm4
Credits to @a74nh for populating the list and also some files in https://github.com/a74nh/runtime/tree/api_github/sve_api that will help to implement them.
Contributes to #93095
The text was updated successfully, but these errors were encountered: