Skip to content

Share the mask word walk in vortex-compute and count float statistics a word per chunk - #10362

Merged
robert3005 merged 1 commit into
developfrom
ji/youthful-pasteur-lqf1oo
Nov 16, 2026
Merged

robert3005 merged 1 commit into
developfrom
ji/youthful-pasteur-lqf1oo

Conversation

@joseph-isaacs

@joseph-isaacs joseph-isaacs commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Several kernels walked a mask one u64 word at a time, and each wrote that walk by hand. This PR moves the fastest version, from the filter kernels, into vortex-compute and uses it in the other kernels. It also makes the float statistics work on chunks of 64 values.

Changes

  • vortex_compute::lane_kernels::mask_words: for_each_mask_word, try_for_each_mask_word and low_bits_mask. The walk reads unaligned_chunks, so the 8-byte aligned body is a plain &[u64] and only the first and last word can be short. A private macro writes the body for the first, full and last words, which keeps the full-word length a constant 64. An iterator form nearly doubled the time of the filter SIMD compress.
  • From<&BitBuffer> for BitBufferView: the walk and the masked map kernels (map_masked_into, try_map_masked_into, try_map_masked_in_place) accept either type. Existing &BitBuffer callers do not change.
  • Callers moved to the walk: the masked map kernels, the filter bitmap walk, primitive zip and ListView zip.
  • FoR encoding with mixed validity: uses the walk for each chunk minimum and map_masked_into for the subtraction. It no longer copies the validity words into a Vec.
  • Float statistics: a fully valid chunk counts its runs without a branch. A mixed chunk gathers its valid values first. Nulls are not forward-filled, because a filled NaN would add a run.

Benchmarks

Measured before the rebase onto develop (divan, 4-core cloud container). The statistics rows are medians and the FoR row is the fastest sample:

Benchmark Before After
float_stats_non_null 136.9 µs 27.4 µs
float_stats_nullable 251.1 µs 64.4 µs
float_stats_all_non_null 487.9 µs 294.4 µs
float_stats_all_nullable 737.1 µs 327.4 µs
for_encode/encode_chunked_nullable 139 µs 63 µs

The masked maps, the zip kernels, filter_fixed_width and for_encode/encode_chunked measured the same before and after.

@joseph-isaacs joseph-isaacs added the changelog/performance A performance improvement label Oct 7, 2026 — with Claude
@codspeed

codspeed Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Merging this PR will degrade performance by 10.88%

2 warnings

⚠️ Walltime results may be unreliable

Some benchmarks used the Walltime instrument outside CodSpeed Macro Runners, which can make the results inconsistent.

Learn more about Macro Runners

See affected benchmarks

⚠️ 1 benchmark is dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

⚡ 5 improved benchmarks
❌ 11 regressed benchmarks
✅ 1927 untouched benchmarks
⏩ 53 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ Walltime compare_u8_neon 1.7 µs 3 µs -44.66%
❌ Walltime encode_chunked_nullable_avx512[i64, 524288] 58.9 µs 91.7 µs -35.72%
❌ Walltime encode_chunked_nullable_neon[i64, 524288] 64.8 µs 100 µs -35.2%
❌ Walltime compare_u64_neon 3.9 µs 5.3 µs -26.48%
❌ Walltime compare_int_constant_neon 3.3 µs 4.4 µs -25.82%
❌ Walltime compare_int_nullable_neon 4.2 µs 5.6 µs -25.11%
❌ Walltime compare_int_eq_neon 3.9 µs 5.1 µs -23.93%
❌ Walltime compare_int_neon 3.9 µs 5.1 µs -22.9%
❌ Walltime compare_f32_neon 4.2 µs 5 µs -15.68%
❌ Walltime scalar_subtract_neon 12.3 µs 14.5 µs -15.32%
❌ Walltime add_u32_nonnull_neon 12.9 µs 15 µs -14.06%
⚡ CPU Simulation float_stats_non_null 893.2 µs 459.1 µs +94.56%
⚡ Walltime encode_chunked_nullable_avx2[i64, 524288] 134.6 µs 94 µs +43.22%
⚡ CPU Simulation float_stats_all_non_null 4.4 ms 3.4 ms +27.06%
⚡ CPU Simulation float_stats_all_nullable 4.3 ms 3.7 ms +17.75%
⚡ CPU Simulation float_stats_nullable 1.2 ms 1 ms +12%

