-
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
Vectorize LeadingZeroCount & TrailingZeroCount. #98877
Vectorize LeadingZeroCount & TrailingZeroCount. #98877
Conversation
Tagging subscribers to this area: @dotnet/area-system-numerics |
...em.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.LeadingZeroCount.cs
Outdated
Show resolved
Hide resolved
...m.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.TrailingZeroCount.cs
Show resolved
Hide resolved
...m.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.TrailingZeroCount.cs
Outdated
Show resolved
Hide resolved
...m.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.TrailingZeroCount.cs
Outdated
Show resolved
Hide resolved
...m.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.TrailingZeroCount.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.
Thanks.
if (sizeof(T) == 8) return Avx512CD.VL.LeadingZeroCount(x.AsUInt64()).As<ulong, T>(); | ||
} | ||
|
||
Debug.Assert(AdvSimd.IsSupported); |
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.
We want these to be explicit. It makes it work better with the trimmer for other platforms and matches the requirements we have for corelib around using intrinsics (this isn't in corelib, but its still good to follow those practices as its required for special crossgen handling to ever be usable for the assembly).
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.
The rest of TP is like this, as I'd previously addressed feedback around throws. I suggest this be merged as is, and if we want to change the approach, it be done across all operators en mass together.
Using code from #98275 and 1da8d2f. Contributes to #97193.