Skip to content

Dispatch structural kernels by physical width - #10841

Open
connortsui20 wants to merge 3 commits into
developfrom
ct/physical-width-dispatch
Open

connortsui20 wants to merge 3 commits into
developfrom
ct/physical-width-dispatch

Conversation

@connortsui20

@connortsui20 connortsui20 commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Summary

Follow-up to #10740. Kernels that only copy or compare stored bits can share code across signed, unsigned, and floating-point types of the same width.

Changes

  • Add typed width adapters that forward to a shared power-of-two byte-width dispatcher.
  • Use byte records in primitive patch, zip, fill-null, interleave, and is-constant kernels, plus shared fixed-width take/filter and filtered take.
  • Add tests for dispatch contracts, floating-point bit patterns, buffer ownership, and decimal alignment.

API Changes

match_each_ptype_width!, match_each_decimal_type_width!, and match_each_power_of_two_width! bind a const W: usize, with an explicit fallback for unsupported widths and an optional specialization list.

Validation: pinned nightly formatting, scoped Clippy with all targets and features and -D warnings, 100 focused tests, and seven width doctests pass.

Code size comparison

Compared base a59294e35e with 77a96de1c0 using separate checkouts and target directories. Both use rustc 1.99.1, LLVM 23.1.1, aarch64-apple-darwin, the release profile (opt-level 3, one codegen unit, LTO off), package default features, and the repository's frame-pointer flag.

Machine-code bytes from Mach-O __text sections:

Artifact Base PR Change
vortex-buffer library 34,448 34,448 0
vortex-array library 11,646,740 11,508,116 -138,624 (-1.19%)
vortex-fastlanes library 2,719,444 2,719,444 0
Linked vx binary 74,396,028 74,357,628 -38,400 (-0.052%)

The linked vx file also shrinks from 120,844,528 to 120,779,936 bytes (-64,592). Library totals exclude Rust metadata. Small archive increases in vortex-buffer and vortex-fastlanes come from metadata, while their machine sections are unchanged.

Commands run in each checkout:

cargo build --release --locked -p vortex-buffer -p vortex-array -p vortex-fastlanes --message-format=json-render-diagnostics
cargo build --release --locked -p vortex-tui --bin vx --message-format=json-render-diagnostics
llvm-size --format=sysv --radix=10 <artifact>

These measurements cover this target and profile. Runtime benchmarks were not run locally.

Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
@connortsui20
connortsui20 marked this pull request as draft October 26, 2026 20:43
@connortsui20 connortsui20 added the changelog/performance A performance improvement label Oct 26, 2026 — with ChatGPT Codex Connector
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
@codspeed

codspeed Bot commented Oct 26, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 16.67%

4 warnings, 1 note

⚠️ 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

⚠️ Unable to measure the execution of 2 benchmarks

These benchmarks measured no execution time, so their results are not comparable and count as unchanged. This usually happens when the compiler removes the code under test.

Prevent compiler optimizations

See affected benchmarks

⚠️ 19 benchmarks are 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

⚠️ Base and head ran on different runner types

Some benchmarks with significant performance changes were compared across different runner types, so the changes might not come from the code. Run base and head on the same runner type, or use CodSpeed Macro Runners for more stable results.

Learn more about Macro Runners

Open the report in CodSpeed to investigate

ℹ️ 40 benchmarks have no flamegraph

The flamegraph wasn't generated: the symbols of the profiling trace could not be resolved, because no information about the language frames was collected.

See affected benchmarks

⚡ 1 improved benchmark
❌ 12 regressed benchmarks
✅ 2426 untouched benchmarks
⏩ 12 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ CPU Simulation primitive_mixed_constants[round_robin/n2/null] 329.4 µs 440.6 µs -25.23%
❌ CPU Simulation primitive_mixed_constants[round_robin/n2/nonnull] 347.8 µs 459.2 µs -24.25%
❌ CPU Simulation primitive[round_robin/n2/nonnull] 348.7 µs 460.2 µs -24.22%
❌ CPU Simulation primitive[round_robin/n2/null] 353.4 µs 464.9 µs -23.97%
❌ CPU Simulation primitive_mixed_constants[random/n2/nonnull] 368.8 µs 480 µs -23.17%
❌ CPU Simulation primitive_mixed_constants[random/n2/null] 375 µs 486.2 µs -22.87%
❌ CPU Simulation primitive[random/n2/nonnull] 447.8 µs 559.3 µs -19.93%
❌ CPU Simulation primitive[random/n2/null] 452.6 µs 564.1 µs -19.76%
❌ CPU Simulation primitive_mixed_constants[random/n64/nonnull] 579.4 µs 688.2 µs -15.81%
❌ CPU Simulation primitive_mixed_constants[random/n64/null] 611.3 µs 720 µs -15.1%
❌ CPU Simulation primitive[random/n64/nonnull] 753.4 µs 863.9 µs -12.79%
❌ CPU Simulation primitive[random/n64/null] 798.1 µs 908.2 µs -12.12%
⚡ CPU Simulation decode_primitives[i64, (2000, 8)] 46.8 µs 34.1 µs +37.21%

Tip

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


Comparing ct/physical-width-dispatch (77a96de) with develop (a59294e)

Open in CodSpeed

Footnotes

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

@connortsui20
connortsui20 marked this pull request as ready for review October 26, 2026 21:45

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/performance A performance improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant