Repository navigation
Improved code generation for mixed-size Index/Data gather (issue #69) - #76
Open
danieltowner wants to merge 2 commits into
Open
danieltowner wants to merge 2 commits into
danieltowner wants to merge 2 commits into
Conversation
omalyshe
reviewed
Nov 20, 2026
There was a problem hiding this comment.
🟡 Changes recommended
Regression coverage is missing for oversized tables with narrow index types and for unsigned 32- and 64-bit indexes, leaving new bounds-checking and hardware-index selection paths untested.
2 open issues
What changed in this PR
This PR improves x86 SIMD gather code generation for mixed-width indexes and data, avoiding unnecessary conversions and factoring hardware gather operations into a reusable helper.
Changes:
- Selects AVX2 and AVX-512 gather instructions based on index and element widths.
- Updates bounds checking and adds mixed-width regression coverage.
- Adds performance scenarios and baselines for both mixed-width combinations.
| File | Description |
|---|---|
test/TestSimdGatherScatter.cpp |
Adds mixed-width gather and bounds-check regression tests. |
test/performance/scenarios/gather_u64_i32.cpp |
Measures 64-bit data gathers with 32-bit indexes. |
test/performance/scenarios/gather_u32_i64.cpp |
Measures 32-bit data gathers with 64-bit indexes. |
test/performance/baselines.json |
Records baselines for the new performance scenarios. |
include/xvec/x86/x86_impl.hpp |
Extracts the hardware gather helper and supports mixed widths with revised bounds checking. |
Review effort: Balanced
danieltowner
force-pushed
the
issue_69
branch
2 times, most recently
from
November 21, 2026 17:34
4366b6e to
61210e4
Compare
Previously gather would canonicalise the indexes and data-elements to be the same size which would result in a size promotion before the gather or a truncation after. However, AVX-512 allows them to be different sizes so the new code handles different sizes. The avx512 gather code has also been factored out into its own function to make it easier to reuse for 128-bit elements in the future.
danieltowner
force-pushed
the
issue_69
branch
from
November 21, 2026 17:35
61210e4 to
e078434
Compare
Add copyright notice to gather_u64_i32 scenario, and add tests for unsigned-index masked gathers and ranges exceeding the index type maximum. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This branch has not been deployed
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.

Previously gather would canonicalise the indexes and data-elements to be the same size which would result in a size promotion before the gather or a truncation after. However, AVX-512 allows them to be different sizes so the new code handles different sizes. The avx512 gather code has also been factored out into its own function to make it easier to reuse for 128-bit elements in the future.