-
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
Add lots more TensorPrimitives operations #97192
Conversation
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, 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: @dotnet/area-system-numerics Issue DetailsAll are functional and tested, some are vectorized, others still need to be (subsequent to this PR). Fixes #96451 (still needs final API review)
|
@tannergooding, in addition to normal review stuff, I'd appreciate it if you could triple-check:
|
src/libraries/System.Numerics.Tensors/ref/System.Numerics.Tensors.netcore.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Numerics.Tensors/ref/System.Numerics.Tensors.netcore.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Numerics.Tensors/ref/System.Numerics.Tensors.netcore.cs
Show resolved
Hide resolved
src/libraries/System.Numerics.Tensors/ref/System.Numerics.Tensors.netcore.cs
Show resolved
Hide resolved
src/libraries/System.Numerics.Tensors/ref/System.Numerics.Tensors.netcore.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Numerics.Tensors/ref/System.Numerics.Tensors.netcore.cs
Show resolved
Hide resolved
src/libraries/System.Numerics.Tensors/ref/System.Numerics.Tensors.netcore.cs
Show resolved
Hide resolved
src/libraries/System.Numerics.Tensors/ref/System.Numerics.Tensors.netcore.cs
Show resolved
Hide resolved
src/libraries/System.Numerics.Tensors/ref/System.Numerics.Tensors.netcore.cs
Show resolved
Hide resolved
src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.T.cs
Show resolved
Hide resolved
...ries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.netcore.cs
Outdated
Show resolved
Hide resolved
...ries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.netcore.cs
Outdated
Show resolved
Hide resolved
...ries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.netcore.cs
Show resolved
Hide resolved
...ries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.netcore.cs
Outdated
Show resolved
Hide resolved
...ries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.netcore.cs
Outdated
Show resolved
Hide resolved
...ries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.netcore.cs
Show resolved
Hide resolved
...ries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.netcore.cs
Outdated
Show resolved
Hide resolved
007f3c4
to
e2174aa
Compare
// bool useResult = equal && ((IsNegative(result) == IsNegative(current)) ? (resultIndex < currentIndex) : IsNegative(result)); | ||
Vector128<T> resultNegative = IsNegative(result); | ||
Vector128<T> sameSign = Vector128.Equals(resultNegative.AsInt32(), IsNegative(current).AsInt32()).As<int, T>(); | ||
useResult |= equalMask & Vector128.ConditionalSelect(sameSign, lessThanIndexMask, resultNegative); |
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.
nit: These can be ElementwiseSelect
since we know sameSign
is AllBitsSet
or Zero
per-element
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.
Changed. Separately, we can go through and replace all ConditionalSelects to be ElementWiseSelect as long as the mask is known to be AllBitsSet or Zero, in particular if it's the result of some comparison operation like Equal, LessThan, GreaterThan, etc., right?
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.
(Should we expose ElementWiseSelect on the VectorXX types if it's actually beneficial to use?)
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.
(And/or make the JIT recognize some cases where it knows the bit pattern is applicable and do the better thing when possible.)
Failure in the "runtime (Build browser-wasm linux Release LibraryTests_EAT)" leg is |
We're seeing failures in main after this merged, see #97087: Looks like this PR didn't run the legs where this is failing for the Arcade update.
|
* Add more TensorPrimitive operations All are functional and tested, some are vectorized, others still need to be. * Re-fix IndexOfXx operations * Rename MultiplyAddEstimate to FusedMultiplyAdd * Remove some NotSupportedException throws * Simplify CopySignOperator * Parameter renames * Add scalar overloads of Atan2 and Atan2Pi * Add CopySign scalar overload * Add Ieee754Remainder scalar overloads * Add Lerp scalar overloads * Add Pow scalar overload * Consolidate inverted operators * Add missing Max/Min scalar overloads * Use ElementWiseSelect
All are functional and tested, some are vectorized, others still need to be (subsequent to this PR, tracked by #97193).
Fixes #96451 (still needs final API review)
Fixes #94553 (handles the IndexOfXx methods that were missing)
Fixes #97190
Contributes to #93286