docs: parity audit follows the orchestrator decisions (frozen corpus, guard, queue, experimental placement arms, corrected cuBLAS attribution)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Pavlo Ratushnyi
2026-10-29 01:44:53 +01:00
co-authored by Claude Sonnet 5.5
parent 49be10eaa5
commit 402a9f852b
+25 -20
View File
@@ -23,7 +23,7 @@ ours o-def 106 / 115 / 107 / 124 / 105; vanilla v-def-t 115 / 127 / 128 / 129 /
(all of F, BW, VL, DQ, VNNI, VBMI present; `STRATA_FORCE_AVX2` is unset in every arm). Not observed at run time (no engine could be started; the engine prints no family line, vanilla prints none either).
4. Settings (c): the largest differences are the 2.1-2.3 GiB larger fixed VRAM footprint (row 3), the per-request fixed costs of the decode phase (row 4), the fixed PCIe share 0.45 against vanilla's
self-tuning 0.35 (row 5) and the instrumentation env of the harness (row 8). None is lossy. The two big items of the gap (placement, sm120 kernel switches) are rows 1 and 2, owned elsewhere.
5. Nothing in this page justifies changing a shipped default yet. One opt-in cargo profile and one A/B job script are committed; the A/B itself needs the GPU and is queued by the orchestrator.
5. Nothing in this page justifies changing a shipped default yet. One opt-in cargo profile and one A/B job script are committed; the A/B job is queued as a holder job after the decode-tail and sm120 jobs (section 6). The PCIe-share and decode-reserve knobs stay experimental flags, OFF by default, until a `q_tail_gate` result exists.
## 2. The ranked table
@@ -35,9 +35,9 @@ Rank is by estimated effect on end-to-end decode ms/token; `Lossless?` uses the
| 1 | expert placement: profile file, prompt SEED, adaptive tier | upstream ranked `data/expert-profile.bin` (sha 8f59b4aa...), no prompt seed, 96 swaps / 4 rounds, 3-8 swaps per round | harness default profile is a PLACEHOLDER (47 % overlap with the ranked top-11,280), seed ON up to 4,096 swaps, 18 swaps per round, 81 % VRAM share against 96-98 % | 0.7-1.0 ms/token (S1.3 section 4 item 1: 1.5-2.1 ms per round of the first 20 windows of every request); first r-prof run: VRAM share 95.1 % (short session, not 256k) | M (S1.3), M (`runs/decode-tail/r-prof/inference.log` last lines) | placement | dt-profile-ab, then seed-off arm N1 | DEV decode-tail |
| 2 | five sm120 kernel switches `STRATA_SIDE_MIXER=2 ATTN_DAILY GR_UP75 GR_DOWN_TG GU_SWIGLU` | ON by default on a cc 12.0 card (`include/strata/core/sm120_series.hpp`, `STRATA_SM120_PERF` unset) | old sealed PTX; ATTN_DAILY and GU_SWIGLU are committed on `claude/decode-sm120-switches` (`0ca709ca`, `0765a209`), SIDE_MIXER, GR_UP75, GR_DOWN_TG not yet | upstream's own number for the set: verify round of 4 tokens 13.70 -> 12.23 ms (-1.47, RTX PRO 5000, all experts in VRAM); at 2.13 tokens/round on the 5090 that is 0.5-0.7 ms/token (20-28 % of the gap) | S (header), E | bitwise per upstream; ours needs its own identity gate | port the remaining three, identity gate, A/B | DEV decode-sm120-switches |
| 3 | fixed VRAM footprint, hence expert slots | 12,575 slots (23.87 GiB): dense 1,466 + 2,019 MiB, MTP 835 + head 213 MiB, token embedding in mapped host memory, reserve 700 + 218 MiB | 11,280 slots (21.50 GiB): dense weights 4,578 MiB (accounted 3,890, 688 MiB unaccounted), prompt executor + MTP drafter 2,092, embedding table 324, native head 506, MoE arena 944, reserve 700 + 300 | -1,295 slots (-10 %). 0.2-0.6 ms/token (E: S1.3 slope, about 1 ms per round per point of VRAM share at the start, +1-1.5 points for +11.5 % slots with diminishing returns); never measured (the `o-s10000` slope arm was dropped) | M (sizes, logs), E (effect) | placement (cache size) | find the 2.1 GiB: (a) what `DenseWeightCache::new_original_prompt_capacity` allocates beyond vanilla's 3.5 GiB, (b) why the 688 MiB driver-over-accounted gap, (c) `select_rt_mtp` / `OriginalMtpRequest::ring_int8` 1 GiB over vanilla's drafter; then `o-s10000` slope arm | unassigned (S1.4 N3) |
| 4 | per-request fixed costs inside the decode phase | verify windows captured once per process (5 captures in the first request, none later); `decode_ms` is the verify loop | `decode.assemble` 69 ms + `decode.disassemble` 11 ms + `decode.seed_ple` 21 ms per request, `decode.phase` 2,575-3,013 ms against `decode.serve` 2,437-2,886 ms (4.4-5.7 %); first request also `record.modules` 133 ms. Before decode: `prefill.seed` 168-260 ms + `prefill.refill` 307-419 ms per request | up to 0.3 ms/token-equivalent (3.4 % of `decode.phase` for 300 tokens) IF the owner's tok/s counts the phase; 0 if it counts the verify loop. For the real agent workload (1-3 s decodes per turn) it is a per-turn cost either way | M (`runs/s1-decode/o-def/inference.log`, `DBG profile request` lines) | lossless | verifier persisted across requests (`docs/decode-parity.md`, "Verifier persistence: not done"); overlap the lent-slot refill with the first decode window | unassigned (needs a design) |
| 4 | per-request fixed costs inside the decode phase | verify windows captured once per process (5 captures in the first request, none later); `decode_ms` is the verify loop | `decode.assemble` 69 ms + `decode.disassemble` 11 ms + `decode.seed_ple` 21 ms per request, `decode.phase` 2,575-3,013 ms against `decode.serve` 2,437-2,886 ms (4.4-5.7 %); first request also `record.modules` 133 ms. Before decode: `prefill.seed` 168-260 ms + `prefill.refill` 307-419 ms per request | up to 0.3 ms/token-equivalent (3.4 % of `decode.phase` for 300 tokens) IF the owner's tok/s counts the phase; 0 if it counts the verify loop. For the real agent workload (1-3 s decodes per turn) it is a per-turn cost either way | M (`runs/s1-decode/o-def/inference.log`, `DBG profile request` lines) | lossless | verifier persisted across requests (`docs/decode-parity.md`, "Verifier persistence: not done"). Small fixes examined and NOT made: the instantiate-update of the parked executables was tried (`6fa92c13`) and reverted (`c45bcaaf`: the stack went Broken in the cancellation smoke of job 804; it saved ~21 ms); `seed_ple_history` copies only 368 KB (`9 * 10240` f32), so its 21 ms is a synchronous copy that waits for work still in flight on the stream (the queued lent-slot refill is one candidate), which a trace has to confirm before any change | unassigned (needs a design) |
| 5 | PCIe share of missed experts | probes the link (47.5 GB/s) then `PcieAuto` refines from the CPU pool's speed: 43 us per missed expert -> 0.35 (v-def-t and v-nsk-prof logs, `generate.cpp:3600-3660`) | fixed 0.45 (`original_serve_residency.rs:171`, job-909 optimum), `LELEKA_PCIE_AUTO` off ("no better than the best fixed share", `docs/decode-parity.md`) | 0-0.25 ms/token (E: `docs/decode-parity.md` measured +4.7 % for 0.45 against 0.55 at the auto cache, +5.8 % for the Original at 0.35 against 0.55; ours misses 4.0 entries per layer-window against 0.8 so the optimum may differ). Sign unknown | S, M (vanilla logs) | placement (which device rounds the expert) | arm `pa-pcie35`, `pa-pcie40` (section 6); no code change before | orchestrator queue |
| 6 | cuBLAS GEMMs inside the verify window | none (no `gemm`/`cutlass`/`cublas` kernel in `/data/leleka-e2e/decode/t1/vanilla.tsv`) | 10 cuBLAS kernel families from `libcublas.so.12` 12.9.1.4, `cutlass_80_*` (sm80 kernels on an sm_120 card) and `splitKreduce`: 0.25 ms per round, 0.5-16 launches per round per family (`t1/oldports.tsv`); callers `gdn_native_batch.rs:296`, `ple_batch_ffi.rs:158,244,321,373` | at most 0.12 ms/token (0.25 ms/round of kernel time; fully removing it gains less) | M (CUPTI window, DEV decode-sass), S | unknown: another GEMM kernel changes the accumulation order, so a bitwise gate is needed | replace by the vanilla-style custom projections (`native_mmvq_il`, `gdn_*` kernels), or test cuBLAS 13.x (`libcublas.so.13` is in `~/cuda-toolkits/13.2.2/lib64`) behind an identity gate | DEV decode-sass |
| 6 | cuBLAS GEMMs in the per-round kernel table of ours | none (no `gemm`/`cutlass`/`cublas` kernel in `/data/leleka-e2e/decode/t1/vanilla.tsv`) | 10 cuBLAS kernel families from `libcublas.so.12` 12.9.1.4, `cutlass_80_*` (sm80 kernels on an sm_120 card) and `splitKreduce`: 0.25 ms per round, 0.5-16 launches per round per family, next to `leleka_prefill_dequant_q6_k` (0.23 ms per round, 70 us each) in `t1/oldports.tsv`. **Where they are launched is NOT established:** every cuBLAS caller found (`ple_batch_ffi.rs` `Blas`, `native_batch_workspace.rs:41`, the `GdnGemm` adapter) and the dequantizer belong to the prompt-path code (`prefill_stage*`), and the ours `.lct` behind that table is no longer on the server (only `t1/vanilla/win-turn5.lct` is), so I could not tell whether they run inside a verify round or in the prompt part of the 20 s window | at most 0.12 ms/token if they are in the verify rounds, 0 if they are prompt-path kernels; with the dequantizer 0.22 ms/token (E) | M (table, DEV decode-sass), S | unknown: another GEMM kernel changes the accumulation order, so a bitwise gate is needed | first decide membership: `decode_rounds.py --nodes` on the `decode-sass-trace2` ours trace (job in the holder queue) or a CUPTI arm; only then a fix (vanilla-style custom projections, or cuBLAS 13.x behind an identity gate) | DEV decode-sass |
| 7 | PTX precise math where vanilla compiles `--use_fast_math` | `native_*.cu` (14 files), `strata_mmq`, `strata_kq` with `--use_fast_math`; the rest default flags (`CMakeLists.txt:594`, 1989, 2038, 2065) | all sealed PTX: `nvcc --ptx -O3 -arch=sm_120 --fmad=true --ftz=false` (`scripts/build-original-verify-ptx.sh`); the seal plan lists the affected assets (`docs/cuda-seal-plan-additions.json` `flags_policy_audit`, `-window.json` `numerics_risk_fast_math`) | instruction count of the same-named activation quantizers: `quantize_q8_1` 248 against 104, `quantize_mmq_q8_1` 1.5-2.2x, `quantize_mmq_mxfp4` 3-3.4x (`decode/join3.tsv`). These kernels are 0.9-1.1 us each: at most 0.1-0.15 ms/token, probably a third of that | M (instr counts), S | re-sealing with fast-math moves ours TOWARD the Original's bits, so it is a parity fix; needs the per-kernel golden compare | re-seal the listed assets with `--use_fast_math` with the pinned toolkit 13.0.88, GPU golden compare, A/B | DEV decode-sass |
| 8 | instrumentation env of the harness | `STRATA_DECODE_TIMING`/`VERIFY_PROFILE` only in the timed arms; the untimed default is clean | `scripts/e2e/run-e2e.sh` exports `LELEKA_SERVE_PROFILE=1`, `RUST_BACKTRACE=1`; the arms add `LELEKA_BRINGUP_TRACE=1` (one 700-byte `DBG window` line per round) and `LELEKA_PREFIX_TRACE=1`; the `LELEKA_GRAPH_EXEC_REUSE=off` the script also exports is read by no crate (dead) | at most 0.05 ms/token (E: log-only, `lib.rs:4-17`, `original_serve_profile.rs`: one `Instant` pair per span) | S | lossless | arm `pa-notrace` | orchestrator queue |
| 9 | CPU IQ/Q2 expert kernels: Rust (rustc/LLVM) against C++ (GCC 11.4, `-O3`) | `iq_avx512.cpp` etc., runtime `cpu_avx512_ok()` | `rust_iq.rs`, `rust_q2.rs` etc., runtime `avx512_ok()`; `half`, `prefetch`, `hsum`, `signs32` are inlined (no symbols); `dot_multi512` is one 74 KB function with all 5 formats x 8 token counts; AVX2 `dot_single` / `dot_multi256` call a non-inlined `decoded` and a runtime `match t` per 32 values and bounce the grid words through a stack array (store-forward stall), bounds checks in the block loop | per CPU entry 37 us (port) against 35 us (Original) = +6 % (`docs/decode-parity.md` finding 3, job 980, Rust kernels since the 2026-10-14 import). At most 0.1 ms/token (E: CPU leg is DRAM-bound, `docs/roofline.md`) | M (old head), S, B | lossless (bitwise tests exist: `native_expert_parity`) | const-specialise `dot_single` / `dot_multi256` on the format like `dot_multi512_tn`; compare with `native_expert_parity --bench` on the server when the GPU is free | unassigned, low |
@@ -77,6 +77,7 @@ unknown-until-q_pair by the S6.1 audit; they are not gaps and are not touched he
* The AVX-512 path was not observed executing. `perf` is unavailable to the user (`perf_event_paranoid` 4) and no engine could be started. The static evidence is the code in the binary plus the CPUID gate.
* The cause of the 688 MiB difference between accounted and driver-seen device bytes in the dense-weights stage, and of vanilla's smaller prompt/MTP footprint, is not identified (row 3).
* The cuBLAS / `dequant_q6_k` kernels of row 6 may belong to the prompt path; the first version of this page called them verify-window kernels, which was an inference from the per-round table, not a fact.
* The sign of rows 5 and 12 is unknown; every "impact" is an estimate. The r-prof VRAM share (95.1 %) is from a short session.
* JIT behaviour on a cold machine (`~/.nv/ComputeCache` is 164 MiB against the documented 256 MiB default `CUDA_CACHE_MAXSIZE`): adding the remaining sm120 PTX modules can push it over the limit and re-JIT at every
start. Start-up time only; set `CUDA_CACHE_MAXSIZE` in the service unit and the harness when the new modules land. Not measured.
@@ -84,28 +85,32 @@ unknown-until-q_pair by the S6.1 audit; they are not gaps and are not touched he
* The KAR memfd (51.5 GiB) is swappable in the harness (`RLIMIT_MEMLOCK` 8 MiB; the product unit sets `LimitMEMLOCK=infinity`). Available memory fell to 8-13 GiB during o-def; a swap-in during decode would
appear as a slow CPU leg. Swap was 0 B used when I looked. Arms should run with the lock or with at least 20 GiB available.
## 6. What was done and what to queue
## 6. What was done and what is queued
Committed on `claude/parity-audit`:
* `22bb8366` `Cargo.toml`: opt-in `[profile.release-lto]` (fat LTO, one codegen unit). Default builds unchanged. `cargo metadata --offline` passes. Not built (the server has no cargo; the laptop cannot build the CUDA binary).
* `e977669a` `scripts/e2e/decode/parity-audit-ab.sh`: the paired A/B holder job. Arms: `pa-base`, `pa-pcie35`, `pa-pcie40`, `pa-notrace`, `pa-dres100`, `pa-gather`, `pa-lto`. Same base as `o-def`
(pinned `bin-e2e4`, the 5-turn 245k session, `--max-output 300`), with the RANKED upstream profile (`/data/leleka-e2e/decode/assets/expert-profile-upstream.bin`), one variable per arm.
* `22bb8366` `Cargo.toml`: opt-in `[profile.release-lto]` (fat LTO, one codegen unit). Default builds unchanged. `cargo metadata --offline` passes. Not built: the server has no cargo and the laptop cannot build the CUDA binary, so the `pa-lto` arm is skipped.
* `49be10ea` `scripts/e2e/decode/parity-audit-ab.sh`: the paired A/B holder job (replaces `e977669a`).
Exact command (a holder job: it needs the sealed memfd fd like `dt-profile-ab.sh`; start only after the DEV decode-tail arms, one arm at a time, it takes `gpu.lock` itself):
The job (queued 2026-10-29 by the audit agent under the orchestrator's decision; no second holder):
```
cp <repo>/scripts/e2e/decode/parity-audit-ab.sh ~/work/gpu-runs/holder2/jobs/parity-audit-ab.sh # holder queue, like dt-profile-ab.sh
ARMS="pa-base pa-pcie35 pa-base pa-pcie35 pa-base pa-pcie35" bash ~/work/gpu-runs/holder2/jobs/parity-audit-ab.sh
# then, same pattern: pa-base vs pa-notrace, pa-base vs pa-dres100, pa-base vs pa-gather; pa-lto needs LTO_BIN=<dir of a release-lto build>
```
* Server tree, all under `/data/leleka-e2e/parity-audit/`: `jobs/parity-audit-ab.sh` (a copy of the committed script), `bin-e2e4/` (hardlinks of the DEV decode-tail copy of the pinned binaries, sha256 `730a956a...`), `scripts/e2e/` and `tools/long-session.py`
(copies of the DEV decode-tail guarded versions: ranked-profile guard in `run-e2e.sh`, empty-corpus and `--min-final-tokens` guard in `long-session.py`; `W` pointed at `/data/leleka-e2e/parity-audit/w`), `w/` (run state).
Outputs: `/data/leleka-e2e/runs/parity-audit/<arm>-r<n>/`.
* Queue stub `~/work/gpu-runs/holder2/jobs/parity-audit-ab.sh` (`exec bash /data/leleka-e2e/parity-audit/jobs/parity-audit-ab.sh`, the same pattern as `dt-ab3.sh`; the holder's queue directory is the only thing outside `/data/leleka-e2e`),
and ONE line in `jobs/PRIORITY`, directly after `sm120-e2e-ab`, i.e. last of the priority list (order now: `dt-ab3`, `dt-profile-ab`, `sm120-replay-id`, `sm120-e2e-ab`, `parity-audit-ab`). Backup of the file before the edit: `jobs/PRIORITY.bak-pa`.
* Workload: the frozen corpus `/data/leleka-e2e/decode/corpus/src/crates` (`MANIFEST.txt`, sha256 `1152f45a...`), 5 turns, `--target-tokens 245000 --max-output 300 --min-final-tokens 200000`. The old `~/work/leleka-head` corpus is gone
(a run on it is a ~300-token session; the first version of this job used it and was never queued). Every arm gets a `VALIDITY.txt`: `VALID` only when all 5 turns completed and the final-turn input tokens are >= 200,000, otherwise `INVALID`
and the summary ignores it. Comparisons are ours against ours on this corpus only; numbers from before the corpus freeze are not comparable to them.
* Arms and order (default `ARMS`): `pa-base pa-pcie35` x3 (three pairs), then `pa-notrace pa-base pa-dres100 pa-base pa-gather pa-base`: 12 engine starts, about 11-12 minutes each including the ~9-minute load, one arm at a time under `gpu.lock`.
`pa-pcie40` is available but not in the default list; `pa-lto` is skipped.
* Experimental status: `pa-pcie35`, `pa-pcie40`, `pa-dres100` change placement (which device computes a missed expert, how many experts are resident). They are experimental flags, OFF by default in the engine, the deploy profiles and the harness,
and stay off until a `q_tail_gate` result exists for them (S6.1 finding F4: no 256k `q_pair` log exists yet). `pa-notrace` and `pa-gather` are lossless-class.
* Result: the job prints per-turn decode tok/s of every VALID run and the per-turn mean difference of every arm against the `pa-base` runs. Acceptance for a default change stays AGENTS.md's: paired A/B on the same workload with the spread of
`pa-base` as the noise, the quality result, and the recorded environment (`env-arm.txt` in every arm directory).
Cost: 6 arms for the first pair, about 11-12 minutes each including the 9-minute load (the load is the engine's, not the arm's), one arm at a time. Order by value: `pa-pcie35` / `pa-pcie40` first (config only, row 5), then `pa-notrace`.
Acceptance (AGENTS.md): per-turn mean of 3 interleaved repeats against `pa-base`, spread of `pa-base` itself as the A/A noise, the quality gate for the placement-class arms (`scripts/quality/q_pair.py` on teacher-forced logs at 256k: none exists yet,
S6.1 finding F4), and the full record of hardware, driver, model digest, env and cache state from `env-arm.txt`. Until then no default changes.
Not implemented on purpose: row 1 and 2 (other agents), row 3 (needs the allocation audit first), row 4 (design), row 5 and 11 (placement: A/B first), row 7 (needs the 13.0.88 toolkit and a GPU golden compare), row 6, 9, 12, 13.
Small lossless fixes (orchestrator item 5): none made. Row 4: the instantiate-update fix was tried before and withdrawn, the `seed_ple` cost needs a trace, the rest is verifier persistence (a design, not a small change).
Row 6: the cuBLAS kernels' membership in the verify rounds is unproven, and the only callers are prompt-path code. Rows 5 and 11 are placement knobs and are A/B only.
## 7. Commands run (all read-only; server only under `ssh rnr5090`, nothing created there)
@@ -123,4 +128,4 @@ grep over /data/leleka-e2e/runs/s1-decode/{o-def,v-def-t,v-nsk-prof}/{inference,
cargo metadata --no-deps --offline --format-version 1 # laptop, in the worktree: profile parses
```
Paths created by this task: laptop `C:\Users\pavel\work\leleka\.git\wt\parity-audit` (worktree, branch `claude/parity-audit`) and the scratch copy of four server TSV files under the session scratchpad. Server: none.
Paths created by this task: laptop `C:\Users\pavel\work\leleka\.git\wt\parity-audit` (worktree, branch `claude/parity-audit`) and the scratch copy of four server TSV files under the session scratchpad. Server: `/data/leleka-e2e/parity-audit/` (section 6), `/data/leleka-e2e/runs/parity-audit/` (created by the job), the queue stub and `PRIORITY.bak-pa` in `~/work/gpu-runs/holder2/jobs/`, and one appended line in `/data/leleka-e2e/decode/notes.md`.