Repository navigation
Commit d81bd4c
authored
Compare primitive values through the shared RowFn executor (#10676)
Tracking Issue: #9128
## Summary
Moves primitive comparisons onto the shared RowFn executor from #10675,
so comparison code only selects the predicate while the framework
handles decoding, constants, validity, and Boolean output.
## Changes
Preserves the public `Binary` identity and floating-point total
ordering. Uses borrowed operands and dtypes, and moves a constant left
operand to the right with the swapped operator. Relies on the existing
`primitive_comparisons_across_bitmap_words` test for all six swapped
operators and keeps the existing comparison benchmarks.
Based on #10675. Keeps the wide-type, sliced-input, bitmap-boundary,
NaN, and signed-zero tests added upstream in #10843.
## Performance
CodSpeed compares this PR with #10675 (`b0a64dd`). Nine primitive
comparison benchmarks are 12% to 31% faster in walltime, led by
`compare_u64_avx2` and `compare_float_avx2` at 31% and 28%, and no
comparison benchmark regresses.
These gains depend on #10675. #11220 measured the same two commits
directly on `develop`. Without #10675, comparisons on small arrays were
10% to 16% slower than `develop` in CPU simulation, and only two
walltime gains remained, at 16% and 18%. The #10675 description has the
full comparison.
The baseline already includes the private NEON packing kernel from
#10843, which this PR replaces with RowFn execution. So the gains above
are measured against that improved baseline, and the old packing gains
aren't credited to this PR.
<details>
<summary>CodSpeed comparison benchmarks against #10675</summary>
CodSpeed marks the walltime runners as unreliable, but all nine cases
move in the same direction.
| Benchmark | Faster by |
| --- | ---: |
| `compare_u64_avx2` | 30.8% |
| `compare_float_avx2` | 28.2% |
| `lt_i64_nullable_avx2` | 18.4% |
| `compare_int_constant_neon` | 16.2% |
| `compare_int_eq_avx2` | 15.4% |
| `compare_f32_avx2` | 15.4% |
| `compare_int_constant_avx2` | 15.3% |
| `compare_int_avx2` | 13.5% |
| `compare_int_nullable_avx2` | 12.5% |
</details>
<details>
<summary>Historical EC2 accumulated-stack measurements</summary>
These runs measured an earlier accumulated stack, not this layer in
isolation or the current head. They showed gains on some configurations
and regressions on others.
Ratios are the median of 21 paired candidate/baseline elapsed-time
ratios. Below 1 is faster. This compares the earlier complete migration,
M0 `ddf8a16df6b7d7c20cfd860e5f23438d97ca4238`, with D
`0291778db36809f77ce0219bf9850506d3cba3b6`. That baseline predates
#10843. The array-pair cases use all-valid nullable inputs. The addition
case is an arithmetic control whose algorithm was unchanged.
| Workload | C7g NEON | C6a AVX2 | C7i AVX2 build | C7i AVX-512 build |
| --- | ---: | ---: | ---: | ---: |
| `f32` array-pair Gte, 8,192 rows | 1.014 | 1.040 | 0.873 | 1.036 |
| `i64` array-pair Gte, 8,192 rows | 0.900 | 1.139 | 0.929 | 0.943 |
| Nullable `i64` add, 32,768 rows | 1.002 | 1.123 | 1.154 | 1.004 |
For example, the old stack took about 10% less time for the ARM `i64`
comparison, but about 14% more for the same case on AVX2-only C6a. C6a
nullable `i64` addition took about 12% more time. These whole-executable
measurements do not establish that the comparison algorithm caused
movement in arithmetic controls.
In the four-label matrix, D ran before M0 in 11 blocks and after it in
ten. The experimental one-pass decoder variants are excluded from this
table.
EC2 C7g (Neoverse V1), C6a (EPYC 7R13), and C7i (Xeon Platinum 8488C).
Rust 1.99.1 / LLVM 23.1.1, bench profile with 16 CGUs and no LTO,
MiMalloc, CPU 2 pinned. The same 455-case public-path microbenchmark
suite ran serially across hosts, with 21 paired blocks, 10 ms per case,
A/A calibration, and a separate control executable. These are
microbenchmarks, not query results. C7i can dispatch to AVX-512 at
runtime even in its AVX2 build.
Saved evidence is in the local investigation archive
`row-fn-evaluation-20261026`: `manifest.json`, `*-matrix-*-medians.csv`,
`*-matrix-*-summary.json`, and `results/<host>/results/matrix-*.json`.
</details>
<details>
<summary>Confirmed independent packing gains, now in develop via
#10843</summary>
The ARM-only private-kernel change reduced long array-pair cohort time
on Graviton3 as follows. Each cohort contains 32 cases, including
partially valid inputs and lengths around 16K.
| Cohort | Confirmation elapsed-time ratio | Paired 95% interval | Time
reduction |
| --- | ---: | --- | ---: |
| `i64` | 0.846 | 0.843 to 0.856 | 15.4% |
| `u64` | 0.860 | 0.858 to 0.864 | 14.0% |
| `f64` | 0.882 | 0.880 to 0.886 | 11.8% |
Baseline `a59294e35e7109fac894a7a38a68f42db0c3c967`, candidate
`f018aaeef739145e1bc50079a441c5d9fd53404a`. The cohort uses a geometric
mean of case ratios within each block, then the median across blocks.
Two 21-block sessions used complementary AB/BA orders, the same full
455-case suite, and 1,000 single-iteration samples per case. The initial
fixed-order source comparisons were discarded. The AVX2 builds had
identical `.text` bytes, so no x86 speedup was attributed to this
change. See #10843 for the harness and full methodology.
These gains required neither this PR nor #10675.
</details>
On `e724610`, CI passed all-target, all-feature Clippy with warnings
denied and the Linux, CPU feature, sanitizer, and Miri test jobs.
---------
Signed-off-by: Connor Tsui <[email protected]>1 parent df153c0 commit d81bd4c
33 files changed
Lines changed: 742 additions & 372 deletions
File tree
- vortex-array
- benches
- src/scalar_fn
- fns/binary
- compare
- unstable/row
- batch
- execute
- execute
- types
- element
- tuple
- sink
- visitor
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
12 | 9 | | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
17 | 13 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
22 | 18 | | |
23 | 19 | | |
24 | 20 | | |
| |||
66 | 62 | | |
67 | 63 | | |
68 | 64 | | |
69 | | - | |
| 65 | + | |
70 | 66 | | |
71 | 67 | | |
72 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
63 | 61 | | |
64 | 62 | | |
65 | 63 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
93 | 95 | | |
94 | 96 | | |
95 | 97 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
10 | 10 | | |
11 | | - | |
12 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| 18 | + | |
| 19 | + | |
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
| |||
209 | 212 | | |
210 | 213 | | |
211 | 214 | | |
212 | | - | |
| 215 | + | |
213 | 216 | | |
214 | 217 | | |
215 | 218 | | |
| |||
0 commit comments