One Day With a 3080 Ti: 48× Faster Error Correction, 11× Faster ZPAQ — and a Mixer That Said No

A day of GPU-accelerated compression on hot_house: CUDA BCH at 2,961 MB/s, segment-parallel zpaqfranz m5 at 11×, deep-repair Chase at 453–512× — and a context mixer that is GPU-hostile by construction.

One Day With a 3080 Ti: 48× Faster Error Correction, 11× Faster ZPAQ — and a Mixer That Said No

One day, one RTX 3080 Ti, one question: how much of lzply and lzpaq can a GPU actually accelerate? The day is Dec 3, the machine is hot_house — AMD Ryzen 9 3900X (12C/24T), 78 GB RAM, NVIDIA GeForce RTX 3080 Ti 12 GB, nvcc CUDA 13.5 — and the scoreboard is three measurable wins and one confirmed negative. This article covers all four, honestly, with the numbers as measured.

The bottom line, up front: the BCH error-correction remainder runs 48× faster on the GPU and store-mode archives get up to 4.3× faster end to end; segment-parallel zpaqfranz m5 runs up to 11× faster on the CPU — that one is CPU parallelism, not GPU, and it is labelled as such; the zpaq context mixer is GPU-hostile by construction and we are not porting it; and deep-repair Chase runs 453–512× faster on the GPU, with bit-identical candidate sets. No deployment change is proposed for the mixer. The numbers below are medians of 3–5 runs, on War and Peace (3,867,266 B) and BIG, War and Peace ×13 (50,274,458 B), unless stated otherwise.

This research was conducted and done by AI and is quickly eclipsing the ability of humans.

1. CUDA BCH: the remainder at 2,961 MB/s

The first win is the BCH remainder — the linear scan that dominates lzply's error-correction cost. Profiling had already ranked it: t=32 encode/decode runs at ~22 MB/s on one CPU core, ~12% of the compress wall at -e7, ~2.5% at the default -e4. The remainder is GF(2)-linear, so it parallelises the way a CRC does: split the block into 4,096-byte chunks, compute each chunk's partial remainder on the GPU, and combine the partials with a precomputed advance table. Blocks are independent too. The work lives in the experiments/cuda-bch branch (commit 8e40d15).

tCPU remainderGPU remainderSpeedup
t=887.0 MB/s2,961.2 MB/s34×
t=3222.8 MB/s1,093.5 MB/s48×

Those are encode figures on the 50 MB blob, median of 5 runs; decode matches (2,943.8 MB/s at t=8, 1,099.4 MB/s at t=32). End to end, in store mode (-0, which isolates BCH + SHA-256 with no compression), the whole CLI gets faster:

Store mode, 50 MB blobCPUCUDASpeedup
-e4 (t=8)0.885 s0.526 s1.7×
-e7 (t=32)2.439 s0.571 s4.3×

And here is the honest scope, stated plainly: high-compression mode barely moves. LZMA encode is ~97% of the -6 compress wall (~17 s / 47.9 MB, 2.8 MB/s), so removing the BCH cost leaves the -6 time essentially unchanged. The GPU win is store mode and -e7, where BCH was a real share of the wall — not a general compression speedup, and this article does not claim one.

One engineering detail matters for correctness of the claim: a fresh process pays ~0.12 s of CUDA first-touch cost (context creation + first cudaMalloc) before any kernel runs. Dispatch therefore uses per-t size thresholds, checked before any CUDA call: t≥32 needs 4 MB, t≥16 needs 8 MB, anything else needs 16 MB. Small inputs never pay the init cost at all, and at 1 MB the dispatch path matches CPU speed rather than regressing — small archives are exactly as fast as they were.

Verification, because a fast wrong answer is worse than a slow right one: 612 checks, 0 failures; full test suites green; 8/8 CLI archives byte-identical to the CPU build (War and Peace and BIG, -0 and -6, -e4 and -e7), including 1-bit and 9-bit damage cases where CPU and GPU decoders agree; round-trip with a 1-bit flip corrected.

