Skip to content

Execute tensor L2 norm with RowFn - #9347

Draft
connortsui20 wants to merge 1 commit into
ct/row-fn-primitive-comparisonsfrom
ct/row-fn-tensor-l2
Draft

Execute tensor L2 norm with RowFn#9347
connortsui20 wants to merge 1 commit into
ct/row-fn-primitive-comparisonsfrom
ct/row-fn-tensor-l2

Conversation

@connortsui20

@connortsui20 connortsui20 commented Aug 11, 2026

Copy link
Copy Markdown
Member

Rationale for this change

Moves tensor L2 norm to the shared row executor while preserving the existing storage semantics.

What changes are included in this PR?

Top-level constants still reduce once, and Normalized arrays still return their authoritative stored norms. Masked constants use validity-aware row execution. Tests cover tensor shapes, constants, nulls, vectors, and normalized storage.

Rust 1.97.1 one-CGU fat-LTO results improve dense and nullable widths by up to 46%; width 256 remains within 3%. Non-null constant inputs regress by 19–33%, while nullable constants improve by 83–94%.

What APIs are changed? Are there any user-facing changes?

There are no public API or behavior changes. L2Norm implements RowFn and receives the standard scalar-function vtable automatically.

@codspeed-hq

codspeed-hq Bot commented Aug 11, 2026

Copy link
Copy Markdown

Merging this PR will regress 7 benchmarks

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

⚡ 7 improved benchmarks
❌ 7 regressed benchmarks
✅ 1978 untouched benchmarks
🆕 6 new benchmarks
⏩ 442 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation column_x_column[256] 105.4 µs 136.7 µs -22.95%
Simulation column_x_column[32] 111.4 µs 141.5 µs -21.26%
Simulation search_index_above_max_chunked 545.5 µs 651.2 µs -16.24%
Simulation search_index_in_range_chunked 547 µs 652.7 µs -16.2%
WallTime words_gather_scalar[65536] 8.3 µs 9.4 µs -11.97%
Simulation encode_non_nullable[256] 160.5 µs 180.6 µs -11.11%
Simulation encode_nullable[32] 251.7 µs 280.3 µs -10.22%
Simulation non_nullable[2] 691.1 µs 394 µs +75.38%
Simulation nullable[2] 681.1 µs 399 µs +70.69%
Simulation encode_non_nullable[2] 484.4 µs 427.5 µs +13.32%
Simulation slice_dict_tight_loop[10000] 747.2 µs 670.7 µs +11.4%
Simulation compress_fsst[(500, 64, 8)] 581.1 µs 524.6 µs +10.77%
Simulation compress_fsst[(500, 64, 4)] 516.3 µs 467.5 µs +10.45%
Simulation encode_nullable[2] 621.5 µs 564.6 µs +10.07%
🆕 Simulation constant[2] N/A 136.1 µs N/A
🆕 Simulation constant[256] N/A 259.2 µs N/A
🆕 Simulation constant[32] N/A 88.7 µs N/A
🆕 Simulation nullable_constant[2] N/A 343 µs N/A
🆕 Simulation nullable_constant[256] N/A 434.3 µs N/A
🆕 Simulation nullable_constant[32] N/A 225 µs N/A

Tip

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


Comparing ct/row-fn-tensor-l2 (f220999) with ct/row-fn-primitive-comparisons (9e1c9b4)2

Open in CodSpeed

Footnotes

  1. 442 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.

  2. No successful run was found on ct/row-fn-primitive-comparisons (8a71b98) during the generation of this report, so e6e17c3 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@connortsui20
connortsui20 marked this pull request as ready for review August 11, 2026 16:05
@connortsui20
connortsui20 marked this pull request as draft August 11, 2026 16:24
@connortsui20

Copy link
Copy Markdown
Member Author

Here are the local L2 norm benchmark results from the final Rust 1.97.1 run.

The comparison used a develop baseline with benchmark-only backfills (1edd0fca) and the full RowFn stack (8ca9fc73). Later stack layers do not change L2 norm source, but unrelated code-placement effects can still affect these binaries.

The machine was an AMD Ryzen 9 7950X running Linux. The build used rustc 1.97.1, LLVM 22.1.6, one CGU, fat LTO, and -C target-cpu=native. Each target used two warm runs and seven alternating measured pairs. Each process used 100 samples with a 0.25–0.5 second measurement window on CPU 4.

Negative changes are faster. The values are medians across the seven paired runs.

Dense and nullable widths improve by as much as 45.91%. Width 256 remains within 2.93%. Non-null constants regress by 18.82–33.24%, while nullable constants improve by 83.36–93.90%.

All L2 norm results: 12 cases
Input Width Baseline RowFn stack Change
constant 256 10.400 µs 13.720 µs +33.24%
constant 32 1.859 µs 2.479 µs +33.17%
constant 2 1.179 µs 1.399 µs +18.82%
non-null 256 9.449 µs 9.619 µs +1.69%
nullable 256 10.240 µs 9.959 µs -2.93%
non-null 32 6.969 µs 6.529 µs -6.31%
nullable 32 7.779 µs 6.869 µs -11.70%
non-null 2 31.580 µs 17.180 µs -45.60%
nullable 2 32.400 µs 17.530 µs -45.91%
nullable constant 256 174.500 µs 28.710 µs -83.36%
nullable constant 2 183.400 µs 18.860 µs -89.75%
nullable constant 32 163.200 µs 9.979 µs -93.90%

@connortsui20
connortsui20 force-pushed the ct/row-fn-tensor-l2 branch 2 times, most recently from a1d4c01 to b997cb9 Compare August 17, 2026 19:43
@connortsui20
connortsui20 force-pushed the ct/row-fn-tensor-l2 branch 2 times, most recently from 11ab10c to 970f830 Compare August 17, 2026 20:59
@connortsui20
connortsui20 force-pushed the ct/row-fn-tensor-l2 branch 2 times, most recently from 993b67a to 691b212 Compare August 18, 2026 20:45
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
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