Repository navigation
Conversation
Signed-off-by: Matt Katz <mhkatz97@gmail.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.
Tracking Issue: #10167
Stacked on #10245; this PR targets
mk/bitpacked-v2-scheme.Summary
Slicing a
BitPackedarray whose blocks have their own bit widths now runs as a kernel instead of decoding the whole array first. The result is still a blockedBitPackedarray, holding only the blocks the slice overlaps.Block offsets are relative to the first one, so slicing keeps the overlapped blocks' boundaries as they are and cuts the packed buffer between the first and last of them. For example, rows 1500..4100 of an array with block offsets
[b0, b1, b2, b3, b4, b5]keep blocks 1 to 4:[b1, b2, b3, b4, b5], a zero-copy slice of the child;b1 - b0..b5 - b0, a zero-copy slice;Only
b0,b1andb5are read, withexecute_scalar, so this is aSliceKernellike FastLanes RLE's, whose chunk offsets are also relative to the first.SliceReducestill declines blocked arrays, since it never reads buffers, andslicestays lazy until execution. Release builds don't validate boundaries on construction, so the kernel checks the three it reads against the packed length before slicing. Patches and validity are sliced as for a global width.Benchmarks
Local divan benchmark, not committed: slice 1500 rows into 128Ki
u32values with block widths cycling 1 to 16 bits, then canonicalize. Apple M5 Max, median.unblocked_kernel(global width 16)blocked_decode(no kernel)blocked_kernel(this PR)The kernel is 5.6–10.7x faster than decoding first at 1Ki and 16Ki rows, and within 1.3x of a single width from 16Ki rows. The slice alone takes 250 ns, against 125 ns for a single width. Most of the remaining gap at 1Ki rows is the blocked decoder's fixed cost of executing and validating the block offsets.
Testing
Checks
cargo nextest run -p vortex-fastlanes(676 passed)cargo clippy -p vortex-fastlanes --all-targets --all-features -- -D warningsrustfmt +nightly-2026-09-10on the changed file