2. zseg: segment-parallel m5 at up to 11× — on the CPU

The second win is not a GPU win at all, and it is labelled as one here because the distinction matters. Profiling found zpaqfranz m5 using 1 of 24 cores, with its own -turbo flag doing nothing for a single file (measured below). The cheapest big win was therefore fragment-level parallelism on the CPU: split the input into N independent segments, compress each with zpaqfranz m5 in parallel, and concatenate the per-segment archives. The driver is tools/zseg.py in the zseg-driver branch of lzpaq (commit 04a8c40). Extraction was verified bit-identical in every run.

On novel text — 25,327,314 B across 635 files, mostly lzpaq source tiled:

SegmentsTime (single: 51.01 s)SpeedupOutput cost
N=88.25 s6.2×+11.4%
N=165.58 s9.2×+15.5%
N=244.65 s11.0×+18.8%

On War and Peace (3,867,266 B): single 7.69 s → N=8 1.30 s (5.9×, +15.1%), N=16 1.12 s (6.9×, +23.3%), N=24 0.99 s (7.8×, +29.7%). The cost is real and structural: every segment starts a fresh context model, so cross-segment repeats are lost and the output grows 11–30% depending on the corpus and N.

And the failure mode is stated plainly too. On repeat-heavy input — mix50, 50,709,071 B of mostly repeated content — segmenting destroys the ratio exactly where dedup does the work: N=24 manages only 3.28× (31.68 s → 9.67 s) for +249% output, and N=4 is 1.06× for +154%. Segment parallelism is a win for novel content and a bad trade for repetitive content. Use it knowing which input you have.

Two control measurements anchor the story. Multi-file -turbo is a measured no-op: War and Peace as 8 files takes 7.38 s plain, 7.57 s with -turbo -t8, 7.46 s with -turbo -t24; mix50 takes 33.48 s plain vs 34.36 s with -turbo -t24. The flag does not split one file's context-mixing work across threads. And the single-threaded baseline it beats is slow: m5 on novel text is ~0.5 MB/s, which is the subject of the next section.

3. The negative: the zpaq context mixer is GPU-hostile

The day's confirmed negative is the thing the GPU was most wanted for: the zpaqfranz method-5 context mixer itself. It does not parallelise, and the reason is structural, not a missing optimisation.

Measured first: m5 on novel text runs at ~0.5 MB/s single-threaded regardless of content type — 502 KB/s on prose, 483 KB/s on code, ~1.95 µs/byte, ~243 ns/bit. It costs 3.2–3.7× the time of m4 for ~6% smaller output, consistently (3.65×/5.8% on War and Peace, 3.21×/5.7% on code, 3.41×/5.8% on mix50). -t8 does nothing for a single file: mix50 takes 34.64 s vs 34.84 s, byte-identical archive, 23 of 24 cores idle. Decoding costs the same as encoding, because decode runs the same per-bit predictor (extract 8.71 s vs compress 7.62 s on the ×13 corpus).

The cause, from source analysis of zpaqfranz.cpp: the level-5 model is roughly 20 components, of which ~8–9 are ISSEs (indirect secondary symbol estimation), each with a 32–64 MB weight table. Every component runs per bit, per component: a hash-table lookup, then weight updates that the next bit's prediction depends on. Bit k+1's prediction depends on bit k's update — CM counts, ISSE/MIX weights, state tables, context hashes — and the arithmetic coder performs one strictly sequential 64-bit range split per bit. The 3080 Ti has the FLOPS; this workload has almost no FLOPS per byte. It is dependent pointer-chasing with a ~243 ns/bit serial chain, and each stream would need its own tens-to-hundreds-of-MB mutating model state that cannot be shared between streams. A GPU port of the same algorithm would most likely be slower than the single CPU core it replaces, before counting transfer costs. Decoding carries the identical dependency chain, so the same verdict applies to decompression.

