Repository navigation
perf(x86): AVX2+POPCNT fixed-width scanners and pairwise kernels - #62
Merged
Merged
Conversation
📊 Benchmark Comparison Results
➖ 45 benchmarks within noise (click to expand)
Legend: ✅ Faster (>5%) · |
mrecachinas
force-pushed
the
perf/x86-avx2
branch
from
September 23, 2026 02:08
8e2fa1e to
0160f20
Compare
On AVX2-only hosts (no AVX-512 BITALG), fixed-width scans had no specialized scanner. Every record took an indirect byte-kernel call, and inputs under 64 bytes then re-ran SSE4.1/POPCNT feature detection and tail-called the SSE kernel: about 26 uops per 16-byte record (analysis in x86.md). - Fixed-width scanners for 8/16/32/64-byte records. They are unrolled POPCNT record loops with no per-record call, selected for algo native/avx2 when AVX2 and POPCNT are present. first, best and all keep their semantics: lowest index; minimum distance with lowest-index ties and exact-match exit; ascending order. - Pairwise fast paths for the same widths. The list API writes straight into its u64 buffer. - hamming_distance_bytes_avx2 sends inputs under 64 bytes to an inline POPCNT path. It returns the same values as the SSE/native kernels it replaces: the exact distance, or u64::MAX once over max_dist. - Full-distance AVX2 hex accumulates invalid lanes and checks them once after the vector body. Batches drop from 256 to 128 chars to cut register pressure. _with_max is unchanged, so invalid-vs-threshold precedence stays at its existing check points. This host cannot execute x86. The evidence here is static (assembly and uop counts); execution is validated by the Intel SDE CI matrix (hsw/skx/icl), and x86 timings come from the Benchmark PR workflow. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c7edd725-5714-4044-acf4-c9afc6ec8cf8
mrecachinas
force-pushed
the
perf/x86-avx2
branch
from
September 23, 2026 11:59
0160f20 to
ff7696a
Compare
23 tasks
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.
On AVX2-only hosts (no AVX-512), fixed-width scans had no specialized scanner:
This PR adds:
native/avx2when AVX2+POPCNT are present.first/best/allsemantics are unchanged.u64buffer.hamming_distance_bytes_avx2sends inputs under 64 bytes to an inline POPCNT path. It returns the same values as the SSE/native kernels it replaces: the exact distance, oru64::MAXonce overmax_dist._with_maxis unchanged, so invalid-vs-threshold precedence is preserved.x86-emulatedSDE matrix:hswruns these AVX2 paths, andskx/iclrun them as fallbacks.Benchmark PRworkflow comment on this PR.