Implement SVE2 Counting APIs#122602
Conversation
* Add `CountMatchingElements` and `CountMatchingElementsIn128BitSegments`. * Fix SveTernOpMaskedOpTestTemplate to handle different return types.
|
Tagging subscribers to this area: @dotnet/area-system-runtime-intrinsics |
Fix HWIntrinsicTests conflicts.
dhartglassMSFT
left a comment
There was a problem hiding this comment.
Looked at the code under jit/*, lgtm
|
@tannergooding Ensuring this is in your PR review queue |
There was a problem hiding this comment.
Pull request overview
Adds the new Arm64 SVE2 “counting” intrinsics proposed in #94017 (CountMatchingElements / CountMatchingElementsIn128BitSegments) and wires them through the JIT intrinsic list and test generation, including updating the masked-ternary test template to support differing (but same-sized) operand/return element types.
Changes:
- Added
Sve2.Arm64.CountMatchingElementsandSve2.Arm64.CountMatchingElementsIn128BitSegmentsoverloads (plus PlatformNotSupported + ref surface area). - Added CoreCLR JIT intrinsic definitions for
HISTCNTandHISTSEG. - Added/updated JIT HWIntrinsic tests and test helpers for the new APIs and for mixed signed/unsigned return types.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/tests/JIT/HardwareIntrinsics/Arm/Shared/_SveTernOpMaskedOpTestTemplate.template | Updates masked ternary op test template to allow differing return type size-equivalence and adjusts mask/false value handling. |
| src/tests/JIT/HardwareIntrinsics/Arm/Shared/Helpers.cs | Adds managed “golden” helper implementations for the new counting intrinsics. |
| src/tests/Common/GenerateHWIntrinsicTests/Arm/Sve2Tests.cs | Registers generated test cases for the new SVE2 counting intrinsics. |
| src/libraries/System.Runtime.Intrinsics/ref/System.Runtime.Intrinsics.cs | Adds the public API surface area for the new SVE2 counting methods. |
| src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sve2.cs | Adds the intrinsic method declarations for supported platforms. |
| src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sve2.PlatformNotSupported.cs | Adds PlatformNotSupported stubs for the new methods. |
| src/coreclr/jit/hwintrinsiclistarm64sve.h | Adds the CoreCLR intrinsic mappings for HISTCNT/HISTSEG. |
src/tests/JIT/HardwareIntrinsics/Arm/Shared/_SveTernOpMaskedOpTestTemplate.template
Show resolved
Hide resolved
src/tests/JIT/HardwareIntrinsics/Arm/Shared/_SveTernOpMaskedOpTestTemplate.template
Show resolved
Hide resolved
|
@tannergooding This PR is ready for your review |
|
/ba-g unrelated http timeout |
Contributes to #94017
Add
CountMatchingElementsandCountMatchingElementsIn128BitSegments.Fix
SveTernOpMaskedOpTestTemplateto handle different return types. It was previously assumingOp1BaseType == RetBaseType, now it is relaxed tosizeof(Op1BaseType) == sizeof(RetBaseType)since their masks/predicates are the same.@dotnet/arm64-contrib @a74nh