The FEC layer is not a consolation prize either: the whole lzpaq write path (CRC16 + RS + BCH) takes ~0.03 s for a 760 KB archive at -r2 + BCH t=2 — about 0.4% of the 7.5 s m5 compression of the same content, ~0.8% at BCH t=8. GPU acceleration there is pointless; the FEC stays on the CPU. The honest GPU route to faster zpaq-class compression would be a different codec — block-parallel LZ with parallel entropy coding — not a port of PAQ, and it would not match m5's ratio, because that ratio comes from the sequential mixer.

4. Deep-repair Chase on CUDA: 171.6 s → 0.34 s

The fourth thread landed after this article first went up: deep-repair Chase on CUDA. Profiling had ranked it the best remaining GPU target — the L1 search took 181 s on one core for clustered 9-bit damage (4,194,296 trials at ~23,200 trials/s), and L2 fails at the 600 s budget — and every trial is independent. The CPU baseline was re-measured first: 171.571 s (24,446 trials/s) for one 524,265-byte BCH block (m=22, t=8, -e4), 9 errors, 4,194,296 trials, 135 codewords, 15 candidates, the original among them. The CUDA version runs the same scan in 0.335–0.379 s (11.1–12.5M trials/s) — 453–512× on the timed scan, about 190× wall-clock end to end (~0.9 s vs ~172 s including process start and CUDA context init). The work lives in the experiments/cuda-chase branch (commit 368644a).

Verification, because a fast wrong answer is worse than a slow right one: five damage patterns, all hash-matched against the CPU — including the suspect path (6 and 9 suspects) and a 10-error case where both sides agree the original is not among the candidates, because Chase-1 cannot fix t+2 errors. That is the algorithm's limit, not an implementation difference. The full test suite is green in the patched tree (bch_test 7,975/0, rs_test 6,243/0, crc16_test 530/0, run_rs_tests 61/0, run_tests 149/0, deep repair 47/0, hyper 56/0). One real bug surfaced during validation: the kernel's append order is nondeterministic, so the first CUDA run matched the CPU hash by luck and the repeat did not. The host now sorts survivors by position before verifying; three consecutive runs then gave the CPU hash deterministically.

Honest scope: t=8 only — Chase-2 is not ported. And the counts are full-scan counts: if the candidate cap were hit, the CPU stops the scan early while the GPU runs the whole scan and truncates, though the candidate set still matches. Neither limit bites the benchmark (15 candidates against a cap of 64).

Scoreboard

ThreadVerdictHeadline number
CUDA BCH remainderWorkst=32: 22.8 → 1,094 MB/s (48×); store -e7: 2.439 → 0.571 s (4.3×)
zseg segment-parallel m5Works (CPU)Novel text: 51.01 → 4.65 s at N=24 (11.0×, +18.8%)
zpaq m5 mixer on GPUNegativePer-bit sequential dependencies; ~0.5 MB/s; -t8 no-op; do not port
Deep-repair Chase on CUDAWorks171.571 → 0.335–0.379 s (453–512×); bit-identical candidates across 5 patterns

The day's lesson is a familiar one, measured rather than asserted: the GPU is a superb accelerator for the parts of this stack that are linear and independent — the BCH remainder, the Chase trials — and useless for the part that is a sequential dependency chain. The three wins ship as branches; the negative is a result in its own right, because it stops the next day being spent porting the mixer. Code: lzply (CUDA BCH: experiments/cuda-bch, Chase: experiments/cuda-chase) and lzpaq (zseg: zseg-driver).

GitHub - cnmcdee/lzply: lz compression combined with BCH Polynomial FEC. Files/mounts that can repair themselves.
lz compression combined with BCH Polynomial FEC. Files/mounts that can repair themselves. - cnmcdee/lzply
Linux Rocks Every Day