Execute tensor product functions with RowFn - #9348
Conversation
Merging this PR will regress 1 benchmark
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | WallTime | words_gather_scalar[65536] |
8.2 µs | 9.4 µs | -12.64% |
| ⚡ | Simulation | column_x_constant[2] |
503 µs | 150.9 µs | ×3.3 |
| ⚡ | Simulation | column_x_constant[32] |
457.5 µs | 155.7 µs | ×2.9 |
| ⚡ | Simulation | column_x_column[2] |
230.9 µs | 102 µs | ×2.3 |
| ⚡ | Simulation | non_nullable[2] |
645.4 µs | 294 µs | ×2.2 |
| ⚡ | Simulation | nullable[2] |
643 µs | 314.9 µs | ×2 |
| ⚡ | Simulation | column_x_constant[256] |
723.1 µs | 375 µs | +92.84% |
| ⚡ | Simulation | column_x_column[32] |
144.8 µs | 83.8 µs | +72.65% |
| ⚡ | Simulation | column_x_column[256] |
139.6 µs | 82.6 µs | +68.89% |
| ⚡ | Simulation | column_x_extension_constant[2] |
300.1 µs | 191.9 µs | +56.4% |
| ⚡ | Simulation | column_x_extension_constant[256] |
657.4 µs | 441 µs | +49.08% |
| ⚡ | Simulation | column_x_extension_constant[32] |
253.1 µs | 191.6 µs | +32.1% |
| 🆕 | Simulation | column_x_nullable_constant[2] |
N/A | 168.9 µs | N/A |
| 🆕 | Simulation | column_x_nullable_constant[256] |
N/A | 394.2 µs | N/A |
| 🆕 | Simulation | column_x_nullable_constant[32] |
N/A | 174.1 µs | N/A |
| 🆕 | Simulation | constant_x_column[2] |
N/A | 152.3 µs | N/A |
| 🆕 | Simulation | constant_x_column[256] |
N/A | 375.2 µs | N/A |
| 🆕 | Simulation | constant_x_column[32] |
N/A | 156.3 µs | N/A |
| 🆕 | Simulation | column_x_constant[2] |
N/A | 335.1 µs | N/A |
| 🆕 | Simulation | column_x_constant[256] |
N/A | 461.2 µs | N/A |
| ... | ... | ... | ... | ... | ... |
ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.
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-products (5114763) with ct/row-fn-tensor-l2 (f46a367)
Footnotes
-
529 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. ↩
3285a39 to
8b31bba
Compare
19d16dc to
cb67153
Compare
cb67153 to
32bd4da
Compare
|
Here are the local tensor-product benchmark results from the final Rust 1.97.1 run. The comparison used a 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 Negative changes are faster. The values are medians across the seven paired runs. Width-256 dense inner products remain within 4.11%. Narrow, constant, and nullable-constant product cases improve by 14.68–91.92%. Every cosine-similarity case improves, while the Inner product: 15 cases
Cosine similarity: 15 cases
Normalized-array controls: 6 cases
|
32bd4da to
d1277e6
Compare
d1277e6 to
b563ade
Compare
b563ade to
05091c6
Compare
a83f456 to
fda2d31
Compare
fda2d31 to
e915ffd
Compare
e915ffd to
7c4edbf
Compare
fa948f8 to
6a91edb
Compare
5f4a145 to
c8c7719
Compare
2f55638 to
7b504a6
Compare
1ea358d to
eacccf8
Compare
16c0322 to
522e673
Compare
c254873 to
e6efa9c
Compare
e6efa9c to
f4a6d4a
Compare
f4a6d4a to
ffb71a5
Compare
ffb71a5 to
f08b639
Compare
7d3c0c9 to
74022f4
Compare
74022f4 to
91d89a1
Compare
91d89a1 to
5df60af
Compare
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
5df60af to
5114763
Compare
Rationale for this change
Moves inner product and cosine similarity to the shared row executor. This removes duplicated batch machinery and prepares constant-dependent work once.
What changes are included in this PR?
Cosine similarity computes each batch-constant norm once. Inner product and cosine keep their
Normalizedreductions and authoritative stored-norm semantics. Tests cover dense, constant, nullable, vector, tensor, and normalized inputs.Rust 1.97.1 one-CGU fat-LTO measurements show the width-256 dense inner product within 4.1% of
develop; most other product paths improve by 14–92%, with the largest gains on constant operands and narrow vectors.What APIs are changed? Are there any user-facing changes?
There are no public API or behavior changes. Both functions implement
RowFnand receive the standard scalar-function vtable automatically.