Skip to content

Execute tensor L2 norm with RowFn - #9768

Merged
connortsui20 merged 1 commit into
developfrom
ct/row-fn-tensor-l2-v2
Sep 15, 2026
Merged

connortsui20 merged 1 commit into
developfrom
ct/row-fn-tensor-l2-v2

Conversation

@connortsui20

@connortsui20 connortsui20 commented Sep 4, 2026

Copy link
Copy Markdown
Member

Summary

Moves L2Norm to the current RowFn API while preserving its direct arithmetic and null behavior. L2Normalize remains on its handwritten one-pass implementation and is not part of this PR.

Changes

Uses the shared tensor row input for ordinary columns and both constant representations. Tests cover constant encodings, empty and zero-width inputs, nulls, and bitwise agreement with materialized rows.

@codspeed

codspeed Bot commented Sep 4, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 5.14%

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

⚡ 5 improved benchmarks
❌ 9 regressed benchmarks
✅ 2184 untouched benchmarks
⏩ 218 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation column_x_extension_constant[32] 170.5 µs 234.5 µs -27.3%
Simulation column_x_extension_constant[256] 414.6 µs 563.8 µs -26.46%
Simulation random_i8[0.5] 71.5 µs 95.4 µs -24.98%
Simulation column_x_column[256] 88.9 µs 112.5 µs -20.97%
Simulation column_x_column[32] 94.4 µs 117.7 µs -19.78%
Simulation decompress[u64, (4000, 1024)] 71.9 µs 87.3 µs -17.58%
Simulation column_x_constant[256] 591.1 µs 711.5 µs -16.92%
Simulation column_x_constant[32] 392.9 µs 448.2 µs -12.34%
Simulation column_x_extension_constant[2] 247.8 µs 276.8 µs -10.48%
Simulation nullable[2] 632.3 µs 416.6 µs +51.8%
Simulation non_nullable[2] 631.2 µs 419.1 µs +50.59%
Simulation random_i16[0.95] 99 µs 81 µs +22.2%
Simulation allocate_drop_arrow[0] 456.9 ns 402.7 ns +13.45%
Simulation allocate_drop_bytes[0] 575.7 ns 521.6 ns +10.39%

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-v2 (b84f3f7) with develop (7286721)

Open in CodSpeed

Footnotes

  1. 218 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 force-pushed the ct/row-fn-tensor-l2-v2 branch from 4edb768 to c62de9b Compare September 4, 2026 17:35
@connortsui20
connortsui20 force-pushed the ct/row-fn-tensor-l2-v2 branch 2 times, most recently from 6340306 to 857dc6c Compare September 4, 2026 18:16
@connortsui20 connortsui20 changed the title Execute tensor L2 norm with RowFn Execute tensor L2 functions with RowFn Sep 4, 2026
@connortsui20
connortsui20 changed the base branch from ct/tensor-normalization-semantics to ct/row-fn-tensor-rows September 4, 2026 18:17
@connortsui20
connortsui20 force-pushed the ct/row-fn-tensor-l2-v2 branch 2 times, most recently from 9a33c5f to 5974184 Compare September 4, 2026 18:57
@connortsui20 connortsui20 changed the title Execute tensor L2 functions with RowFn Execute tensor L2 norm with RowFn Sep 4, 2026
@connortsui20
connortsui20 force-pushed the ct/row-fn-tensor-l2-v2 branch from 5974184 to 929ae6d Compare September 8, 2026 21:55
Base automatically changed from ct/row-fn-tensor-rows to develop September 10, 2026 20:50
@connortsui20
connortsui20 marked this pull request as ready for review September 14, 2026 20:35
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
@robert3005

Copy link
Copy Markdown
Contributor

I made #9874 by looking at profiles here

@connortsui20
connortsui20 merged commit 47c76eb into develop Sep 15, 2026
83 of 85 checks passed
@connortsui20
connortsui20 deleted the ct/row-fn-tensor-l2-v2 branch September 15, 2026 12:27
robert3005 pushed a commit that referenced this pull request Sep 15, 2026
## Summary

- Tracking Issue: #9128
- Depends on: #9768

Moves inner product and cosine similarity to RowFn without changing
their arithmetic contracts.

## Changes

Inner product keeps the existing left-to-right multiply-and-sum order.
Cosine computes that dot product followed by both L2 norms and the
existing zero-denominator guard, with no encoded reduction,
reassociation, or constant-norm shortcut. Tests cover nulls, empty and
zero-width rows, IEEE overflow and underflow, and bitwise agreement
between constant encodings and materialized rows.

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

changelog/skip Do not list PR in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants