Skip to content

Enable vectorization of TensorPrimitives.ConvertTruncating for float/double #116895

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

Merged
merged 2 commits into from
Jun 22, 2025

Conversation

stephentoub
Copy link
Member

These were disabled against a PR that has already been merged.

…double

These were disabled against a PR that has already been merged.
Copy link
Contributor

@Copilot Copilot AI left a 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 re-enables vectorization for the ConvertTruncating implementations of float→int, float→uint, double→ulong, and double→long by changing their Vectorizable flags from false to true.

  • Flip Vectorizable from false to true for four conversion operators
  • Removes outdated TODO comments
  • Allows JIT to use SIMD intrinsics for these conversions
Comments suppressed due to low confidence (1)

src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.ConvertTruncating.cs:106

  • Since vectorization is now enabled, add unit tests for the float→int, float→uint, double→ulong, and double→long truncating paths (including edge cases like NaN, ±∞, and out-of-range values) to ensure the SIMD implementation matches the scalar behavior.
            public static bool Vectorizable => true;

Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-numerics-tensors
See info in area-owners.md if you want to be subscribed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants