-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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] ASIMD DotProduct and Rounding Double Multiply Add/Subtract #38957
[Arm64] ASIMD DotProduct and Rounding Double Multiply Add/Subtract #38957
Conversation
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to 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. |
Tagging subscribers to this area: @tannergooding |
55e7c8b
to
478fef1
Compare
@CarolEidt @tannergooding @TamarChristinaArm This is ready for review, please take a look. |
@@ -28,8 +28,11 @@ enum CORINFO_InstructionSet | |||
InstructionSet_Sha1=8, | |||
InstructionSet_Sha256=9, | |||
InstructionSet_Atomics=10, | |||
InstructionSet_Vector64=11, | |||
InstructionSet_Vector128=12, | |||
InstructionSet_Dp=11, |
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.
Dp_Arm64 should also exist, it isn't covered by #38460
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.
Okay, I will update/rebase this PR after you merge #38460
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.
Done
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 LGTM overall, with one question. It seems that you and @tannergooding will have to coordinate with his #38460 (i.e. one will have to merge)
public static new bool IsSupported { get => IsSupported; } | ||
|
||
[Intrinsic] | ||
public new abstract class Arm64 : AdvSimd.Arm64 |
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 confused why this is here if there are no 64-bit intrinsics in this class.
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 added this as a placeholder and I anticipated to wait till Tanner merges his PR and update thereafter. I believe this is needed to be consistent with #34587.
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.
My understanding that Dp.Arm64.IsSupported needs to return false if Dp.IsSupported is false.
While now Dp.Arm64.IsSupported returns true if AdvSimd.Arm64.IsSupported is true, so we need to treat Dp.Arm64.IsSupported as intrinsic instead of relying on it being inherited from AdvSimd.Arm64.
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.
Dp.Arm64.IsSupported
needs to return true if Dp.IsSupported
and we are in a 64-bit process. It being true
implies Dp.IsSupported
and ArmBase.Arm64.IsSupported
(which each also implies ArmBase.IsSupported
).
Having it recursive here and adding the relevant entry to Arm64VersionOfIsa
should hook it all up correctly (same as was done for Rdm: https://github.com/dotnet/runtime/pull/38957/files#diff-8e07abb3dff9bfe2e051a071c787f18bR27)
It exists because of #34587 (and is the same reason as #38460 was created), which is that we otherwise get into weird scenarios where Dp.Arm64.IsSupported
can return true (because it actually resolves to ArmBase.Arm64.IsSupported
when Dp.IsSupported
returns false.
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.
@CarolEidt Do you have any other questions here?
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.
No, makes sense (sort of!)
@@ -50,8 +50,8 @@ PAL_GetJitCpuCapabilityFlags(CORJIT_FLAGS *flags) | |||
// CPUCompileFlags.Set(CORJIT_FLAGS::CORJIT_FLAG_HAS_ARM64_DCPOP); | |||
#endif | |||
#ifdef HWCAP_ASIMDDP | |||
// if (hwCap & HWCAP_ASIMDDP) | |||
// CPUCompileFlags.Set(CORJIT_FLAGS::CORJIT_FLAG_HAS_ARM64_DP); | |||
if (hwCap & HWCAP_ASIMDDP) |
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.
We should add a tracking issue with the tracking-external-issue
label for when Windows support is in, so we can update the codeman checks for Windows.
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.
Done #39094
…cs in System.Private.CoreLib.Shared.projitems
…lingAndSubtractSaturateHigh in hwintrinsiclistarm64.h
…lingAndSubtractSaturateHigh in GenerateTests.csx
478fef1
to
bc08993
Compare
@@ -140,20 +158,19 @@ bool HWIntrinsicInfo::isFullyImplementedIsa(CORINFO_InstructionSet isa) | |||
case InstructionSet_ArmBase_Arm64: | |||
case InstructionSet_Crc32: | |||
case InstructionSet_Crc32_Arm64: | |||
case InstructionSet_Dp: |
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.
Missing Dp_Arm64?
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.
Fixed
It would be good to update |
It looks that this tests was merged in the wrong place (under src/coreclr/tests/src instead of src/tests) - I will move it and update as you suggested |
@tannergooding Updated the test. Unfortunatelly, it does not do anything in CI now since our machines don't support Dp and Rdm |
That's unfortunate, but possibly something we can address longer term. This scenario will be an issue (in the future) as we start onboarding newer ISAs |
@tannergooding I am going to merge this to unblock the remaining hardware intrinsics work. |
DotProduct
DotProductBySelectedQuadruplet
MultiplyRoundedDoublingAndAddSaturateHigh
MultiplyRoundedDoublingAndAddSaturateHighScalar
MultiplyRoundedDoublingAndSubtractSaturateHigh
MultiplyRoundedDoublingAndSubtractSaturateHighScalar
MultiplyRoundedDoublingBySelectedScalarAndAddSaturateHigh
MultiplyRoundedDoublingBySelectedScalarAndSubtractSaturateHigh
MultiplyRoundedDoublingScalarBySelectedScalarAndAddSaturateHigh
MultiplyRoundedDoublingScalarBySelectedScalarAndSubtractSaturateHigh
Fixes #37169
Fixes #36696
With help from @eiriktsarpalis I collected the test results on an Arm64 device that supports these ISAs - I attached the archive with the files.
Dp_Rdm_Rdm.Arm64.zip