Execute tensor L2 norm with RowFn - #9768
Conversation
Merging this PR will degrade performance by 5.14%
|
| 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)
Footnotes
-
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. ↩
4edb768 to
c62de9b
Compare
6340306 to
857dc6c
Compare
9a33c5f to
5974184
Compare
5974184 to
929ae6d
Compare
929ae6d to
c11ae04
Compare
c11ae04 to
e1ca225
Compare
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
e1ca225 to
b84f3f7
Compare
|
I made #9874 by looking at profiles here |
## 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>
Summary
Moves
L2Normto the current RowFn API while preserving its direct arithmetic and null behavior.L2Normalizeremains 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.