Tip

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


Comparing ji/youthful-pasteur-lqf1oo (c37e0c5) with develop (282f0d4)

Open in CodSpeed

Footnotes

  1. 53 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. ↩

@joseph-isaacs
joseph-isaacs added this pull request to stack #10364 October 7, 2026 12:37
@joseph-isaacs
joseph-isaacs marked this pull request as ready for review October 7, 2026 12:37
@joseph-isaacs joseph-isaacs changed the title Count float statistics a validity word per chunk, branch-free Share the mask word walk in vortex-compute and count float statistics a word per chunk Oct 7, 2026
Base automatically changed from ji/float-stats-bench to develop October 8, 2026 16:41
@joseph-isaacs
joseph-isaacs force-pushed the ji/youthful-pasteur-lqf1oo branch from 3b55880 to d9a6538 Compare October 8, 2026 16:51
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

This PR has been marked as stale because it has been open for 14 days with no activity. Please comment or remove the stale label if you wish to keep it active, otherwise it will be closed in 7 days

@github-actions github-actions Bot added the stale This PR is stale and will be auto-closed soon label Nov 6, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR was closed because it has been inactive for 7 days since being marked as stale.

@github-actions github-actions Bot closed this Nov 16, 2026
@robert3005 robert3005 reopened this Nov 16, 2026
…sk_word

Add `for_each_mask_word` and `try_for_each_mask_word` to `vortex-compute`.
They walk a `BitBufferView` one `u64` word at a time through
`unaligned_chunks`, so the 8-byte aligned body is read with no reshift for
each word.

Use the walk in these places instead of a local copy:

- the masked lane kernels `map_masked_into`, `try_map_masked_into` and
  `try_map_masked_in_place`, which now accept `impl Into<BitBufferView>`
- the filter word walk for a mask bitmap
- the primitive and ListView zip kernels
- the FoR encoder for chunks with mixed validity, which no longer copies
  the validity words into a `Vec`

Compute the float statistics over chunks of 64 values. A chunk that is
fully valid has a branch-free count of its runs, and a mixed chunk
gathers its valid values first.

The integer statistics are not changed. #10346 rewrote them on develop
and that replaces the changes this branch made to them.

Signed-off-by: Robert Kruszewski <github@robertk.io>
@robert3005
robert3005 force-pushed the ji/youthful-pasteur-lqf1oo branch from 58c8b83 to c37e0c5 Compare November 16, 2026 11:50
@robert3005
robert3005 merged commit c68edb3 into develop Nov 16, 2026
85 of 86 checks passed
@robert3005
robert3005 deleted the ji/youthful-pasteur-lqf1oo branch November 16, 2026 13:15
robert3005 added a commit that referenced this pull request Nov 16, 2026
…11498)

Follow-up to #10362, which added
`vortex_compute::lane_kernels::for_each_mask_word`.

## Changes

- `vortex-array`: `for_each_transition_word` in `runend/compress.rs` now
uses `for_each_mask_word` and `low_bits_mask`. The separate remainder
branch is gone.
- `vortex-array`: add a `count_bool_runs` benchmark to
`run_end_compress`. It counts the runs of a bitmap that starts mid-byte,
as a sliced boolean array does.
- `vortex-decimal-byte-parts`: `split_wide` now uses
`for_each_mask_word` in place of the hand-written 64-value chunk walk.
Add the `vortex-compute` dependency.

Signed-off-by: Robert Kruszewski <github@robertk.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/performance A performance improvement stale This PR is stale and will be auto-closed soon

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants