Files
leleka/docs/experiments/2026-10-03-ple-cache-batch-capacity.md
T
Pavlo Ratushnyi 4013e0c9bd
Desktop foundation / core (ubuntu-latest) (push) Failing after 28s
Desktop foundation / core (macos-latest) (push) Canceled after 0s
Desktop foundation / core (windows-latest) (push) Canceled after 0s
Linux / verify (push) Canceled after 0s
Linux / keyless-cuda (push) Canceled after 0s
Linux / static-cuda-package (push) Canceled after 0s
Linux / hosted-cuda-package (push) Canceled after 0s
Linux / linux-static-cli (push) Canceled after 0s
Linux / linux-cli-container (push) Canceled after 0s
Linux / release-cli (push) Canceled after 0s
Import tracked Strata Next source snapshot
2026-10-05 18:15:08 +02:00

2.8 KiB

PLE cache batch capacity and serving boundary, 2026-10-03

Capacity guard

The bounded CUDA PLE row probe now checks the number of distinct rows in each decode batch against its slot count before changing the LRU cache. An accessed row becomes most recent, so ordinary LRU preserves every row named by a batch while the batch has at most one distinct row per slot. Without the capacity check, an overfull batch could reuse a slot still named by an earlier output position and silently decode the wrong row. The previous probe's batches had at most 128 rows and its minimum 1 MiB cache had 16,384 slots; this guard does not change those earlier results. A slots:N argument allows a small capacity to test the boundary without allocating 1 MiB.

On the Linux RTX 5090 with CUDA 13.2.86 and driver 595.91.07, the private Qwen3.8-Flash-Next KAR v4 archive was opened with payload CRC verification. The 4-slot trace 0 1 2 3, 0 4 5 6, 6 5 4 0 completed 12 row accesses with 5 hits, 7 misses, and byte-exact CUDA/independent CPU decoded output in all three batches. Its output hash chain was 3d7ceb5de9b5faf6. A separate 5-distinct-row batch with the same 4 slots exited with the explicit a batch needs more distinct rows than cache slots error. Both runs performed the archive's full payload CRC pass; the valid run recorded 87,635 ms for that pass. The code was compiled with nvcc -std=c++17 -arch=sm_120 -O2.

The probe accepts --trust-previously-verified-archive as an explicit final argument for repeated development runs. It still parses and checks the KAR directory but skips the full payload CRC pass. Its output states payload_crc_verified=no; the default remains full verification. This option is only for a probe against an archive verified earlier in the same experiment. It is not a serving integrity policy. Repeating the valid trace with the final source and this option took 2.171 ms to open the archive and again produced exact CPU parity and hash chain 3d7ceb5de9b5faf6. The overfull trace exited with the same error in this mode.

Serving handoff

Three engine consumers require PLE rows. Decode computes 16 row IDs in ple_issue_token and transfers 2,560 F32 values to PleRun::emb_dev in ple_finish_token. Prefill gathers 16 IDs per token into one of two pinned host buffers, then uploads each chunk to m.ple_emb. Speculative verification gathers candidate rows into mapped host memory h_ple_, which its captured graph reads. A serving CUDA cache must cover all three paths or keep an explicit, quality-checked CPU fallback for verification. It must split a prefill batch before its distinct-row count exceeds available slots, preserve the lifetime of asynchronous upload buffers, and account for expert and KV headroom before allocating VRAM. No serving path uses this probe yet; no end-to-end speed or model-quality result is claimed here.