Execute tensor product functions with RowFn - #9348
Conversation
Merging this PR will degrade performance by 10.65%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Simulation | case_when_nary_10_conditions[10000] |
745.7 µs | 2,008 µs | -62.86% |
| ❌ | Simulation | case_when_nary_equality_lookup[10000] |
514.8 µs | 1,151.7 µs | -55.3% |
| ❌ | Simulation | case_when_nary_early_dominant[10000] |
382.4 µs | 765.4 µs | -50.04% |
| ❌ | Simulation | case_when_nary_3_conditions[10000] |
383.8 µs | 766.7 µs | -49.93% |
| ❌ | Simulation | case_when_all_false[100000] |
1.1 ms | 2.1 ms | -49.41% |
| ❌ | Simulation | case_when_all_true[100000] |
1.1 ms | 2.1 ms | -49.28% |
| ❌ | Simulation | case_when_simple[100000] |
1.2 ms | 2.3 ms | -48.87% |
| ❌ | Simulation | case_when_without_else[100000] |
1.2 ms | 2.4 ms | -47.14% |
| ❌ | Simulation | case_when_nary_10_conditions[1000] |
401.2 µs | 693.7 µs | -42.16% |
| ❌ | Simulation | case_when_all_false[10000] |
210.1 µs | 341.6 µs | -38.51% |
| ❌ | Simulation | case_when_all_true[10000] |
214.5 µs | 347.6 µs | -38.29% |
| ❌ | Simulation | case_when_simple[10000] |
242.3 µs | 372.6 µs | -34.96% |
| ❌ | Simulation | case_when_without_else[10000] |
258.7 µs | 392.1 µs | -34.01% |
| ❌ | Simulation | case_when_nary_equality_lookup[1000] |
310.2 µs | 467.7 µs | -33.67% |
| ❌ | Simulation | bench_compare_sliced_dict_primitive[(5000, 10000)] |
185.3 µs | 271.7 µs | -31.81% |
| ❌ | Simulation | case_when_nary_early_dominant[1000] |
225.2 µs | 321.9 µs | -30.04% |
| ❌ | Simulation | bench_compare_sliced_dict_primitive[(3333, 10000)] |
160.4 µs | 228.7 µs | -29.89% |
| ❌ | Simulation | bench_compare_sliced_dict_primitive[(7500, 10000)] |
246.7 µs | 349.1 µs | -29.34% |
| ❌ | Simulation | case_when_nary_3_conditions[1000] |
227.4 µs | 321.6 µs | -29.29% |
| ❌ | Simulation | bench_compare_sliced_dict_primitive[(2500, 10000)] |
147.5 µs | 206.3 µs | -28.49% |
| ... | ... | ... | ... | ... | ... |
ℹ️ 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 (6a91edb) with develop (204d1d4)2
Footnotes
-
89 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. ↩
-
No successful run was found on
ct/row-fn-tensor-l2(d5d1dc7) during the generation of this report, sodevelop(204d1d4) was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩
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
7c4edbf to
fa948f8
Compare
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
fa948f8 to
6a91edb
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.