Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
7.8 KiB
5090 decode, CPU expert service, pass 2: PCIe share, the host-callback breakdown, eager admission (claude/cpu-service2)
Date 2026-11-01. RTX 5090, Ryzen 9 9950X3D, frozen corpus, upstream ranked profile, 5 turns to ~245k, seed OFF, auto slots. Base = main 11e021161 (cpu-service merged). Labels: M measured, E estimate.
Follows cpu-service-5090.
1. Result
| item | class | status | paired effect |
|---|---|---|---|
eager admission: every routed expert (24,576) admitted at CPU pool open through the same open_group checks |
lossless, bitwise (353/353) | default ON; LELEKA_CPU_ADMIT_EAGER=off = first-use admission (main) |
tok/s +4.24 % (6/6 pairs, +1.57..+6.96), ms/round -0.36 (6/6, -0.13..-0.54); +1.03-1.09 s at stack open |
AVX2 q8_k of the group's tokens + vectorized token/output finiteness checks |
lossless, bitwise (353/353) | default ON; LELEKA_Q8K=legacy |
host stage cpu.t.pre 0.13 -> 0.06 ms/round; end to end not resolvable (pc55 vs pc55L: ms/round -0.24, 5/5; tok/s -0.94 %, 1/5) |
| register-built multi-token AVX-512 IQ3 decode | lossless, bitwise (unit test) | opt-in LELEKA_IQ_MULTI=register only |
slower on Zen 5: gate/up drain 36.2 against 29.4 us per 2-token expert (bench) |
pool tasks per thread 2/4/6 (LELEKA_POOL_TASKS_PER_THREAD) |
lossless | knob, default 3 unchanged | bench: within +-2 us per expert, no consistent sign |
| PCIe share 0.45 / 0.55 / 0.65 | placement | no change proposed, no gate run | tok/s 148.9 / 148.9 / 150.3 (all inside +-1 %); ms/round 13.94 / 13.61 / 13.84 |
stage timing (LELEKA_POOL_TIMING=1, cpu.t.* spans) and the cpu.admit span |
diagnostics | off unless set (admit span: with the serve profile) |
2. PCIe share (runs/cpu-service2-pcie-ab, 20 VALID runs, one binary dt/bin-cs2, 5 rotated blocks)
| arm | all-turn tok/s (range, SD) | tokens/round mean | ms/round mean | CPU / PCIe experts per window (T3-5, w20+) |
|---|---|---|---|---|
| 0.45 (product default) | 148.9 (147.0-150.7, 1.02 %) | 2.08 | 13.94 | 31-39 / 5.4-10 |
| 0.55 (harness default) | 148.9 (146.3-151.8, 1.19 %) | 2.02 | 13.61 | 24-29 / 11.6-14.9 |
| 0.65 | 150.3 (149.6-151.7, 0.48 %) | 2.08 | 13.84 | 25-30 / 13.6-18.7 |
Paired: 0.45 vs 0.55 tok/s -0.03 % (2/5), ms/round +0.34 (5/5 worse); 0.65 vs 0.55 +0.90 % (4/5), ms/round +0.23; 0.65 vs 0.45 +0.94 % (3/5), ms/round -0.11. M.
Answer: the share does not move end-to-end tok/s in 0.45-0.65 (every difference is inside one run's spread). 0.55 has the shortest round (5/5 against 0.45) but the
others draw wider windows; per token they are equal. No default change is proposed, so no placement gate was run. What should change is the harness: run-e2e.sh exports 0.55 while the
product runs 0.45; either is fine for speed, but the measured configuration should be the product's (E: equal speed, so earlier 0.55 results stand for 0.45 too).
3. Host-callback breakdown under production load (turns 3-5, per round; runs/cpu-service2-pcie-ab pc55 runs, cpu.t.* and cpu.admit spans)
| stage | ms/round | per CPU expert or call |
|---|---|---|
| gate/up phase, host drain | 0.90-1.08 | the host's own share; workers run beside it |
| gate/up phase, wait for the last task | 0.06-0.08 | tail |
| down phase, host drain + wait | 0.32-0.38 + 0.05-0.06 | |
token quantization and checks (cpu.t.pre) |
0.06 (0.13 before the AVX2 q8_k) |
2.3 us saved per token and CPU layer |
| host requantization between the phases | 0.007 | |
output check (cpu.t.post) |
0.018 | |
first-use admission (cpu.admit) |
0.35-0.45 (T3-5); 1.3 (T1), 0.7-0.9 (T2) | 50 us each, 6-27 per round |
pool.spans / publish_plan / split |
0.13-0.17 / 0.11 / 0.05 |
CPU-only bench of the dispatch on the server (tests/cpu_service_bench.rs, 15 workers, 256 cold experts, under the GPU lock between other arms): 1 expert x 1 token 49-51 us, 2 experts 43-45 us each,
3 experts 41-43 us each = 54-57 GB/s of expert bytes, i.e. near this host's DRAM bandwidth; vanilla's PcieAuto line reports 44 us. The remaining ~61 us per expert in production is the same work under
contention (PCIe DMA of the window's other misses reads the same DRAM). Not a code lever. M.
The first-use admission was the largest host item left: mapped_span scans every block's FP16 scale of the three matrices (64,000 blocks, 2.33 MB) on the host thread, ~50 us, at the first CPU
or PCIe use of each (layer, expert) in a process. A warm-up pass on the pool workers before the scan did not help (scan 42 us warm or cold, it is not DRAM-bound); a branch-free scan saved 8 us.
So the scan moves out of the decode: DirectTier::admit_all runs the unchanged open_group admission for all 48 x 512 experts at pool open (1.03-1.09 s, once per process).
4. Identity
runs/cpu-service2-id(dt/rt-cs2):LELEKA_Q8K=legacyagainst defaults: 353/353 identical both arms, A/A 0,q_tail_gatePASS. M.runs/cpu-service2e-id(dt/rt-cs2e):LELEKA_Q8K=legacy LELEKA_CPU_ADMIT_EAGER=off(= main) against defaults: 353/353 identical both arms, A/A 0,q_tail_gatePASS. M.- Unit tests:
q8_k_avx2_is_bitwise_q8_k(400 rounds, ties of magnitude with both signs, zero blocks, rounding halves),iq3_multi_trees_are_bitwise_equal(N = 1-4, IQ3_S and IQ3_XXS).
5. Eager admission A/B (runs/cpu-service2-eager-ab, 12 VALID runs, one binary dt/bin-cs2e, 6 pairs, order alternated)
| arm | runs | tok/s T1..T5 | all-turn (range, SD) | tokens/round T1..T5 | ms/round T1..T5 | mean |
|---|---|---|---|---|---|---|
| ea-off (= main) | 6 | 138.4 155.8 160.0 144.4 145.4 | 148.8 (148.2-149.9, 0.34 %) | 2.02 2.23 2.17 1.86 2.00 | 14.56 14.29 13.54 12.88 13.78 | 13.81 |
| ea-on | 6 | 154.0 160.6 161.8 154.3 144.8 | 155.1 (152.2-159.0, 1.73 %) | 2.13 2.17 2.14 2.03 1.96 | 13.85 13.52 13.22 13.14 13.51 | 13.45 |
Pairs: +2.43, +6.26, +1.57, +6.96, +3.49, +4.70 % tok/s; ms/round -0.13, -0.23, -0.44, -0.46, -0.38, -0.54. cpu.admit 0.38-0.41 -> 0, cpu.open 0.30-0.32 -> 0.04,
pool.spans 0.13-0.15 -> 0.02 ms/round in turns 3-5. The largest effect is turn 1 (-0.71 ms/round, +11 % tok/s), where most experts are used for the first time. TTFT per turn unchanged
(e.g. 10.54/11.95/9.64/9.95/10.11 against 10.38/12.03/9.63/9.98/10.11 s). Cost: 1.03-1.09 s at stack open per process, inside the stack-open noise (12-24 s). M.
For a long-lived server the first-use cost was a warm-up transient (24,576 x 50 us = 1.2 s of decode host time spread over its first sessions); for every fresh process (and every harness run, vanilla comparisons included) it was on the decode path. E.
6. Draft round (target 3): not changed
Per round (cs-new runs of runs/cpu-service-ab, T3-5): round.draft_committed 1.46 ms = commit.wait 0.43 (the commit graph on the GPU, ~100 nodes; vanilla fuses it into one
109 us kernel) + commit.publish 0.14 + draft.finish 0.80 (mtp.finish_first_step 0.17, mtp.chain_step 0.62 at 0.95 steps per round, GPU 0.59 of it) + launches 0.05. The host part per
chain step is ~0.03 ms; the rest is GPU time of the MTP graphs and the commit graph, and the draft depth (0.95 steps per round against vanilla's ~0.4) is the adaptive window's policy. Both draft
heads use the same 106,299-token subset. No lossless host lever was found; a fused commit kernel or cheaper MTP step graphs are kernel work with their own numerics gate (docs/experiments/draft-tail-5090.md). E.
7. Build pitfall found
A worktree made on the laptop with the global core.autocrlf=true checks the sealed .ptx files out with CRLF: their SHA-256 pins fail and the binary refuses the Original serve path
(original_serve_unavailable; the first run of cpu-service2-pcie-ab and cpu-service2-id, logs in /data/leleka-e2e/cpu-service2/joblogs). Check git ls-files --eol (want w/lf) before building;
git -c core.autocrlf=false checkout -- . after removing the CRLF copies fixes it.