Vectorized minmax_element: reduce insanity of sign correction - #6450
Merged
Stephan T. Lavavej (StephanTLavavej) merged 2 commits intoSep 16, 2026
Merged
Stephan T. Lavavej (StephanTLavavej) merged 2 commits into
Stephan T. Lavavej (StephanTLavavej) merged 2 commits into
Conversation
Alex Guteniev (AlexGuteniev)
requested a review
from a team
as a code owner
September 14, 2026 06:16
This comment was marked as resolved.
This comment was marked as resolved.
Copilot started reviewing on behalf of
Alex Guteniev (AlexGuteniev)
September 14, 2026 06:17
View session
Stephan T. Lavavej (StephanTLavavej)
approved these changes
Sep 14, 2026
Member
|
Thanks, I really like this simplification! 😻 |
Copilot started reviewing on behalf of
Stephan T. Lavavej (StephanTLavavej)
September 14, 2026 17:51
View session
Member
|
I'm mirroring this to the MSVC-internal repo. Please notify me if any further changes are pushed, otherwise no action is required. |
Stephan T. Lavavej (StephanTLavavej)
merged commit Sep 16, 2026
305d43f
into
microsoft:main
48 checks passed
Member
😻 🪄 💖 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Avoids passing sign as runtime parameter for SSE4.2 and AVX2 vectorized
minmax_element.Originally it has been done to reduce code bloat without any performance loss. SSE4.2 and AVX2 lack some unsigned instructions, so unsigned operations has to be implemented via signed ones. We applied sign correction at runtime, and shared import lib functions for signed and unsigned types.
Now that Neon has unsigned instructions, we have different entry points for signed and unsigned types to avoid runtime branches there We use compile-time sign dispatch there.. AVX-512, if implemented, will also take advantage of having unsigned instructions and will use comile-time dispatch.
This PR unifies
minmax_elementsign dispatch to make it compile-time everywhere.It also renames
_Signto_Is_signedto reduce confusing.Achivements:
_Sorted_ranges