perf(fastlanes): fuse bit-packed compare into a transposed mask + untranspose#8239
Open
joseph-isaacs wants to merge 8 commits into
Open
perf(fastlanes): fuse bit-packed compare into a transposed mask + untranspose#8239joseph-isaacs wants to merge 8 commits into
joseph-isaacs wants to merge 8 commits into
Conversation
Add `bitpack_compare_sweep`, which exercises the public `array.binary(rhs, op)` compare-against-constant path over all eight integer types and every valid bit width (64Ki in-range elements per case, no patches). It isolates the `<BitPacked as CompareKernel>` unpack + per-element compare kernel so a kernel change shows up as a CodSpeed diff. Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
Merging this PR will not alter performance
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Simulation | chunked_varbinview_canonical_into[(100, 100)] |
269.9 µs | 304.9 µs | -11.47% |
| ❌ | Simulation | baseline_lt[16, 65536] |
216.1 µs | 244.1 µs | -11.44% |
| ⚡ | Simulation | chunked_varbinview_canonical_into[(1000, 10)] |
197.1 µs | 160.7 µs | +22.59% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing claude/confident-hamilton-mZIEo (211903c) with develop (4e6e9ed)
…ranspose Replace the unpack-then-compare streaming kernel for compare-against-constant with the FastLanes fused `unpack_cmp`: compare each value as it is unpacked, accumulating results straight into a transposed 1024-bit mask (`[u64; 16]`, one register-resident word per lane - no `[bool; 1024]`/`[T; 1024]` scratch), then a single SIMD `untranspose_bits` per block rotates the mask into logical row order, copied directly into the output bit buffer. Inline patches are spliced in afterwards; sliced (offset != 0) arrays fall back to the scalar streaming predicate. This requires the in-development FastLanes (PR #141 fused mask + PR #145 width-generic BMI2/VBMI untranspose), pinned via a git patch until released. Benchmarked end-to-end through the public compare path (`bitpack_compare_sweep`, 64Ki elements, all integer types and bit widths): fused beats the streaming baseline for every type and width - i8/u8 ~6.2-7.7x i16/u16 ~4.5-6.0x i32/u32 ~1.9-4.3x i64/u64 ~1.2-1.9x Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
e27f5f4 to
48da899
Compare
Base automatically changed from
claude/confident-hamilton-mZIEo-benches
to
develop
June 4, 2026 10:07
joseph-isaacs
commented
Jun 4, 2026
Comment on lines
+418
to
+419
| [patch.crates-io] | ||
| fastlanes = { git = "https://github.com/spiraldb/fastlanes", rev = "6c10ea72cf693a17e994aa6401604ebedbeda453" } |
Contributor
Author
There was a problem hiding this comment.
We will remove this before we merge this PR
…space wasm-test is excluded from the workspace, so it does not inherit the root [patch.crates-io] and was building vortex-fastlanes against published fastlanes 0.5.0 (old `[bool;1024]` unpack_cmp, no `untranspose_bits`) -> compile error in compare_fused.rs. Add the matching git `rev` pin here. Temporary, like the root pin: both are removed when a FastLanes release is cut and the version is bumped. Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
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.
Summary
Stacked on #8238 (the benchmark) so the change lands as a CodSpeed diff.
Replaces the unpack-then-compare streaming kernel for compare-against-constant with the FastLanes fused
unpack_cmp:[u64; 16], one register-resident word per lane — no[bool; 1024]/[T; 1024]scratch),untranspose_bitsper block rotates the mask into logical row order, copied directly into the output bit buffer,offset != 0) arrays fall back to the scalar streaming predicate.