-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Adding the vector constants property extensions that are only supported for certain T #117975
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
Conversation
src/coreclr/System.Private.CoreLib/CompatibilitySuppressions.xml
Outdated
Show resolved
Hide resolved
If you don't mind me asking, for my education: |
The JIT work isn't strictly required and in most cases you'll get the expected codegen. However, there is still some impact to JIT throughput and general inlining budget which can be optimized by special-casing these "core helpers". So rather than having to go through the Since these types are "perf critical" and the logic to support them in the JIT is relatively trivial, we do so to ensure it provides that minimally better experience. |
Thanks for the explanation 👍🏼, very much appreciated. |
src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector64.cs
Outdated
Show resolved
Hide resolved
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.
Pull Request Overview
This PR adds vector constant property extensions that are only available for certain element types (T
). These extensions provide convenient access to common mathematical and special values like One
, Zero
, NaN
, Pi
, E
, Tau
, NegativeZero
, NegativeInfinity
, etc. as vector constants with all lanes populated with the same value.
Key changes:
- Adds extension properties for
Vector64<T>
,Vector128<T>
,Vector256<T>
,Vector512<T>
, andVector<T>
types - Properties are constrained by generic constraints (e.g.,
IFloatingPointConstants<T>
,IFloatingPointIeee754<T>
,ISignedNumber<T>
) - Updates test files to use the new properties instead of
Vector.Create()
calls
Reviewed Changes
Copilot reviewed 55 out of 57 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
src/libraries/System.Runtime.Intrinsics/ref/System.Runtime.Intrinsics.cs |
Adds API surface definitions for the new extension properties |
src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector*.cs |
Implements the extension properties for all vector types |
src/coreclr/jit/hwintrinsic*.cpp |
Adds JIT intrinsic handling for the new properties |
src/coreclr/jit/hwintrinsiclist*.h |
Registers the new intrinsic identifiers |
Various test files | Updates existing tests to use new property syntax instead of Vector.Create() |
src/tests/JIT/HardwareIntrinsics/X86/Regression/GitHub_17073/GitHub_17073_gen.csx
Outdated
Show resolved
Hide resolved
…itHub_17073_gen.csx Co-authored-by: Copilot <[email protected]>
ec37825
to
2400bab
Compare
This resolves #117569