Skip to content

feat(fastlanes): compute kernels for BitPackedV2 - #9751

Closed
mhk197 wants to merge 2 commits into
mk/bitpacked-v2from
mk/bitpacked-v2-kernels
Closed

feat(fastlanes): compute kernels for BitPackedV2#9751
mhk197 wants to merge 2 commits into
mk/bitpacked-v2from
mk/bitpacked-v2-kernels

Conversation

@mhk197

@mhk197 mhk197 commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Stacked on #9750. Ports the BitPacked compute kernels to BitPackedV2 so the new encoding no longer falls back to canonicalisation for slice, take, filter, compare, between, cast and is_constant.

  • compute/: slice (reduce and execute), take, filter, fused compare against a constant, between, streaming predicate, cast (nullability-only reduce and widening execute), is_constant.
  • vtable: reduce_parent rules for slice and cast, kernel registration in initialize, and the is_constant aggregate kernel.
  • unpack_iter gains back the chunk-walking helpers only the kernels use (for_each_packed_chunk, for_each_unpacked_chunk, decode_map_into) and bitpack_decompress the mapped unpack used by cast.

Each kernel is the v1 kernel with the chunk lookup changed to go through the per-chunk width table; after renaming, the non-test kernel code differs from v1 by 2 to 19 lines per file. The fused compare additionally handles zero-width chunks, which v1 could only see as a whole-array degenerate case.

Tests

The v1 kernel tests are carried over, including the fused-compare sweeps that assert the streaming kernel engages rather than falling back, plus the slice tests that go through reduce_parent. The per-chunk behavioural suite from #9750 now exercises the kernels instead of the fallbacks.

Validation

  • cargo nextest run -p vortex-fastlanes (463 tests)
  • cargo clippy -p vortex-fastlanes --all-targets --all-features, cargo +nightly fmt --all

@codspeed-hq

codspeed-hq Bot commented Sep 3, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 14.48%

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 10 improved benchmarks
❌ 60 regressed benchmarks
✅ 2184 untouched benchmarks
⏩ 284 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation slice_tight_loop_vortex[65536] 59.3 µs 121.8 µs -51.32%
Simulation slice_empty_tight_loop_vortex 41.2 µs 71.3 µs -42.26%
Simulation bitwise_and_vortex_buffer[128] 3.9 µs 6.4 µs -39.33%
Simulation bitwise_or_vortex_buffer[128] 3.9 µs 6.4 µs -38.8%
Simulation take_fsl_f16_force_per_index[2048, 10] 361.1 µs 581 µs -37.84%
Simulation take_fsl_f16_force_per_index[1024, 10] 209.4 µs 320.2 µs -34.59%
Simulation bitwise_not_vortex_buffer[128] 4.7 µs 6.8 µs -31.27%
Simulation random_i8[0.5] 67.3 µs 96.5 µs -30.29%
Simulation cached_indices_i32[0.01] 36.2 µs 52 µs -30.23%
Simulation take_fsl_f16_force_per_index[512, 10] 134.1 µs 189.1 µs -29.11%
Simulation in_place_nullable[16384] 36.2 µs 50.9 µs -28.89%
Simulation bitand_owned_lhs_vortex_buffer[128] 4.6 µs 6 µs -23.41%
Simulation take_fsl_f16_force_per_index[256, 10] 94.5 µs 122.7 µs -23.03%
Simulation bitand_owned_lhs_vortex_buffer[1024] 4.8 µs 6.2 µs -22.73%
Simulation bitand_owned_lhs_vortex_buffer[2048] 5 µs 6.4 µs -21.89%
Simulation new_raw_prim_test_between[i32, 2048] 61.3 µs 78.1 µs -21.45%
Simulation chunked_constant_i32_append_to_builder[(10, 100)] 62.4 µs 79.2 µs -21.2%
Simulation slice_vortex_buffer 6.6 µs 8.2 µs -19.81%
Simulation bitwise_and_vortex_buffer[1024] 4.2 µs 5.2 µs -18.98%
Simulation bitwise_or_vortex_buffer[2048] 4.6 µs 5.6 µs -17.81%
... ... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing mk/bitpacked-v2-kernels (34bd0f3) with mk/bitpacked-v2 (7de5950)

Open in CodSpeed

Footnotes

  1. 284 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

A new fastlanes.bitpacked_v2 encoding that packs every 1024-element chunk at
its own width. Widths are chosen per chunk from the chunk's histogram using
its exact packed-block cost plus the exceptions left behind, and the
histogram, width choice, exception gathering and packing all happen while
the chunk is in cache. Values that do not fit their chunk's width become
patches, as in BitPacked. Serde carries one width byte per chunk.

This is the array only: encode, decode, scalar_at, validity and serde.
Compute kernels follow in a separate change, so filter, take, compare and
slice fall back to canonicalisation for now. BitPacked is unchanged and
nothing writes v2 yet.

Signed-off-by: Matt Katz <mhkatz97@gmail.com>
Port slice (reduce and execute), take, filter, fused compare, between,
streaming predicate, cast and is_constant to BitPackedV2, indexing each
chunk's packed block through the width table, and register them alongside
the v1 kernels.

Signed-off-by: Matt Katz <mhkatz97@gmail.com>
@mhk197
mhk197 force-pushed the mk/bitpacked-v2-kernels branch from 5124963 to 34bd0f3 Compare September 3, 2026 14:28
@mhk197

mhk197 commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Superseded: the stack now follows the one-array model (one in-memory BitPacked, two wire formats) in #9750, so the kernels are edited in place there instead of ported to a second encoding.

@mhk197 mhk197 closed this Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant