Repository navigation
Add FloatWidenScheme to BtrBlocks for lossless float narrowing - #11902
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
37-Column Local Float Ablation (
|
| Column | PType | Rows | Raw (MB) | Default (MB) | +FloatWiden (MB) | Delta | Widen Chunks | Base Enc | +FloatWiden Enc | Enc Base (ms) | Enc Widen (ms) |
|---|---|---|---|---|---|---|---|---|---|---|---|
Arade.F4 |
f64 |
9888775 | 79.11 | 31.82 | 31.82 | +0.00% | 0/76 | vortex.alp(76) |
vortex.alp(76) |
225.6 | 226.5 |
Arade.F5 |
f64 |
9888775 | 79.11 | 31.08 | 31.08 | +0.00% | 0/76 | vortex.alp(76) |
vortex.alp(76) |
230.0 | 232.4 |
Arade.F8 |
f64 |
9888775 | 79.11 | 31.45 | 31.45 | +0.00% | 0/76 | vortex.alp(76) |
vortex.alp(76) |
233.1 | 234.9 |
Arade.F9 |
f64 |
9888775 | 79.11 | 31.45 | 31.45 | +0.00% | 0/76 | vortex.alp(76) |
vortex.alp(76) |
236.1 | 233.7 |
Bimbo.Dev_proxima |
f64 |
74180464 | 593.44 | 12.32 | 12.32 | +0.00% | 0/566 | vortex.dict(517)+vortex.alp(49) |
vortex.dict(517)+vortex.alp(49) |
458.4 | 454.1 |
Bimbo.Venta_hoy |
f64 |
74180464 | 593.44 | 121.50 | 121.50 | +0.00% | 0/566 | vortex.alp(566) |
vortex.alp(566) |
732.4 | 724.8 |
CMSprovider.AVERAGE_MEDICARE_ALLOWED_AMT |
f64 |
9287877 | 75.46 | 40.13 | 40.13 | +0.00% | 0/71 | vortex.dict(53)+vortex.alp(17) |
vortex.dict(53)+vortex.alp(17) |
178.3 | 180.8 |
CMSprovider.AVERAGE_MEDICARE_PAYMENT_AMT |
f64 |
9287877 | 75.46 | 52.36 | 52.36 | +0.00% | 0/71 | vortex.alp(71) |
vortex.alp(71) |
219.2 | 215.6 |
CMSprovider.AVERAGE_SUBMITTED_CHRG_AMT |
f64 |
9287877 | 75.46 | 41.69 | 41.69 | +0.00% | 0/71 | vortex.alp(41)+vortex.dict(30) |
vortex.alp(41)+vortex.dict(30) |
203.7 | 205.3 |
CMSprovider.LINE_SRVC_CNT |
f64 |
9287877 | 75.46 | 13.61 | 13.59 | -0.13% | 3/71 | vortex.alp(71) |
vortex.alp(68)+widen(f32->vortex.alp)(3) |
60.7 | 65.8 |
CMSprovider.STDEV_MEDICARE_ALLOWED_AMT |
f64 |
9287877 | 75.46 | 37.00 | 37.00 | +0.00% | 0/71 | vortex.alp(61)+vortex.dict(10) |
vortex.alp(61)+vortex.dict(10) |
93.2 | 91.8 |
CMSprovider.STDEV_MEDICARE_PAYMENT_AMT |
f64 |
9287877 | 75.46 | 48.04 | 48.04 | +0.00% | 0/71 | vortex.alp(71) |
vortex.alp(71) |
207.1 | 206.4 |
CMSprovider.STDEV_SUBMITTED_CHRG_AMT |
f64 |
9287877 | 75.46 | 38.12 | 38.12 | +0.00% | 0/71 | vortex.alp(52)+vortex.dict(19) |
vortex.alp(52)+vortex.dict(19) |
122.1 | 120.9 |
Euro2016.polarity_confidence |
f64 |
2052497 | 16.68 | 13.86 | 13.86 | +0.00% | 0/16 | vortex.alprd(16) |
vortex.alprd(16) |
18.0 | 19.6 |
Euro2016.subjectivity_confidence |
f64 |
2052497 | 16.68 | 14.56 | 14.56 | +0.00% | 0/16 | vortex.alp(15)+vortex.dict(1) |
vortex.alp(15)+vortex.dict(1) |
30.1 | 29.5 |
Food.volume_total_bytes |
f64 |
5216593 | 41.73 | 19.60 | 19.60 | +0.00% | 0/40 | vortex.alp(40) |
vortex.alp(40) |
101.9 | 100.7 |
HashTags.interaction#author#id |
f64 |
511511 | 4.16 | 2.07 | 2.07 | +0.00% | 0/4 | vortex.alp(4) |
vortex.alp(4) |
8.3 | 8.7 |
HashTags.interaction#geo#latitude |
f64 |
511511 | 4.16 | 0.29 | 0.29 | +0.00% | 0/4 | vortex.sparse(4) |
vortex.sparse(4) |
1.2 | 1.0 |
HashTags.interaction#geo#longitude |
f64 |
511511 | 4.16 | 0.29 | 0.29 | +0.00% | 0/4 | vortex.sparse(4) |
vortex.sparse(4) |
1.0 | 0.9 |
HashTags.interaction#received_at |
f64 |
511511 | 4.16 | 3.35 | 3.35 | +0.00% | 0/4 | vortex.alp(2)+vortex.alprd(2) |
vortex.alp(2)+vortex.alprd(2) |
5.5 | 6.1 |
HashTags.twitter#geo#latitude |
f64 |
511511 | 4.16 | 0.29 | 0.29 | +0.00% | 0/4 | vortex.sparse(4) |
vortex.sparse(4) |
1.1 | 1.0 |
HashTags.twitter#geo#longitude |
f64 |
511511 | 4.16 | 0.29 | 0.29 | +0.00% | 0/4 | vortex.sparse(4) |
vortex.sparse(4) |
1.0 | 0.9 |
HashTags.twitter#id |
f64 |
511511 | 4.09 | 3.14 | 3.14 | +0.00% | 0/4 | vortex.alprd(4) |
vortex.alprd(4) |
5.7 | 5.5 |
HashTags.twitter#in_reply_to_status_id |
f64 |
511511 | 4.16 | 0.36 | 0.36 | +0.00% | 0/4 | vortex.sparse(4) |
vortex.sparse(4) |
1.6 | 1.6 |
HashTags.twitter#user#id |
f64 |
511511 | 4.16 | 2.07 | 2.07 | +0.00% | 0/4 | vortex.alp(4) |
vortex.alp(4) |
8.3 | 8.1 |
HashTags.twitter#user#id_str |
f64 |
511511 | 4.16 | 2.05 | 2.05 | +0.00% | 0/4 | vortex.alp(4) |
vortex.alp(4) |
7.7 | 7.5 |
Taxi.trip_miles |
f64 |
19144903 | 153.16 | 37.64 | 37.64 | +0.00% | 0/147 | vortex.alp(147) |
vortex.alp(147) |
191.3 | 197.1 |
Taxi.base_passenger_fare |
f64 |
19144903 | 153.16 | 36.33 | 36.33 | +0.00% | 0/147 | vortex.alp(147) |
vortex.alp(147) |
180.5 | 183.3 |
Taxi.tolls |
f64 |
19144903 | 153.16 | 16.44 | 16.44 | +0.00% | 0/147 | vortex.dict(129)+vortex.alp(18) |
vortex.dict(129)+vortex.alp(18) |
173.0 | 175.4 |
Taxi.bcf |
f64 |
19144903 | 153.16 | 22.06 | 22.06 | +0.00% | 0/147 | vortex.alp(147) |
vortex.alp(147) |
100.9 | 103.0 |
Taxi.sales_tax |
f64 |
19144903 | 153.16 | 24.91 | 24.91 | +0.00% | 0/147 | vortex.alp(147) |
vortex.alp(147) |
119.7 | 112.1 |
Taxi.congestion_surcharge |
f64 |
19144903 | 153.16 | 4.79 | 4.79 | -0.06% | 0/147 | vortex.dict(144)+vortex.alp(3) |
vortex.dict(147) |
115.6 | 148.7 |
Taxi.airport_fee |
f64 |
19144903 | 153.16 | 4.54 | 4.07 | -10.45% | 30/147 | vortex.dict(98)+vortex.alp(49) |
vortex.dict(113)+widen(f32->vortex.alp)(30) |
128.9 | 161.3 |
Taxi.tips |
f64 |
19144903 | 153.16 | 25.97 | 25.97 | +0.00% | 0/147 | vortex.dict(81)+vortex.alp(66) |
vortex.dict(81)+vortex.alp(66) |
168.9 | 168.6 |
Taxi.driver_pay |
f64 |
19144903 | 153.16 | 34.51 | 34.51 | +0.00% | 0/147 | vortex.alp(147) |
vortex.alp(147) |
163.6 | 159.7 |
GloveSmall100k.emb[flat] |
f32 |
20000000 | 80.00 | 64.40 | 64.40 | +0.00% | 0/77 | vortex.alp(73)+vortex.alprd(3) |
vortex.alp(73)+vortex.alprd(3) |
314.1 | 308.7 |
OpenaiSmall50k.emb[flat] |
f64 |
76800000 | 614.40 | 548.57 | 270.17 | -50.75% | 586/586 | vortex.alprd(586) |
widen(f32->vortex.alprd)(586) |
1158.3 | 1323.3 |
| TOTAL (37 cols) | 4220.99 | 1412.93 | 1134.03 | -19.74% | 6206.0 | 6425.7 |
Operation Latencies (Median of 3 Runs, Release)
| Column / Arm | Size (MB) | Decode (ms) | scalar_at (ns) |
Filter 1% (ms) | Filter 10% (ms) | Filter 50% (ms) | Take 1% (ms) | Take 10% (ms) | Take 50% (ms) | Compare < (ms) |
|---|---|---|---|---|---|---|---|---|---|---|
CMSprovider.LINE_SRVC_CNT (Default) |
13.61 | 3.4 | 484.6 | 1.3 | 3.4 | 5.0 | 1.3 | 7.9 | 11.2 | 2.3 |
CMSprovider.LINE_SRVC_CNT (+FloatWiden) |
13.59 | 2.9 | 514.1 | 1.1 | 3.4 | 5.5 | 1.4 | 7.4 | 11.7 | 2.0 |
Taxi.airport_fee (Default) |
4.54 | 7.3 | 704.9 | 2.1 | 4.1 | 10.1 | 2.9 | 15.6 | 47.0 | 1.5 |
Taxi.airport_fee (+FloatWiden) |
4.07 | 10.6 | 712.9 | 2.2 | 4.7 | 11.7 | 3.1 | 15.6 | 50.1 | 1.4 |
OpenaiSmall50k.emb[flat] (Default) |
548.57 | 35.9 | 617.9 | 22.8 | 50.0 | 64.1 | 23.9 | 89.8 | 298.3 | 49.5 |
OpenaiSmall50k.emb[flat] (+FloatWiden) |
270.17 | 39.7 | 680.9 | 22.2 | 44.4 | 51.6 | 22.1 | 80.7 | 291.7 | 28.5 |
Merging this PR will degrade performance by 22.73%Warning vortex-data has exceeded the Hobby plan limit of 5 active contributors. Upgrade your plan or apply to the open source program by December 8, 2026 to keep using CodSpeed. 2 warnings
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
lwwmanning
left a comment
There was a problem hiding this comment.
Posted by Claude Opus 5.5 on Will's behalf.
I found no path that gives a lossy result. The sampled probe can only skip the scheme, a full bit-exact check gates every verdict, and the CUDA preset excludes the scheme as claimed.
Most of the 663 lines are a custom deferred estimate that builds its own sample and repeats the target selection from #11901. Reusing the compressor's shared sample and one selection function from vortex-array would make this much smaller, and would let #11901 keep its helpers private. Details inline. This also needs the CUDA fix on #11901 before files written with it can be read on the GPU.
|
|
||
| /// Builds a deterministic ~1% sample executed to a contiguous [`PrimitiveArray`], returning | ||
| /// `(sample, is_subsampled)`. | ||
| fn build_sample_primitive( |
There was a problem hiding this comment.
build_sample_primitive reimplements the compressor's sample_rows with different spacing, and a fixed 1024 rows for arrays of about 100k to 800k rows, where the competing schemes see about 1 percent through the shared compression_sample. It also skips amortize_fixed_nbytes. So the Widen ratio is compared against ratios from a different sample, and that sample is executed a second time. Running the full fit check in pass 1 and returning DeferredEstimate::Sample would reuse the shared sample and remove most of estimate_narrowed_ratio.
| /// Verifies full-array bit-exact fit and returns all valid narrower targets ordered narrowest | ||
| /// first (`[F16, F32]` when an `f64` array fits both, because `ALP`/`ALPRD` skip `f16` so `f32` | ||
| /// can still beat `f16` after child compression). | ||
| fn candidate_targets_full(array: &PrimitiveArray, mask: &Mask) -> VortexResult<Vec<PType>> { |
| let fits_f16 = probe_valid_slice(array.as_slice::<f64>(), mask, f64_slice_fits_in_f16) | ||
| && float_array_fits_in_ptype(array, PType::F16, mask)?; | ||
| if fits_f16 { | ||
| Ok(vec![PType::F16, PType::F32]) |
There was a problem hiding this comment.
No test covers an f64 column that fits both f16 and f32, so nothing checks the claim here that f32 can beat f16 after ALP or ALPRD, or that the chosen target round-trips. One case with f16-exact f64 values would cover it.
|
|
||
| /// Minimum compression-ratio improvement over the best un-narrowed float scheme required to wrap | ||
| /// the array in a [`WidenArray`] (`>= 2%` smaller). | ||
| const MIN_IMPROVEMENT_FACTOR: f64 = 1.02; |
There was a problem hiding this comment.
Other schemes compete on raw ratio. What is the 2 percent threshold based on? Either give the measurement behind it or drop it.
| PType::F32 | ||
| ); | ||
| assert!( | ||
| with_widen.nbytes() * 100 < without_widen.nbytes() * 60, |
There was a problem hiding this comment.
The over-40-percent assertion compares against whatever ALPRD produces today on pseudorandom data, so an unrelated ALPRD improvement could fail it. The Widen-at-root and bit-exact assertions are the ones that matter.
b692593 to
83b1715
Compare
53babe9 to
5a2fac6
Compare
098ee79 to
be73159
Compare
roborev: Combined Review (
|
be73159 to
a2478a3
Compare
|
Addressed the roborev finding in |
d5c7572 to
575fe06
Compare
|
Addressed the updated roborev finding in |
575fe06 to
68f3190
Compare
45fe86a to
9be8071
Compare
|
Note on the CodSpeed report: the earlier 22% regression on |
Add FloatWidenScheme to vortex-btrblocks, gated behind vortex.widen.v2 (UNSTABLE) and excluded from the CUDA preset. Uses a zero-allocation stratified Pass-1 probe for instant rejection on general float columns, full-array bit-exact verification inside a DeferredEstimate::Callback after sampled schemes run, descendant exclusions keeping Dict/RLE at the root, and a >= 2% savings threshold before wrapping narrowed child compression in WidenArray. Signed-off-by: Will Manning <will@willmanning.io> Signed-off-by: Will Manning <will@spiraldb.com>
… size Signed-off-by: Will Manning <will@spiraldb.com> Co-Authored-By: Will Manning <will@spiraldb.com> Signed-off-by: Will Manning <will@spiraldb.com>
…imation Signed-off-by: Will Manning <will@spiraldb.com> Co-Authored-By: Will Manning <will@spiraldb.com>
Signed-off-by: Will Manning <will@spiraldb.com> Co-Authored-By: Will Manning <will@spiraldb.com>
Signed-off-by: Will Manning <will@spiraldb.com> Co-Authored-By: Will Manning <will@spiraldb.com>
Signed-off-by: Will Manning <will@spiraldb.com> Co-Authored-By: Will Manning <will@spiraldb.com>
68f3190 to
5ade591
Compare
…n tests Signed-off-by: Will Manning <will@spiraldb.com> Co-Authored-By: Will Manning <will@spiraldb.com>
Signed-off-by: Will Manning <will@spiraldb.com> Co-Authored-By: Will Manning <will@spiraldb.com>
This adds
FloatWidenSchemetovortex-btrblocks. The scheme narrows float arrays losslessly withWiden(f64tof32orf16, andf32tof16) before the child float encodings compress them. CUDA presets do not use it.The scheme reuses
narrowest_float_ptypeandnarrow_float_valuesfromvortex-array, and estimates its gain on the usual BtrBlocks sample (DeferredEstimate::Sample). When anf64column fits bothf16andf32, it compresses both children and keeps the smaller one.DictandRLEstay at the root. The scheme writesvortex.widen.v2, so it applies only when theUNSTABLEedition is allowed.Stacked on #11901
Authored with AI assistance.