Uh oh!
There was an error while loading. Please reload this page.
Cleanup some of the intrinsic fallback implementations to make it easier to add support for new types - #128454
Conversation
…ier to add support for new types
Tagging subscribers to this area: @dotnet/area-system-runtime-intrinsics |
There was a problem hiding this comment.
Pull request overview
This PR refactors several SIMD intrinsic fallback implementations to centralize scalar type classification (via Scalar<T>) and to de-duplicate Shuffle / ShuffleNative fallback logic across the Vector64/128/256/512 and Vector<T> APIs. It also regenerates the System.Numerics.Vectors ref source.
Changes:
- Introduce
Scalar<T>.IsSupported,IsUnsigned, andIsFloatingPointhelpers and update multiple intrinsic fallbacks to use them. - Consolidate
Shuffle/ShuffleNativefallback implementations via shared generic helpers (per vector width) to reduce duplicated per-type code. - Regenerate
System.Numerics.Vectorsref sources (mostly formatting/alphabetization).
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Scalar.cs | Adds centralized scalar type classification helpers and simplifies some scalar ops to reuse existing helpers. |
| src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector64.cs | Uses Scalar<T> helpers for classification and centralizes Shuffle / ShuffleNative fallback logic. |
| src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector64_1.cs | Switches IsSupported to Scalar<T>.IsSupported. |
| src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector128.cs | Uses Scalar<T> helpers and consolidates Shuffle / ShuffleNative logic through shared helpers. |
| src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector128_1.cs | Switches IsSupported to Scalar<T>.IsSupported. |
| src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector256.cs | Uses Scalar<T> helpers and centralizes Shuffle / ShuffleNative fallback logic. |
| src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector256_1.cs | Switches IsSupported to Scalar<T>.IsSupported. |
| src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector512.cs | Uses Scalar<T> helpers and centralizes Shuffle / ShuffleNative fallback logic. |
| src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector512_1.cs | Switches IsSupported to Scalar<T>.IsSupported. |
| src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/ISimdVector_2.cs | Removes an unused CodeAnalysis using. |
| src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/SimdVectorExtensions.cs | Removes unused usings. |
| src/libraries/System.Private.CoreLib/src/System/Numerics/Vector.cs | Replaces repeated typeof(T) classification checks with Scalar<T> helpers in multiple ops. |
| src/libraries/System.Private.CoreLib/src/System/Numerics/Vector_1.cs | Switches IsSupported to Scalar<T>.IsSupported. |
| src/libraries/System.Numerics.Vectors/ref/System.Numerics.Vectors.cs | Regenerated ref source (primarily type name formatting / ordering). |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2ca3d96 to
4a756b9Comparetannergooding
commented
May 21, 2026
Sometimes copilot suggestions are a space off and it just tries to correct itself after the fact -.- Ended up fixing the indentation manually to be correct. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
93dc44c to
6a7b37fCompare6a7b37f to
eef231eCompareUh oh!
There was an error while loading. Please reload this page.
tannergooding
commented
May 22, 2026
Figured out the mono interpreter failure. Will do a follow up PR to resolve the problem so that |
This adds a couple helpers to the internal
Scalar<T>type making it easier to centralize type classification and simplifies various implementations to use those, making it easier to add new types (charandHalf) in the future.It also simplifies the
Shuffle/ShuffleNativeimplementation to go through a single centralized internal method, ensuring we don't have a bunch of complex logic unnecessarily duplicated and that all types are properly supported. This last part means that it adds the missingnint/nuintshuffle overloads which were approved as part of the general expansion to support those types. The two proposals (shuffle and nint/nuint) went up at similar times and we had done a blanket approval for the latter (across 3 proposals), so it was just missed.The ref assembly sources had also been manually updated on a number of occasions, so this regenerates them (which also alphabetized some of the entries).