Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
28 KiB
5090 decode at 245k: the GPU time of the MTP draft round, where it goes and what was cut without changing a bit (claude/draft-round)
Date 2026-11-02. RTX 5090 (32 GB), Ryzen 9 9950X3D, driver 595.99, CUDA 13.2 toolchain, server rnr5090, one heavy job at a time under /data/leleka-e2e/gpu.lock, sealed KAR memfd held by the holder.
Base = main 1416973a9 (code of ffd9322c7 outside docs/ and scripts/). Workload of every run: the frozen 245k corpus, 5 turns, --max-output 300, final-turn input 246,862-247,022 tokens,
PCIe share pinned 0.45 (product default), seed off, upstream ranked profile, auto slots, LELEKA_CHAIN=all, prefix cache auto, spec-min-p 0; vanilla lossy defaults are not involved (this task compares ours with ours).
Labels: M measured in the run named, E estimate. Follows cpu-service2 section 6 ("draft round (target 3): not changed").
1. Result
| item | class | status | effect (paired, same workload at 245k, adaptive window as shipped unless said) |
|---|---|---|---|
MTP draft attention = upstream attn_chunk_kernel_pre75 + attn_merge_v2 (LELEKA_SM120_ATTN_DAILY_MTP=1, existed, never run on a GPU) |
bitwise (2057/2057 rows, 1036/1036 draft traces) | enabled in the rtx5090-32g profile by a separate commit (5378b226d); engine default stays off |
step graph 622 -> 475 us, round graph 806 -> 663 us; draft_committed -0.29 ms; whole round -0.37 ms (-2.7 %), 12 of 12 blocks; tok/s +0.5 % +- 0.6 % (n.s., the adaptive window narrows by 2.4 % rows); +3.0 %, 5 of 5 blocks, with the window held fixed |
fused verifier commit graph (LELEKA_DRAFT_FUSED_COMMIT=on) |
bitwise (byte-for-byte probe, same replay gate) | opt-in, off: neutral | 182 -> 4 nodes, GPU 516 -> 125 us; round time -0.024 +- 0.046 ms (it is not on the critical path); gives the host 0.38 ms of slack against the first draft graph |
LELEKA_TRACE_DRAFT=1, profile/A-B/identity tooling, probe |
instrumentation | merged with the branch |
Where the 1.46 ms went (profile, section 2): the commit graph was not the problem (off the critical path, 4 us of host time); the draft is a GPU-bound chain of one round graph (806 us) and 0.9 step graphs (622 us), a third of which is the draft head and
the sampler scans (not shortenable bitwise) and a third the attention (shortened). The quantities the task listed that this work does not move: deeper drafting is the adaptive window's policy (and it moves against a faster draft, section 5), the end-of-window sync
(drv.sync_compute 0.46 ms) is the window's GPU time itself, the swap-copy wait (apply_pending 0.2 ms) is the tier adaptation's.
2. Where the draft round goes (M, runs/draft-round-prof2, CUPTI window over turn 5, main binary bin-main-ffd9322)
One CUPTI window (20 s, 156 rounds, scripts/e2e/decode/draftround-kernels.py). A round launches three kinds of small graphs after the verify window: the commit graph (once), the MTP round graph (the first draft
step with the catch-up of the accepted rows, once, 155-173 kernels by row count) and the MTP step graphs (the chain, 0.84 per round, 113 kernels each).
GPU spans (CUPTI inflates kernel times by about 10 % against event timing; the shares are what matter):
| graph (per round) | kernels | GPU span | what dominates it |
|---|---|---|---|
| commit, 1x | 182 | 516 us (kernel sum 417) | verify_gdn_step_norm_multi_kernel 36 x 6.7 = 240 us, verify_qsa_append_analytic 96 x 0.97 = 94 us, verify_gdn_conv_commit_kernel 36 x 1.6 = 58 us, 12 tail restores 18 us |
| MTP round graph, 1x | 155-173 | 806 us | head_n14_s0 (draft head, 106,299 rows) 142, chain_qsa_decode_merge_n 125, leleka_qsa_decode_chunk 109, mtp_original_finite guards 59 x 1.1 = 64, mtp_scalar_gr_staged 3 x 17 = 52, head_n8_s0 4 x 10.6 = 42 |
| MTP step graph, 0.84x | 113 | 622 us | head_n14_s0 141, chain_qsa_decode_merge_n 117, leleka_qsa_decode_chunk 102, head_n8_s0 4 x 9.5 = 38, guards 41 x 0.74 = 30, mtp_scalar_gr_staged 2 x 13 = 27 |
What the tracer distorts. CUPTI instruments every driver call: the launch calls and the gaps between graphs in its timeline (commit launch call starting 62 us after the window, the round graph's first kernel 315 us after it, launch calls of
82-126 us, 124 us between steps) are the tracer's. The same host spans of untraced runs (runs/draft-round-ab1, arm a, ms per round): drv.commit_enqueue 0.004, window graph launch (drv.launch) 0.008, draft.launch (staging + launch of the round
graph) 0.027, a chain step 0.594 wall against 0.563 of GPU time (events), i.e. about 30 us of host per step. Kernel durations are close (step 622 us in CUPTI against 563 us with events, +10 %); the shares and the order of the kernels are what the
tables use. Read from the trace and the untraced spans:
- The commit graph is not on the draft's critical path: the draft stream no longer waits for it (decode-tail), and its 516 us end about a millisecond before the draft does (draft end - commit end: 1,066 us in the window). Its host cost is 4 us per round untraced. So the task's "fused commit kernel" cannot pay through the launch (nothing to save) nor through the critical path; the only way left is the GPU-side contention of its 226 MB of GDN state traffic with the draft. The A/B below isolates it.
- The draft's GPU chain is the critical path: round graph + 0.9 x step graph + about 30 us of host per step is the
draft_committedspan (1.44 ms untraced), of which the host's own work (publish 0.14, adaptive queue 0.08) is hidden in the first graph. - About a third of every MTP graph is two kernels that nothing in a bitwise-identical port can shorten: the draft head (
head_n14_s0: 223 MB of Q6_K rows streamed at 1.58 TB/s, 88 % of what the card sustains) and the 106k-logit argmax and top-probability scans (single-block kernels, 9.5 + 8.1 us). - The attention is the item that was not at its floor: the Original's chunk kernel and
chain_qsa_decode_merge_ntake 102 + 117 us of a 622 us step. The tree already carries the upstream replacements (sm120_attn_daily.cu:attn_chunk_kernel_pre75+attn_merge_v2, byte-identical to the Original's by the model-free probe of tools/decode-sm120) as the opt-inLELEKA_SM120_ATTN_DAILY_MTP=1("not run on the GPU yet"); on the verify window the same kernels measured no end-to-end gain (a741f8e54), on the MTP step they replace 219 us by 70.
After the changes (M, runs/draft-round-prof4, final binary bin-dr2, both switches on, same window; runs/draft-round-prof3 has the attention switch alone):
| graph (per round) | before (prof2) | attention switch alone (prof3) | both switches (prof4) |
|---|---|---|---|
| commit graph: kernels / GPU span | 182 / 516 us | 182 / 497 us | 4 / 125 us (draft_commit_gdn_layers 113 us, draft_commit_qsa_layers 5 us, 2 copies 7 us) |
| (tracer timeline, launch calls inflated) verify end -> commit first kernel | 155 us | 160 us | 72 us |
| (tracer timeline) verify end -> first kernel of the MTP round graph | 315 us | 324 us | 230 us |
| MTP round graph GPU span | 806 us | 663 us | 585 us (run-to-run, the row mix differs: the guard kernels average 0.76 us here, 1.09 us in prof2) |
| MTP step graph GPU span (113 kernels) | 622 us | 475 us | 473 us |
| attention in a step: chunk + merge | 102 + 117 us | 49 + 21 us | 55 + 21 us |
| draft end - commit end | 1,066 us | 843 us | 1,279 us |
The step graph is now 473 us of which head_n14_s0 is 141 us (30 %), the attention 76 us, the 41 guards 31 us.
3. Changes (all bitwise; each behind its own switch)
| item | class | switch | what it does |
|---|---|---|---|
MTP draft attention = upstream attn_chunk_kernel_pre75 + attn_merge_v2 |
lossless, bitwise | LELEKA_SM120_ATTN_DAILY_MTP=1 (existing since d6aee34af, opt-in, "not run on the GPU yet" until now) |
step graph 622 -> 475 us, round graph 806 -> 663 us (M, runs/draft-round-prof3): chunk 102 -> 49 us, merge 117 -> 21 us; about 0.27 ms of GPU time per round. First GPU runs of this switch: identity below. |
| fused verifier commit graph | lossless, bitwise | LELEKA_DRAFT_FUSED_COMMIT=on (new, opt-in, sm_120 only: record_commit fuses only on cc 12) |
182 nodes -> 4 (DBG graph commit nodes=Some(4)): the first mapped copy, one launch for all 36 GDN layers (draft_commit_gdn_layers, grid (48 heads + 20 conv blocks, 36 layers)), one for all 12 QSA layers (draft_commit_qsa_layers, one block per layer, rows in order) and the PLE history copy. GPU time of the graph: 516 -> 125 us in the profile (probe: GDN part 346 -> 156 us, QSA part 72 -> 4.5 us). It is not on the draft's critical path and its host cost is 4 us per round (section 2), so no end-to-end effect is expected; ab3 isolates it. |
LELEKA_TRACE_DRAFT=1 |
instrumentation | env | one DRAFT position=.. accepted_row=.. cell=.. ids=[..] pbits=[..] line per completed draft: the ids and the IEEE bits of the probabilities, so the draft's numerics can be diffed across builds and settings |
| tooling | draftround-ab.sh (paired ours-vs-ours blocks and the CUPTI profile run), draftround-kernels.py (per-kernel table of commit / round / step graphs), draftround-analyze.py, draftround-id.sh + -idcmp.py (replay gate with the draft trace), tools/draft-round/commit_probe.cpp (model-free probe) |
How the fused commit stays bitwise (and where it is deliberately not a copy):
- The Original's replay computes, for every accepted token, the layer's output as well (the
odot products, the RMS norm, the gatedywrite into a scratch region namedy_dummythat nothing reads). That path never feeds the recurrence state, so the fused kernel does not compute it; the state words come from the samefmafchain, the same four-wayred[]sum and the samedeltaexpression in the same order. The state-independent loads of all accepted tokens (key vector, value, gate, beta) are issued before the token loop instead of inside it; one barrier per token (double-buffered reduction) instead of four. - The conv history update runs as 20 extra blocks per layer of the same launch (it reads the qkv rows and the old history, writes only the history).
- The QSA part is built with
--use_fast_mathlike the resealedoriginal_verify_qsa.ptx(the Original compilesnative_qsa_indexerfast-math, docs/gpu-bringup.md D6): a first version built with the precise recipe oforiginal_verify.cudiffered from the Original in about 1 % of the pooled-key words (powf/cosf/sinfagainst__powf/cos.approx/sin.approx) and the probe caught it before any model run; the GDN part stays precise likeoriginal_verify.cu, which is not on the fast-math list. - Per-layer addresses: the GDN operands are affine in the layer (canonical state/history,
qkv_L,h_L,gate_L,beta_L; the recorder checks layers 1, 17 and 35 against the per-layer spans before it binds the base address), the QSA ones are a 12 x 5 table of the same spans the per-layer commands bind. A QSA with retained angle tables (not the product) keeps its per-layer commit. - Assets:
draft_commit.cu/.ptxanddraft_commit_qsa.cu/.ptx, sealed withscripts/gpu-bringup(extra-seal-plan.json, groupdraft-round, nvcc 13.2.86, SHA-256 pins inoriginal_verify_window_draft.rs);ptx-sm86/MANIFEST.jsonlists both as not built for sm_86 (by design: the switch exists on cc 12 only).git ls-files --eolshowsw/lffor all.ptx.
4. Identity (M)
Model-free probe (tools/draft-round/commit_probe.cpp, on the RTX 5090, /data/leleka-e2e/draft-round/probe/probe-result.txt): the sealed Original kernels (original_verify.ptx, original_verify_qsa.ptx) run next to the fused ones on real-size
random inputs, every output byte compared: GDN 36 cases (n_keep 0..8 x 4 seeds, state and history of all 36 layers), QSA 60 cases (n_keep 1..8, holes, positions 0..103 around the 4-cell block edges, three RoPE settings incl. YaRN):
PROBE OK: every output byte identical. In a graph: GDN 346 -> 156 us, QSA 72 -> 4.5 us.
Replay gate (runs/draft-round-id1, rt-dr1; teacher-forced replay of night5-long-256k, 5 requests of 240 forced decode tokens, production shape, ADAPT_EVERY=4 (the adaptive tier swaps), seed off, one process per setting, two identical arms per process;
compared: the top-16 logprob rows of every window row, and the draft trace = ids and IEEE bits of the probabilities of every draft, 518 drafts per arm):
process (all against the defaults process idP1) |
logprob rows | draft trace lines | argmax flips |
|---|---|---|---|
LELEKA_SM120_ATTN_DAILY_MTP=1 |
2057 / 2057 identical | 1036 / 1036 identical | 0 |
LELEKA_DRAFT_FUSED_COMMIT=on |
2057 / 2057 identical | 1036 / 1036 identical | 0 |
| both | 2057 / 2057 identical | 1036 / 1036 identical | 0 |
| A/A (arm 2 against arm 1 inside each process) | 2057 / 2057 | 518 / 518 | 0 |
q_tail_gate PASS for all four processes (d_top1 max 0.0000).
Gate 2, the committed code (runs/draft-round-id2, rt-dr2 = 28d74a2ef, both switches on, against the defaults reference of gate 1 built from rt-dr1: two different binaries): 2057 / 2057 logprob rows and 1036 / 1036 draft-trace lines identical, 0 argmax flips, A/A exact.
Limits: 5 requests of 240 forced tokens (1,207 rows per arm after the prompt rows), production shape; the replay is teacher-forced, so what it proves is the equality of the numerics of the draft (ids and probability bits at every step), of the verifier windows
that follow the fused commit's state, and of the tier-swap path (ADAPT_EVERY=4); it does not run the sampling paths other than greedy. The model-free probe covers the commit state byte for byte, which the logprob rows cover only through their effect.
5. Paired A/B at 245k (M, runs/draft-round-ab1, 12 blocks, 24 VALID runs, one binary dt/bin-dr1)
a = defaults (= main's behaviour: both switches off), b = LELEKA_SM120_ATTN_DAILY_MTP=1 LELEKA_DRAFT_FUSED_COMMIT=on; PCIe share 0.45, seed off, adaptive window, --spec-min-p 0, frozen corpus, 5 turns of 300 tokens, order alternated by block
(odd blocks a then b, even b then a), both arms of a block back to back; validity rules of the baseline-pair series (5 turns, final-turn input >= 200k tokens, turn-5 window.ple < 5 ms; all 24 runs valid).
tok/s = tokens over seconds of the five decode windows; tok/round = tokens over the request outcome lines' rounds; ms/round = decode seconds over rounds.
| block | order | a tok/s (T1..T5) | b tok/s (T1..T5) | b - a tok/s | a / b tok/round | a / b ms/round | b - a ms/round |
|---|---|---|---|---|---|---|---|
| 1 | a b | 153.5 (159 153 155 152 149) | 152.2 (161 155 164 146 139) | -1.3 | 2.072 / 1.987 | 13.497 / 13.052 | -0.445 |
| 2 | b a | 154.0 (158 152 161 152 148) | 159.7 (161 155 165 154 164) | +5.7 | 2.080 / 2.116 | 13.508 / 13.244 | -0.264 |
| 3 | a b | 157.9 (159 163 174 142 155) | 154.8 (161 155 164 145 150) | -3.1 | 2.161 / 2.038 | 13.688 / 13.164 | -0.524 |
| 4 | b a | 155.5 (160 151 175 149 146) | 154.6 (157 153 155 147 162) | -0.9 | 2.083 / 2.011 | 13.398 / 13.009 | -0.389 |
| 5 | a b | 153.3 (159 154 158 149 147) | 156.9 (158 152 164 158 154) | +3.6 | 2.058 / 2.072 | 13.425 / 13.203 | -0.222 |
| 6 | b a | 153.9 (159 154 158 147 152) | 158.2 (161 155 169 157 151) | +4.3 | 2.078 / 2.098 | 13.500 / 13.259 | -0.241 |
| 7 | a b | 156.3 (159 155 172 151 147) | 153.5 (152 152 168 146 151) | -2.8 | 2.125 / 2.046 | 13.590 / 13.332 | -0.258 |
| 8 | b a | 153.2 (159 154 158 147 148) | 157.9 (160 156 170 155 149) | +4.7 | 2.041 / 2.083 | 13.321 / 13.197 | -0.124 |
| 9 | a b | 154.3 (157 155 148 157 154) | 153.4 (157 153 163 144 151) | -0.9 | 2.101 / 1.982 | 13.616 / 12.913 | -0.703 |
| 10 | b a | 153.3 (160 154 158 148 148) | 154.3 (158 152 163 147 152) | +1.0 | 2.044 / 1.995 | 13.332 / 12.927 | -0.405 |
| 11 | a b | 156.5 (158 150 173 150 154) | 154.9 (161 155 164 150 146) | -1.6 | 2.131 / 2.033 | 13.610 / 13.122 | -0.488 |
| 12 | b a | 155.5 (159 158 154 152 154) | 155.3 (158 153 170 152 146) | -0.2 | 2.095 / 2.041 | 13.470 / 13.138 | -0.332 |
| over the 12 blocks | a (defaults) | b (both on) | b - a, block-paired (mean, se) | blocks b better |
|---|---|---|---|---|
| tok/s | 154.77 (sd 1.56) | 155.49 (sd 2.24) | +0.71 (+0.47 %), se 0.89 | 5 of 12 |
| ms/round | 13.496 (sd 0.115) | 13.130 (sd 0.132) | -0.366 (-2.71 %), se 0.046 | 12 of 12 (-0.12 .. -0.70) |
| tok/round | 2.089 (sd 0.036) | 2.042 (sd 0.044) | -0.047 (-2.23 %), se 0.017 | 4 of 12 |
| verified rows per round | 2.713 | 2.648 | -0.065, se 0.017 | 10 of 12 narrower |
| chain steps per round (steps after the round graph) | 0.912 | 0.874 | -0.038, se 0.012 | 10 of 12 fewer |
Spans (ms per round, the same runs; LELEKA_SERVE_PROFILE): round.draft_committed 1.439 -> 1.155 (-0.285, every block between -0.23 and -0.32), commit.wait 0.425 -> 0.085 (-0.340, the fused commit is finished
long before the host asks), commit.publish 0.140 -> 0.113, mtp.chain_step 0.594 -> 0.438 (GPU 0.563 -> 0.408, -0.155 per step), mtp.finish_first_step 0.170 -> 0.411 (the host now waits for the first draft graph instead of for
the commit: the draft's GPU chain is the critical path, the host side is idle in it), round.run_window 11.780 -> 11.695, round.apply_pending 0.204 -> 0.231.
Reading.
- The draft round is 0.285 ms shorter and the whole round 0.366 ms (2.7 %) shorter in 12 of 12 blocks (
round.run_windowis 0.085 ms shorter in the same runs, which nothing in the change touches: the earlier start of the next window and noise at the 0.05 ms level, the span has sd 0.1 ms between runs). - tok/s is not resolvably different: +0.5 % with a standard error of 0.6 % (interval about -0.7 .. +1.6 %). The reason is on the same page: the adaptive window answers the shorter rounds with narrower windows (rows per round -2.4 %,
accepted tokens per round -2.2 %, in 10 of 12 blocks). At equal tokens per round the shorter round would be +2.8 % tok/s. Reading of the code (E, not tested): the policy (
original_spec_adaptive.rs) raises its draft-confidence floor with the measured token rate, and its cost constantdraft_step_ms= 0.45 ms sat below the old step cost of 0.59 ms and sits at the new one of 0.44 ms; so it moves along a flat tokens-against-time curve and gives most of the gain back. Whether a different policy constant recovers it is a policy question (window shape, not bitwise) and was not tried. The fixed-window series of section 6 shows the gain at equal tokens per round: +3.0 % tok/s, 5 of 5 blocks. - Run-to-run spread of one arm: tok/s sd 1.6-2.2, ms/round sd 0.12-0.13, tok/round sd 0.04: the round time is the quantity this change moves and the one the A/B resolves; tok/s needs the policy held fixed to resolve it.
6. The same change with the window policy held fixed, the isolation of the fused commit, and the controls
Fixed window (runs/draft-round-ab2, 5 blocks, 10 VALID runs, bin-dr2): LELEKA_SPEC=4 LELEKA_SPEC_ADAPTIVE=off (the Original's mode17 window, 4 drafts at most) and a draft floor of 0.5 (--spec-min-p 0.5), so that the
window policy cannot react to the shorter rounds; a = defaults, b = both switches on; everything else as section 5. This is not the shipped configuration (the product runs the adaptive window with floor 0); it separates the effect of the change from the policy's answer to it.
| block | order | a tok/s (T1..T5) | b tok/s (T1..T5) | b - a tok/s | a / b tok/round | a / b ms/round | b - a ms/round |
|---|---|---|---|---|---|---|---|
| 1 | a b | 156.9 (156 159 170 149 152) | 160.0 (159 162 174 152 155) | +3.1 | 2.063 / 2.063 | 13.153 / 12.897 | -0.256 |
| 2 | b a | 157.0 (156 159 170 149 152) | 159.7 (159 162 174 151 155) | +2.7 | 2.063 / 2.063 | 13.143 / 12.916 | -0.227 |
| 3 | a b | 156.6 (156 159 170 149 151) | 160.0 (159 162 174 152 155) | +3.4 | 2.063 / 2.063 | 13.172 / 12.897 | -0.275 |
| 4 | b a | 151.7 (156 152 168 144 143) | 159.9 (158 162 173 152 155) | +8.2 | 2.069 / 2.063 | 13.636 / 12.906 | -0.730 |
| 5 | a b | 154.4 (156 154 164 146 153) | 159.9 (159 162 174 152 155) | +5.5 | 2.086 / 2.063 | 13.511 / 12.900 | -0.611 |
| over the 5 blocks | a | b | b - a, block-paired (mean, se) | blocks b better |
|---|---|---|---|---|
| tok/s | 155.33 (sd 2.27) | 159.90 (sd 0.10) | +4.58 (+2.96 %), se 1.02 | 5 of 5 (+2.7 .. +8.2) |
| ms/round | 13.323 (sd 0.233) | 12.903 (sd 0.008) | -0.420 (-3.13 %), se 0.104 | 5 of 5 |
| tok/round | 2.069 (sd 0.010) | 2.063 (sd 0.000) | -0.006 (-0.28 %), se 0.004 | (identical text in blocks 1-3) |
With the window fixed the greedy text is the same run after run (tok/round 2.063 in 8 of the 10 runs), the b arm is repeatable to 0.1 tok/s and the three clean pairs (blocks 1-3, equal tokens per round) give +3.1, +2.7, +3.4 tok/s = +2.0 % for -0.26 ms per round. Blocks 4 and 5 have a slow a arm (151.7 and 154.4 tok/s, 13.6 and 13.5 ms/round, 2.069 and 2.086 tokens per round: a run whose adaptive expert tier settled differently); they are valid runs and stay in the means. So the change does what the profile says (-0.26 .. -0.42 ms per round, 2-3 % of the round) and, with the policy not reacting, it shows as tok/s.
What the fused commit adds on top of the attention switch (runs/draft-round-ab3, 6 blocks, adaptive window as shipped, bin-dr2): a = LELEKA_SM120_ATTN_DAILY_MTP=1, b = the same plus LELEKA_DRAFT_FUSED_COMMIT=on.
| block | order | a tok/s | b tok/s | b - a tok/s | a / b tok/round | a / b ms/round | b - a ms/round |
|---|---|---|---|---|---|---|---|
| 1 | a b | 160.2 | 159.7 | -0.5 | 2.122 / 2.116 | 13.247 / 13.244 | -0.003 |
| 2 | b a | 151.0 | 156.0 | +5.0 | 2.011 / 2.075 | 13.313 / 13.300 | -0.013 |
| 3 | a b | 151.0 | 159.6 | +8.6 | 2.000 / 2.116 | 13.247 / 13.252 | +0.005 |
| 4 | b a | 152.1 | 154.5 | +2.4 | 2.055 / 2.055 | 13.511 / 13.299 | -0.212 |
| 5 | a b | 154.8 | 159.7 | +4.9 | 2.041 / 2.128 | 13.183 / 13.319 | +0.136 |
| 6 | b a | 155.4 | 158.0 | +2.6 | 2.069 / 2.095 | 13.315 / 13.258 | -0.057 |
| over the 6 blocks | a (attention switch) | b (+ fused commit) | b - a, block-paired (mean, se) | blocks b better |
|---|---|---|---|---|
| ms/round | 13.303 (sd 0.114) | 13.279 (sd 0.031) | -0.024 (-0.17 %), se 0.046 | 4 of 6 |
round.draft_committed |
1.211 | 1.177 | -0.033 | 5 of 6 |
| tok/round | 2.049 | 2.097 | +0.048 (+2.4 %), se 0.020 | (content/policy noise, the other way round from section 5) |
| tok/s | 154.07 (sd 3.52) | 157.94 (sd 2.24) | +3.87 (+2.5 %), se 1.26 | 5 of 6 (carried by tok/round, not by the round time) |
The fused commit does not shorten the round: -0.024 ms +- 0.046 ms. That is what the profile predicts (the commit graph is off the critical path and costs 4 us of host time). What it changes is where the host waits: commit.wait 0.466 -> 0.085 ms and
mtp.finish_first_step 0.033 -> 0.413 ms. With the attention switch alone the host's side of the round (commit wait 0.47 + publish 0.17 ms = 0.63 ms) ends within 33 us of the first draft graph (0.66 ms): the host path had become
as long as the GPU path, so any further cut of the first graph would have been capped by the commit graph; with the fused commit the host side has 0.38 ms of slack. It is insurance for the next GPU-side cut, not a gain today. The tok/s rows of
this table move with tok/round (content), as they do in section 5, and say nothing about the commit. Class: bitwise (section 4), neutral in speed: stays opt-in.
Controls. (1) runs/draft-round-ab0 (4 blocks): the main binary bin-main-ffd9322 (a) against the draft-round binary bin-dr1 with every new switch off (b), adaptive window: tok/s 153.86 vs 152.69 (-1.17, se 1.08, -0.75 %), ms/round 13.529 vs 13.366
(-0.163 ms, se 0.049, 4 of 4 blocks shorter), round.draft_committed -0.031 ms, round.run_window -0.104 ms. The two binaries are built from the same sources outside the new, switched-off code (git diff ffd9322c7 1416973a9 outside docs/ and scripts/ is empty);
the 0.16 ms is not explained by anything in the draft (the draft spans differ by 0.03 ms) and the A/A below says how large such a difference is between two arms of one binary. It does not touch section 5 (one binary, environment switches only).
(2) A/A (runs/draft-round-ab5, 4 blocks, bin-dr1 against itself, defaults, adaptive window): b - a ms/round +1.230, +0.004, -0.313, +0.113 (mean +0.26, se 0.34; the +1.23 block has a run that stalled in turn 2 at 110 tok/s, valid under the rules), tok/s
-4.7, -0.0, +2.1, +4.7 (mean +0.5, se 2.0), tok/round +0.119, 0.000, -0.019, +0.082. So the paired design has a per-block spread of about 0.2-0.3 ms/round and 3-4 tok/s between two identical arms (one outlier included): the control difference of (1) is inside it,
and the 12-block series of section 5 (ms/round differences -0.12 .. -0.70, sd 0.16, all negative) and the span round.draft_committed (every block between -0.23 and -0.32; in the A/A -0.145 .. +0.041) sit outside it. The tok/s rows of every series are dominated by
tok/round, which moves by +-0.1 between identical arms.
7. Examined and not done (with the numbers that decided it)
- Guards. 41 of the 113 step kernels (59 of about 160 in the round graph) are
mtp_original_finite/mtp_original_q8_guardchecks: 0.7-1.1 us of GPU time each with the gap to the next node, about 0.1 ms per round together. A bitwise- and behaviour-preserving way is to fuse each (finite, quantize, q8_guard) triplet (3 nodes -> 1; 3 in the step, 8 in the round graph, about 30 us per round); dropping or deferring the checks changes how a numerical fault is reported and is the owner's call. Not done: below what a 6-12 block A/B can resolve. - Draft head
head_n14_s0: 223 MB of Q6_K rows (106,299 x 2560) per graph at 141 us = 1.58 TB/s, the card's sustained DRAM rate. Reading the matrix in alternating directions in consecutive graphs to reuse the L2 tail (96 MB) was considered (up to about 25 us per round); the attention reads in between evict part of it. Not done. - Argmax + top-probability scans (
chain_sampler_greedy_kernel9.5 us,chain_row_top_prob_kernel8.1 us, single-block kernels over 106k logits): fusing them saves one launch and one L2 pass (about 16 us per round); the probability sum must keep its order, so only the two-pass fusion is safe. Not done. - Draft before commit in the host order (the draft would start about 48 us earlier): with the fused commit the commit enqueue costs about 10 us, so there is nothing left to win; and the reorder touches the controller's state machine.
- Pipelined chain (launch step j+1 before the host read of step j): the adaptive window always runs with a confidence floor, and a speculative step past a failed test writes a ring cell; not safe to do bitwise.
- Follow-up: window-policy-5090 finds why the window narrows (a step function of the draft floor), screens the policy constants on forced text and changes the default draft-floor ceiling 0.9 -> 0.6 (
LELEKA_SPEC_POLICY=legacyrestores it); the fixed-window gain of section 6 was content, not policy. LELEKA_SPEC_DRAFT_STEP_MS(the adaptive window's constant for the cost of one chain step, 0.45 ms) is now closer to the measured step (about 0.42 ms with the attention switch) than before (0.6); it is a policy parameter, not touched.
8. Reproduce
- Profile:
scripts/e2e/decode/draftround-ab.shwithPROFILE=1 ENTRIES="1:1:a"(stubsdr-prof*.sh), thenpython3 -I draftround-kernels.py <run>/win-turn5.lct --seq stepanddraftround-timeline.py. - Probe:
tools/draft-round/commit_probe.cpp(nvcc -O2 -std=c++17 commit_probe.cpp -lcuda; PTX directory with the four.ptx). - Identity:
draftround-id.sh(stubsdr-id1.sh,dr-id2.sh); A/B:draftround-ab.sh(stubsdr-ab0.sh,dr-ab1.sh,dr-ab1b.sh); analysis:draftround-analyze.py <runroot>. - Build: WSL release from an LF worktree (
git ls-files --eolshowsw/lffor the.ptx), binariesdt/bin-dr1(tooling commit + fused commit before the cc gate) anddt/bin-dr2(=28d74a2ef); test binariesdt/rt-dr1,dt/rt-dr2. - Two
leleka-runtimetests fail in a WSL checkout on/mnt/c(model_binding::qwen4exp_input::mtp::backing::tests::{failed_cleanup_or_replaced_inode_never_deletes_unowned_file, frozen_same_fd_hash_owner_and_source_independence}, ownership checks, already recorded in draft-tail-5090.md);leleka-cuda-driverlib: 431 passed, 0 failed.