Merge claude/speed-vs-strata-08143a: S11 default, S9/U5a windows report, D1-D3 switches

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Pavlo Ratushnyi
2026-11-11 16:21:11 +01:00
co-authored by Claude Sonnet 5.5
10 changed files with 794 additions and 11 deletions
@@ -190,7 +190,7 @@ fn only_the_5090_profiles_enable_the_sm120_main_attention_and_swiglu_kernels() {
}
/// Engine switches of the compute capability 12 kernels (main attention, gate/up SwiGLU) and of the GDN side streams.
const SM120_MAIN_KERNEL_KEYS: [&str; 7] = [
const SM120_MAIN_KERNEL_KEYS: [&str; 8] = [
"LELEKA_SM120_ATTN_DAILY",
"LELEKA_SM120_GU_SWIGLU",
"LELEKA_SM120_SIDE_MIXER",
@@ -198,6 +198,7 @@ const SM120_MAIN_KERNEL_KEYS: [&str; 7] = [
"LELEKA_SM120_SIDE_SHARED",
"LELEKA_SM120_FUSED_QSA_PRELUDE",
"LELEKA_DRAFT_FUSED_COMMIT",
"LELEKA_SM120_COMBINE_VEC4",
];
#[test]
@@ -13,6 +13,6 @@
"min_vram_total_mib": 30000,
"min_ram_total_bytes": 68719476736,
"min_ram_available_bytes": 62000000000,
"engine_env": {"LELEKA_PREFILL_LOAN_TIERS": "1", "LELEKA_DRAFT_CHECK_MERGE": "1", "LELEKA_PREFIX_PARK_FAST": "1", "LELEKA_DECODE_GRAPH_REUSE": "1", "STRATA_PREFILL_STREAM_MIN": "1536", "LELEKA_ORIGINAL_SERVE_EXPERT_PER_LAYER": "yes", "LELEKA_CHAIN": "all", "LELEKA_ORIGINAL_SERVE_SEED": "off", "LELEKA_SM120_ATTN_DAILY_MTP": "1", "LELEKA_SM120_ATTN_DAILY": "1", "LELEKA_SM120_GU_SWIGLU": "1", "LELEKA_SM120_SIDE_MIXER": "1", "LELEKA_SM120_SIDE_QSA": "1", "LELEKA_SM120_SIDE_SHARED": "1", "LELEKA_SM120_FUSED_QSA_PRELUDE": "1", "LELEKA_DRAFT_FUSED_COMMIT": "1"},
"engine_env": {"LELEKA_PREFILL_LOAN_TIERS": "1", "LELEKA_DRAFT_CHECK_MERGE": "1", "LELEKA_PREFIX_PARK_FAST": "1", "LELEKA_DECODE_GRAPH_REUSE": "1", "STRATA_PREFILL_STREAM_MIN": "1536", "LELEKA_ORIGINAL_SERVE_EXPERT_PER_LAYER": "yes", "LELEKA_CHAIN": "all", "LELEKA_ORIGINAL_SERVE_SEED": "off", "LELEKA_SM120_ATTN_DAILY_MTP": "1", "LELEKA_SM120_ATTN_DAILY": "1", "LELEKA_SM120_GU_SWIGLU": "1", "LELEKA_SM120_SIDE_MIXER": "1", "LELEKA_SM120_SIDE_QSA": "1", "LELEKA_SM120_SIDE_SHARED": "1", "LELEKA_SM120_FUSED_QSA_PRELUDE": "1", "LELEKA_DRAFT_FUSED_COMMIT": "1", "LELEKA_SM120_COMBINE_VEC4": "1"},
"memory": {"prefix_cache_mib": "6144", "prefix_cache_tail": "reply", "prefix_cache_block": 8192, "soft_floor_mib": 4096, "hard_floor_mib": 2048, "reserve_mib": 2048, "lock": "off", "heal": false}
}
@@ -13,6 +13,6 @@
"min_vram_total_mib": 30000,
"min_ram_total_bytes": 68719476736,
"min_ram_available_bytes": 62000000000,
"engine_env": {"LELEKA_PREFILL_LOAN_TIERS": "1", "LELEKA_DRAFT_CHECK_MERGE": "1", "LELEKA_PREFIX_PARK_FAST": "1", "LELEKA_DECODE_GRAPH_REUSE": "1", "STRATA_PREFILL_STREAM_MIN": "1536", "LELEKA_ORIGINAL_SERVE_EXPERT_PER_LAYER": "yes", "LELEKA_CHAIN": "all", "LELEKA_ORIGINAL_SERVE_SEED": "off", "LELEKA_SM120_ATTN_DAILY_MTP": "1", "LELEKA_SM120_ATTN_DAILY": "1", "LELEKA_SM120_GU_SWIGLU": "1", "LELEKA_SM120_SIDE_MIXER": "1", "LELEKA_SM120_SIDE_QSA": "1", "LELEKA_SM120_SIDE_SHARED": "1", "LELEKA_PLE_DIRECT": "0", "LELEKA_ORIGINAL_SERVE_GGUF_PLE": "1", "LELEKA_SM120_FUSED_QSA_PRELUDE": "1", "LELEKA_DRAFT_FUSED_COMMIT": "1"},
"engine_env": {"LELEKA_PREFILL_LOAN_TIERS": "1", "LELEKA_DRAFT_CHECK_MERGE": "1", "LELEKA_PREFIX_PARK_FAST": "1", "LELEKA_DECODE_GRAPH_REUSE": "1", "STRATA_PREFILL_STREAM_MIN": "1536", "LELEKA_ORIGINAL_SERVE_EXPERT_PER_LAYER": "yes", "LELEKA_CHAIN": "all", "LELEKA_ORIGINAL_SERVE_SEED": "off", "LELEKA_SM120_ATTN_DAILY_MTP": "1", "LELEKA_SM120_ATTN_DAILY": "1", "LELEKA_SM120_GU_SWIGLU": "1", "LELEKA_SM120_SIDE_MIXER": "1", "LELEKA_SM120_SIDE_QSA": "1", "LELEKA_SM120_SIDE_SHARED": "1", "LELEKA_PLE_DIRECT": "0", "LELEKA_ORIGINAL_SERVE_GGUF_PLE": "1", "LELEKA_SM120_FUSED_QSA_PRELUDE": "1", "LELEKA_DRAFT_FUSED_COMMIT": "1", "LELEKA_SM120_COMBINE_VEC4": "1"},
"memory": {"prefix_cache_mib": "6144", "prefix_cache_tail": "reply", "prefix_cache_block": 8192, "soft_floor_mib": 4096, "hard_floor_mib": 2048, "reserve_mib": 2048, "lock": "off", "heal": false}
}
@@ -14,6 +14,6 @@
"min_vram_total_mib": 30000,
"min_ram_total_bytes": 107374182400,
"min_ram_available_bytes": 113000000000,
"engine_env": {"LELEKA_PREFILL_LOAN_TIERS": "1", "LELEKA_DRAFT_CHECK_MERGE": "1", "LELEKA_PREFIX_PARK_FAST": "1", "LELEKA_DECODE_GRAPH_REUSE": "1", "STRATA_PREFILL_STREAM_MIN": "1536", "LELEKA_ORIGINAL_SERVE_EXPERT_PER_LAYER": "yes", "LELEKA_CHAIN": "all", "LELEKA_ORIGINAL_SERVE_SEED": "off", "LELEKA_SM120_ATTN_DAILY_MTP": "1", "LELEKA_SM120_ATTN_DAILY": "1", "LELEKA_SM120_GU_SWIGLU": "1", "LELEKA_SM120_SIDE_MIXER": "1", "LELEKA_SM120_SIDE_QSA": "1", "LELEKA_SM120_SIDE_SHARED": "1", "LELEKA_SM120_FUSED_QSA_PRELUDE": "1", "LELEKA_DRAFT_FUSED_COMMIT": "1"},
"engine_env": {"LELEKA_PREFILL_LOAN_TIERS": "1", "LELEKA_DRAFT_CHECK_MERGE": "1", "LELEKA_PREFIX_PARK_FAST": "1", "LELEKA_DECODE_GRAPH_REUSE": "1", "STRATA_PREFILL_STREAM_MIN": "1536", "LELEKA_ORIGINAL_SERVE_EXPERT_PER_LAYER": "yes", "LELEKA_CHAIN": "all", "LELEKA_ORIGINAL_SERVE_SEED": "off", "LELEKA_SM120_ATTN_DAILY_MTP": "1", "LELEKA_SM120_ATTN_DAILY": "1", "LELEKA_SM120_GU_SWIGLU": "1", "LELEKA_SM120_SIDE_MIXER": "1", "LELEKA_SM120_SIDE_QSA": "1", "LELEKA_SM120_SIDE_SHARED": "1", "LELEKA_SM120_FUSED_QSA_PRELUDE": "1", "LELEKA_DRAFT_FUSED_COMMIT": "1", "LELEKA_SM120_COMBINE_VEC4": "1"},
"memory": {"prefix_cache_mib": "6144", "prefix_cache_tail": "reply", "prefix_cache_block": 8192, "soft_floor_mib": 4096, "hard_floor_mib": 2048, "reserve_mib": 2048, "lock": "try", "heal": true}
}
+8 -7
View File
@@ -106,10 +106,10 @@ Structure first, then the layer steps in graph order: embed (R7), mixer half (V3
| K11 | routed experts in the verify graph, role total (gate/up/SwiGLU, down) | 2.507 | 2.484 | +0.023 (entry mix differs; at equal entry counts LEL is faster: `window_moe_down_20` 13.6 us with 40 entries against 17.4 us, `sm120_moe_gu_swiglu_22` 12.3 us with 50 entries against 26 us with 40) | CUPTI | device | open (2026-11-11 per layer pair, T 2-4: `window_moe_down_*` is 3.4-7.1 us slower than VANL in 48 of 48 layers, the gate/up kernel 3-4 us faster, and the empty PCIe pass launches at full grid every layer (about 5.5 us against about 0.7); the role total hides this in the entry mix; `docs/experiments/ffn-phase-loss-design.md` section 4.1 D1) |
| K15 | hit tally `add_hits` (48 x 1.2 us against 48 x 1.3 us) | 0.059 | 0.063 | -0.004 | CUPTI | device | proved-equal (LEL ahead) |
| S2 | `GU_SWIGLU` (routed expert gate/up + SwiGLU + q8_1) | on since lever 1 | on | as S1 | gap doc lever 1 | device | fixing (needs a CUPTI section delta) |
| S7 | sub16 routed-expert kernels beyond `GU_SWIGLU` | warp-per-row | sub16 | estimate 0.20-0.35; the CUPTI pair K11 does not show LEL slower, so this must be re-measured by kernel before any work | upstream plan | device | fixing (task D1 `LELEKA_SM120_DOWN_SUB16`, estimate refined to 0.17-0.23 ms a graph; `docs/experiments/ffn-phase-loss-design.md`) |
| D2 | `add_hits` folded into the combine (`LELEKA_SM120_HITS_IN_COMBINE`, upstream `combine_k10_vec4_hits`) | `add_hits` 48 x 1.2-1.3 us a graph | folded | upper bound 0.06 ms a graph (T 2-4) | design `ffn-phase-loss-design.md` 4.1 | device | open (task T2, not started) |
| D3 | wait on flag M folded into the copy of the CPU rows (`LELEKA_SM120_WAIT_M_ROWS`) | 2 launches a layer | folded | 0.04-0.06 ms a graph; risk: upstream measured -1.5 % decode on Turing for the same fold | design `ffn-phase-loss-design.md` 4.1 | device | open (task T3, not started) |
| S11 | float4 combine | not ported | `combine_k10_vec4` 50.6 x 1.2 us | estimate 0.05-0.10 (the code has no launch saving, one launch a layer both ways: expect 0.01-0.02) | upstream plan | device | fixing (switch `LELEKA_SM120_COMBINE_VEC4` (off), sealed `sm120_combine_vec4`, branch `claude/s11-s9-combine-headmix` merged; jobs `verify-s11-s9-u5a-bitwise-probes`, `-identity` P2/P5, `-cupti-windows` CS/CZ queued; look at `mtp_full_combine` against `leleka_verify_combine_k10_vec4` per launch). Identity 2026-11-10 (`verify-s11-s9-u5a-identity` P2): top-16 rows 2057/2057 bit-identical, draft trace 1036/1036, A/A identical: PASS. Stays OFF until the window `CS` shows a delta) |
| S7 | sub16 routed-expert kernels beyond `GU_SWIGLU` | warp-per-row | sub16 | estimate 0.20-0.35; the CUPTI pair K11 does not show LEL slower, so this must be re-measured by kernel before any work | upstream plan | device | fixing (built, off: `LELEKA_SM120_DOWN_SUB16`, branch `claude/ffn-down-sub16` merged, sealed `sm120_down_sub16`; jobs `verify-ffn-d1-d2-d3-bitwise-probes` (`sm120_probe down`), `-identity` P2/P5, window WD/WZ queued 2026-11-11; look at `window_moe_down_20/_42` -> `sm120_moe_down_20/_42`; estimate refined to 0.17-0.23 ms a graph; `docs/experiments/ffn-phase-loss-design.md`) |
| D2 | `add_hits` folded into the combine (`LELEKA_SM120_HITS_IN_COMBINE`, upstream `combine_k10_vec4_hits`) | `add_hits` 48 x 1.2-1.3 us a graph | folded | upper bound 0.06 ms a graph (T 2-4) | design `ffn-phase-loss-design.md` 4.1 | device | fixing (built, off: `LELEKA_SM120_HITS_IN_COMBINE`, branch `claude/ffn-hits-combine` merged, sealed `sm120_combine_hits`; jobs `verify-ffn-d1-d2-d3-bitwise-probes`, `-identity` P3/P5, `-cupti-windows` WH/WZ queued 2026-11-11; look at `add_hits` (-48 launches a graph) and the combine entry) |
| D3 | wait on flag M folded into the copy of the CPU rows (`LELEKA_SM120_WAIT_M_ROWS`) | 2 launches a layer | folded | 0.04-0.06 ms a graph; risk: upstream measured -1.5 % decode on Turing for the same fold | design `ffn-phase-loss-design.md` 4.1 | device | fixing (built, off: `LELEKA_SM120_WAIT_M_ROWS`, branch `claude/ffn-wait-m-rows` merged, sealed `sm120_wait_copy_rows`; thread 0 of each block polls, fence, barrier, then the copy; jobs as D2, window WW/WZ; look at the second `verify_wait_flag_ge` + `chain_copy_rows_from_mapped` -> `leleka_verify_wait_copy_rows`, and watch for a longer copy kernel) |
| S11 | float4 combine | not ported | `combine_k10_vec4` 50.6 x 1.2 us | estimate 0.05-0.10 (the code has no launch saving, one launch a layer both ways: expect 0.01-0.02) | upstream plan | device | fixed (switch `LELEKA_SM120_COMBINE_VEC4` (off), sealed `sm120_combine_vec4`, branch `claude/s11-s9-combine-headmix` merged; jobs `verify-s11-s9-u5a-bitwise-probes`, `-identity` P2/P5, `-cupti-windows` CS/CZ queued; look at `mtp_full_combine` against `leleka_verify_combine_k10_vec4` per launch). Identity 2026-11-10 (`verify-s11-s9-u5a-identity` P2): top-16 rows 2057/2057 bit-identical, draft trace 1036/1036, A/A identical: PASS. Window (cumulative variants, CS-CP, `docs/experiments/verify-s11-s9-u5a-windows.md`): combine 1.50 -> 1.15 us per launch, -0.0164 ms a graph weighted over T (noise <= 0.0004), resolved at every T. Enabled by default in the three 5090 profiles 2026-11-11 (closed by section delta + identity)) |
| K8 | hyper-connection down (`chain_gr_down_t2w8_nb4` 11.1 us against `gr_down_staged` 11.5 us) | 1.063 | 1.112 | -0.049 | CUPTI | device | proved-equal (LEL ahead) |
| K9 | hyper-connection up (`chain_gr_up8` 8.5 us against `gr_up75` + `gr_up_multi` variants) | 0.817 | 0.877 | -0.060 | CUPTI | device | proved-equal (LEL ahead) |
| K10 | hyper-connection split (`chain_gr_split` 96 x 3.1 us against `gr_norm_split` 97 x 2.9 us) | 0.299 | 0.280 | +0.019 | CUPTI | device | open |
@@ -117,7 +117,7 @@ Structure first, then the layer steps in graph order: embed (R7), mixer half (V3
| S5 | `GR_UP75` (hoisted row loads) | partial | on | estimate 0.05-0.10 | upstream plan | device | open |
| K14 | small kernels (norms, PLE, copies, sampler) | 0.049 | 0.253 | -0.204 | CUPTI role table | device | proved-equal (LEL ahead) |
| R8 | tail after the last layer's `add_hits` (final write, head, argmax) | 0.463 | 0.373 | +0.090 | CUPTI | device | open |
| S9 | `HEAD_MIX_MULTI` | not ported | on | estimate 0.06-0.10 | upstream plan | device | fixing (switch `LELEKA_SM120_HEAD_MIX_MULTI` (off), one multi-token hc read for the head, 3 launches a token instead of 5 (-(5T-3) a graph), branch `claude/s11-s9-combine-headmix` merged; bitwise rests on upstream's claim until `verify-s11-s9-u5a-bitwise-probes` and identity P3/P5 run; window CH/CZ queued). Identity 2026-11-10 (P3): NOT bitwise. 25 of 2057 top-16 rows differ against the reference (same 25 in both arms, A/A identical, so it is the switch, not noise), d_top1 max 0.0015, p99 0.0013, argmax flips 0, draft trace 1036/1036 identical. The multi-token head read changes the summation order of the head mix. A lossy-class change: OFF, and it needs its own quality gate and a delta before it can be considered (the window `CH`; expected gain is only the 5T-3 launches) |
| S9 | `HEAD_MIX_MULTI` | not ported | on | estimate 0.06-0.10 | upstream plan | device | open (switch `LELEKA_SM120_HEAD_MIX_MULTI` (off), one multi-token hc read for the head, 3 launches a token instead of 5 (-(5T-3) a graph), branch `claude/s11-s9-combine-headmix` merged; bitwise rests on upstream's claim until `verify-s11-s9-u5a-bitwise-probes` and identity P3/P5 run; window CH/CZ queued). Identity 2026-11-10 (P3): NOT bitwise. 25 of 2057 top-16 rows differ against the reference (same 25 in both arms, A/A identical, so it is the switch, not noise), d_top1 max 0.0015, p99 0.0013, argmax flips 0, draft trace 1036/1036 identical. The multi-token head read changes the summation order of the head mix. A lossy-class change: OFF, and it needs its own quality gate and a delta before it can be considered (the window `CH`; expected gain is only the 5T-3 launches). Window CH-CS (`docs/experiments/verify-s11-s9-u5a-windows.md`): -(5T-3) kernels confirmed, head span -0.0004 .. -0.0605 ms a graph at T 1..6, weighted -0.023 ms (noise <= 0.0001): real but small, far below the 0.06-0.10 estimate; OFF because it is not bitwise |
## C2u. Upstream cc 12.0 defaults after 0.2.6 (owner 2026-11-09: +0.3 % and +0.5 % are tokens too)
@@ -130,7 +130,7 @@ These are in upstream `strata-upstream/main` (October 31 to November 1) and not
| verify: unrolled GDN a/b projection (U3) | `STRATA_SMALL_UNR` bit 1 (`gdn_ab_body`; ours `verify_gdn_ab_multi_kernel`) | no | same A/B as U2 (bits 0 and 1 together) | not measured; part of the GDN role K7 | upstream commit | device | open (switch `LELEKA_SM120_GDN_AB_UNROLL` built, identity PASS (P6, P8: `verify-new-switches-identity`: top-16 rows 2057/2057 identical, draft trace 1036/1036 identical, argmax flips 0, A/A identical), OFF in the profiles. Section `verify-new-switches-cupti-windows` (2026-11-10, windows of request 29, 15 s, new binary `bin-verify-switches`, per-T within one variant: T 2..6 have 77-376 graphs; the control CL.2 and each variant ran in separate sessions, so the expert-tier (FFN) phase differs between them and is NOT compared) without side streams (CV.1 against CL.2): GDN kernel time per graph -63 / -93 / -137 / -177 / -168 us at T 2..6 (`chain_gdn_ab_multi_kernel` 7.72 us x 36 -> `leleka_gdn_ab_unrolled_t1..t8` 2.97 .. 15.56 us), mixer phase -1.3 / -1.8 / -2.8 / -3.3 / -3.7 us per layer = -0.06 .. -0.17 ms per graph. With SIDE_MIXER on (CY.1) the unrolled kernel does not run at all (the side stream keeps `chain_gdn_ab_multi_kernel`), so the profile set does not take it. Next step: use the unrolled a/b kernel on the side stream and check whether the join then waits less) |
| verify: batched staging and read loads of the HC read (U4) | `STRATA_GR_V3_PF` bits 0 and 2 of `gr_down_v3`/`gr_up_v3` (`08b20b104`) | no `GR_V3` port (`upstream-port-plan.md` 5.7); our HC kernels are the chain kernels (`chain_gr_down_t2w8_nb4` 11.1 us, `chain_gr_up8` 8.5 us), ahead of vanilla 0.2.6 by K8/K9 | no number of its own | not measured against the chain kernels | upstream commit | device | open (needs the same-T kernel table of upstream's variant against the chain kernel) |
| verify: HC down kernel, two rows a warp for windows of 5+ rows (U5) | `STRATA_GR_V3_PF` bit 7, default mask 133 on sm_120 (`4ab81c796`, `5f24b96db`, merged as `27a3e056a`; bitwise, same dots in the same order) | not present; chain down kernel by window rows in `CL.1` (gy = rows/2): T 1-2 9.35 us, T 3-4 10.65 us, T 5-6 13.11 us, T 7-8 15.33 us (vanilla 0.2.6 `VANL` by its own grid-y 1/2/3/4/6: 8.80 / 9.04 / 10.18 / 12.54 / 15.92 us; a different row mapping) | down kernel 16.1 / 16.2 / 17.6 / 19.5 -> 13.3 / 14.1 / 14.7 / 15.6 us at T 5-8 (upstream's own table); serve A/B spec 6 +1.21 %, spec 8 +1.4 %, ids identical 96/96 | RTX 5090 micro-benchmark `verify-hc-down-kernel-microbench-vs-upstream` (2026-11-10, upstream 504b1433, ours 6b2a69f1d; 64-node graph, 7 rounds x 40 replays, weights cold from DRAM): the whole read, ours (split + down + up8) against upstream (down + up, mask 133), is slower by 3.9 / 4.4 / 3.4 / 3.1 / 3.9 / 5.2 / 5.9 / 5.2 us per layer half at T 1..8 (+15..+29 %, every point above the round spread); against mask 0 by 3.2 / 3.1 / 2.5 / 1.3 / 0.8 / 1.1 / 0.2 / -0.9 us. Our down kernel alone is slower by 2.8..5.1 us (warm); the split kernel adds 2.3..2.6 us that upstream's down kernel does itself (norm sum of squares and staging). At 96 launches a graph (48 layers x 2 halves, `docs/experiments/verify-hc-down-kernel-microbench-vs-upstream.md`) that is 0.30 (T 4) .. 0.56 ms (T 7) per verify graph. Bitwise: NOT established, the harness inputs give NaN in most outputs (`nonfinite` in the DIFF lines), so the byte compare says nothing; the finite rows show `rs` differing by 1 ulp from upstream. | upstream commit | device | fixing (measured: upstream faster at every T, so the earlier "level within 1 us" reading was wrong; steps: U5a. Section delta to confirm in the CUPTI window: `chain_gr_down_t2w8_nb4` + `chain_gr_split` -> one fused down kernel, per-layer-half time) |
| verify: HC down plus split fused into one upstream-style kernel (U5a) | `gr_down_v3_kernel` mask 133: staging, norm sum of squares and the dots in one launch, no `chain_gr_split` | `chain_gr_split` + `chain_gr_down_t2w8_nb4` (+ `chain_gr_up8`): two launches, split 2.3..2.6 us (warm) | microbench (U5): ours slower by 3.1..5.9 us per layer half cold, 96 launches a graph = 0.30..0.56 ms a graph | not measured on the engine | microbench `verify-hc-down-kernel-microbench-vs-upstream` | device | fixing (built, off; branch `claude/u5a-gr-down-fused` merged; jobs `verify-s11-s9-u5a-bitwise-probes`, `-identity` P4/P5, `-cupti-windows` CD/CZ queued 2026-11-10; no separate A/B, owner rule of 2026-11-10). `LELEKA_SM120_GR_DOWN_FUSED=1` (needs `LELEKA_CHAIN` with `gr`, staged read, 81,920 B shared) records `leleka_gr_down_fused_t2w8` (`sm120_gr_down_fused.cu`, sealed PTX, 191 registers, no spill) in place of `chain_gr_split` + `chain_gr_down_t2w8_nb4`: the block stages R' * w_norm of its two tokens into shared memory, adds the sum of squares in the split kernel's order, scales, and runs the down kernel's dots; `rs` is written by the blocks of column 0; the arithmetic order is the two kernels' (bitwise by construction, unlike upstream's v3), so the weights' DRAM fetch (about 4 us cold) overlaps the staging instead of waiting behind the split launch. Probe `tools/gr-down-fused/gr_down_fused_probe.cpp` compares every output byte against the pair for T 1..8. Microbench inputs were finite all along; its NaN came from a race between the poison memsets (legacy default stream) and the kernels (non-blocking stream), fixed with a device synchronize; the byte compare of the earlier run is invalid and the microbench has to be re-run. Section to look at: `chain_gr_split` + `chain_gr_down_t2w8_nb4` (96 + 96 launches a graph) -> `leleka_gr_down_fused_t2w8` (96 a graph)). Identity 2026-11-10 (P4): 2057/2057 rows bit-identical, draft trace 1036/1036, A/A identical: PASS. Enabled by default only after window `CD` shows a delta |
| verify: HC down plus split fused into one upstream-style kernel (U5a) | `gr_down_v3_kernel` mask 133: staging, norm sum of squares and the dots in one launch, no `chain_gr_split` | `chain_gr_split` + `chain_gr_down_t2w8_nb4` (+ `chain_gr_up8`): two launches, split 2.3..2.6 us (warm) | microbench (U5): ours slower by 3.1..5.9 us per layer half cold, 96 launches a graph = 0.30..0.56 ms a graph | not measured on the engine | microbench `verify-hc-down-kernel-microbench-vs-upstream` | device | open (built, off, slower in the graph; branch `claude/u5a-gr-down-fused` merged; jobs `verify-s11-s9-u5a-bitwise-probes`, `-identity` P4/P5, `-cupti-windows` CD/CZ queued 2026-11-10; no separate A/B, owner rule of 2026-11-10). `LELEKA_SM120_GR_DOWN_FUSED=1` (needs `LELEKA_CHAIN` with `gr`, staged read, 81,920 B shared) records `leleka_gr_down_fused_t2w8` (`sm120_gr_down_fused.cu`, sealed PTX, 191 registers, no spill) in place of `chain_gr_split` + `chain_gr_down_t2w8_nb4`: the block stages R' * w_norm of its two tokens into shared memory, adds the sum of squares in the split kernel's order, scales, and runs the down kernel's dots; `rs` is written by the blocks of column 0; the arithmetic order is the two kernels' (bitwise by construction, unlike upstream's v3), so the weights' DRAM fetch (about 4 us cold) overlaps the staging instead of waiting behind the split launch. Probe `tools/gr-down-fused/gr_down_fused_probe.cpp` compares every output byte against the pair for T 1..8. Microbench inputs were finite all along; its NaN came from a race between the poison memsets (legacy default stream) and the kernels (non-blocking stream), fixed with a device synchronize; the byte compare of the earlier run is invalid and the microbench has to be re-run. Section to look at: `chain_gr_split` + `chain_gr_down_t2w8_nb4` (96 + 96 launches a graph) -> `leleka_gr_down_fused_t2w8` (96 a graph)). Identity 2026-11-10 (P4): 2057/2057 rows bit-identical, draft trace 1036/1036, A/A identical: PASS. Window CD-CH (`docs/experiments/verify-s11-s9-u5a-windows.md`): the fused kernel is SLOWER in the graph, pair per layer half +1.47 / +2.46 / +1.69 / +1.44 / +0.32 / -0.10 us at T 1..6, +0.145 ms a graph weighted (noise <= 0.005): do NOT enable; the launch gap inside the pair is only 0.1 us, so the fuse has nothing to save, the microbench gain did not carry over; the reason it is slower is not measured |
## C2v. CUPTI windows of the new verify switches (`verify-new-switches-cupti-windows`, 2026-11-10)
@@ -238,7 +238,8 @@ Queue stubs and result directories carry the readable name from 2026-11-09 (`<ar
| `spd-sqid2` | verify-fused-commit-and-side-branches-identity (dir of the same name) | done |
| - | verify-s11-s9-u5a-bitwise-probes (probes of S11, S9, U5a, kernel level) | first run 2026-11-10 failed: the frozen probe binaries had lost the executable bit (exit 126, nothing measured); `-run2` stages them with +x, queued 2026-11-11 before the windows |
| - | verify-s11-s9-u5a-identity (P2 S11, P3 S9, P4 U5a, P5 profile set + all three) | done 2026-11-10 23:00: P2 PASS, P3 25 rows differ (d_top1 max 0.0015, no flips), P4 PASS, P5 the same 25 rows as P3 |
| - | verify-s11-s9-u5a-cupti-windows (CP control, CS, CH, CD, CZ) | queued 2026-11-10 |
| - | verify-s11-s9-u5a-cupti-windows (CP control, CS, CH, CD, CZ) | done 2026-11-11 00:11; NOTE the variants are cumulative (the job did not unset the per-variant switches: CS = S11, CH = S11+S9, CD = S11+S9+U5a, CZ = all three = CD again, i.e. CZ-CD is a noise estimate); fixed in `spd_ab_job.sh` 2026-11-11 |
| - | verify-ffn-d1-d2-d3-bitwise-probes / -identity (P2 D1, P3 D2, P4 D3, P5 profile set + all three) / -cupti-windows (CP, WD, WH, WW, WZ), binary `bin-ffn-switches`, test binary `dt/rt-ffn-switches` | queued 2026-11-11 |
| `spd-xa`, `spd-xb` | memory-tier-tie-spread-ab-first-half, -second-half (dir `runs/memory-tier-tie-spread-ab`) | first half queued (5 pairs); second half withdrawn 2026-11-10 (A/B rule below) |
| `spd-cuo` | draft-and-verify-cupti-windows-leleka (dir `runs/cupti/CL.1`) | done |
| `spd-cuv` | draft-and-verify-cupti-windows-vanilla (dir `runs/cupti/VANL`) | done |
@@ -0,0 +1,376 @@
# Verify switches S11, S9, U5a: section deltas from the CUPTI windows (2026-11-11)
Source: `/data/leleka-e2e/spd-gap/runs/verify-s11-s9-u5a-cupti-windows/{CP,CS,CH,CD,CZ}.1/win-r29.lct` (job log
`job-233307.log`; request 29 of the replay, 15 s windows, floor profile, 2026-11-10 23:33 to 00:11). Read offline with
`scripts/e2e/codex/speed/window_increment_report.py` (stdlib, no GPU; the traces were only read on `rnr5090`). Nothing here
is an end-to-end result: these are section deltas inside the verify graph, kernel durations and spans from CUPTI. The e2e
A/B stays the one group A/B at the end of the stage.
## Summary
| step | switch | what really ran | section delta (CUPTI, in-graph) | noise | resolved | recommendation |
| --- | --- | --- | --- | --- | --- | --- |
| S11 | `LELEKA_SM120_COMBINE_VEC4` | CS vs CP | combine `mtp_full_combine` 1.50 -> `leleka_verify_combine_k10_vec4` 1.15 us per launch (-0.35 us, 48 launches): **-0.0144 .. -0.0174 ms per graph** (T 1..6), -0.0164 weighted by CP's T mix | <= 0.0004 ms per graph, <= 0.03 us per launch | yes, every T | **enable by default in the 5090 profiles** (identity PASS 2057/2057, delta > 0 beyond the noise); it is small |
| S9 | `LELEKA_SM120_HEAD_MIX_MULTI` | CH vs CS | head launches 5T -> 3 (-(5T-3) a graph, confirmed), head span **-0.0004 / -0.0118 / -0.0244 / -0.0368 / -0.0482 / -0.0605 ms per graph** at T 1..6, -0.0233 weighted | <= 0.0001 ms | yes (grows with T) | stays OFF (not bitwise: 25 of 2057 rows differ, d_top1 max 0.0015) whatever the delta; the delta is small |
| U5a | `LELEKA_SM120_GR_DOWN_FUSED` | CD vs CH | the fused kernel is **slower** than split + down: pair per layer half +1.47 / +2.46 / +1.69 / +1.44 / +0.32 / -0.10 us at T 1..6 (p50), **+0.144 / +0.238 / +0.160 / +0.146 / +0.033 / +0.026 ms per graph**, +0.145 weighted | <= 0.003 ms, <= 0.03 us per launch | yes (a loss) | **do not enable**; the microbench prediction (-3..6 us per layer half, -0.30..-0.56 ms) did not carry over to the graph |
Sign convention: delta = later window minus earlier, so negative is faster. Deltas are p50 over graphs of the same T within
one window (the mean agrees to the third decimal); the table values are the T mix weighted ones of section 4 of the
appendix where "weighted" is said.
## 1. The windows are cumulative (confound), and which switches each really ran
The job script did not unset the per-variant switches between variants (a `CS` export leaked into `CH` and `CD`; fixed in
`8b2bd4d5e`, which also adds the independent variants WD/WH/WW/WZ for later windows). Evidence is in two independent
places that agree: the switch line the engine printed (`requested Sm120Switches` in each `engine.log`) and the kernel
names launched in the verify graphs (appendix, section 1):
| window | engine log (combine_vec4 / head_mix_multi / gr_down_fused) | kernels | really ran |
| --- | --- | --- | --- |
| CP | false / false / false | `mtp_full_combine` 48 per graph, `mtp_full_gr_norm` 3.13 (5 launches per token), `chain_gr_split` 96 | none (the profile set only: attn_daily, gu_swiglu, side mixer/qsa/shared, fused qsa prelude) |
| CS | true / false / false | `leleka_verify_combine_k10_vec4` 48, `mtp_full_combine` 0, head chain still 5 per token | S11 |
| CH | true / true / false | head chain gone (`mtp_full_gr_norm` 0), head = `chain_gr_split` + down + `chain_gr_up8` (3 launches), `chain_gr_split` 97 | S11 + S9 |
| CD | true / true / true | `leleka_gr_down_fused_t2w8` 96, `chain_gr_split` 1 and `chain_gr_down_t2w8_nb4` 1 (the head's own read, which U5a does not touch), `chain_gr_up8` 97 | S11 + S9 + U5a |
| CZ | true / true / true | as CD | S11 + S9 + U5a (the repeat of CD) |
So the increments are S11 = CS - CP, S9 = CH - CS, U5a = CD - CH, noise = CZ - CD. Nothing in the data is an isolated
S9 or U5a (each also runs on top of S11, and U5a on top of S9); the increments are valid as section deltas because the
sections do not overlap: the combine kernel (S11), the five-launch head chain after the last layer (S9), and the layer
halves' hyper-connection split + down (U5a). The unchanged kernels are the control: `chain_gr_up8` is 7.36 / 7.36 / 7.36 /
7.39 / 7.39 us at T 2 across the five windows and `chain_gr_split` / `chain_gr_down_t2w8_nb4` are identical in CP, CS, CH
to 0.03 us. The traces' `meta.txt` record exe `/data/leleka-e2e/codex-compare/ours-prefix/bin/leleka-inference` (the job
names `bin-s11-s9-u5a`); the kernels above show the new code is in it.
## 2. Windows and sections
Verify graph = at least 900 kernels per correlation id, the first and last two dropped (the same rule as
`ffn_phase_timeline.py`); T = the grid of `chain_copy_rows_from_mapped_kernel` / 10. Kept graphs 845 / 864 / 785 / 767 /
920 (CP/CS/CH/CD/CZ); per T (CP/CS/CH/CD/CZ): T1 38/44/55/29/50, T2 271/295/149/224/278, T3 286/269/297/150/372, T4
114/181/100/167/132, T5 88/41/137/94/57, T6 27/17/27/38/21 (T7, T8 have 2-34 graphs and are left out; T5 and T6 are thin in
some windows). Sections (all per graph; "span" includes the gaps between the kernels):
* combine: the routed-expert combine, one launch per layer (48 a graph).
* head: the kernels after the last `mtp_full_native_write` up to the `head_quant` that feeds the language-model head.
* pair: a layer half's `chain_gr_split` + `chain_gr_down_t2w8_nb4` (96 per graph), or `leleka_gr_down_fused_t2w8`.
* read: that instance up to the end of `chain_gr_up8` (the whole hyper-connection read of a layer half).
* GR role: every hyper-connection kernel of the graph (layers and head).
## 3. Per-launch durations (p50, us; launches per graph in the appendix)
At T=3 (T=2 and T=3 are the commonest windows; all T in the appendix, section 2):
| kernel | CP | CS | CH | CD | CZ |
| --- | ---: | ---: | ---: | ---: | ---: |
| `mtp_full_combine` / `leleka_verify_combine_k10_vec4` (48 per graph) | 1.50 | 1.15 | 1.15 | 1.15 | 1.15 |
| K10 `chain_gr_split` (96 per graph, 97 with the head's) | 3.04 | 3.04 | 3.04 | gone (1 per graph) | gone |
| `chain_gr_down_t2w8_nb4` | 10.53 | 10.53 | 10.53 | gone | gone |
| `leleka_gr_down_fused_t2w8` (96 per graph) | - | - | - | 15.29 | 15.26 |
| pair (split + down, or fused), per layer half | 13.60 | 13.60 | 13.60 | 15.29 | 15.26 |
| `chain_gr_up8` | 8.00 | 8.00 | 8.00 | 8.03 | 8.03 |
| read span per layer half (split/fused start to up8 end) | 21.95 | 21.92 | 21.92 | 23.55 | 23.52 |
| head launches per graph | 15 | 15 | 3 | 3 | 3 |
| head kernel time / head span, us per graph | 44.3 / 45.9 | 44.2 / 45.7 | 20.9 / 21.4 | 20.9 / 21.4 | 20.8 / 21.3 |
| GR role kernel time, us per graph | 2076 | 2075 | 2097 | 2259 | 2256 |
Fused kernel by window rows (p50 us, CD): T1 12.64, T2 15.52, T3 15.29, T4 15.68, T5 16.13, T6 16.74. The pair it replaces
(CH): 11.17, 13.06, 13.60, 14.24, 15.84, 16.80. The fused kernel's cost is nearly flat in T while the pair's grows, so it
loses at T 1-4 (where most graphs are) and breaks even at T 5-6. K10: `chain_gr_split` is 3.04-3.14 us (96 per graph = 0.29-0.30 ms
a graph) in the three windows that have it; U5a removes it but costs more than it removes. The back-to-back launch gap
inside the pair is only 0.1 us (pair span minus pair kernel time), so there is no launch saving for the fuse to win.
Kernel counts: S11 changes none; S9 removes 7 / 12 / 17 / 22 / 27 kernels at T 2..6 (CH minus CS kernels per graph
= `5T - 3`, appendix section 5); U5a removes 96.
## 4. Section deltas, noise and resolvability (ms per graph; p50 delta, T 1..6)
| increment | section | T1 | T2 | T3 | T4 | T5 | T6 | weighted | noise (CZ-CD), T1..T6 |
| --- | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | --- |
| S11 (CS-CP) | combine kernel time | -0.0174 | -0.0166 | -0.0167 | -0.0165 | -0.0150 | -0.0144 | -0.0164 | -0.0001 .. +0.0004 |
| S9 (CH-CS) | head kernel time | -0.0004 | -0.0112 | -0.0233 | -0.0354 | -0.0464 | -0.0583 | -0.0223 | <= 0.0001 |
| S9 (CH-CS) | head span (gaps incl.) | -0.0004 | -0.0118 | -0.0244 | -0.0368 | -0.0482 | -0.0605 | -0.0233 | <= 0.0001 |
| U5a (CD-CH) | pair kernel time (96 layer halves) | +0.1438 | +0.2379 | +0.1598 | +0.1460 | +0.0325 | +0.0256 | +0.1445 | -0.0046 .. +0.0005 |
| U5a (CD-CH) | pair span | +0.1344 | +0.2285 | +0.1504 | +0.1365 | +0.0229 | +0.0161 | +0.1351 | same |
| U5a (CD-CH) | GR role kernel time | +0.1408 | +0.2399 | +0.1619 | +0.1485 | +0.0339 | +0.0272 | +0.1462 | -0.0042 .. +0.0017 |
Per launch (us; p50): S11 combine -0.38 / -0.35 / -0.35 / -0.35 / -0.32 / -0.29; U5a pair per layer half +1.47 / +2.46 /
+1.69 / +1.44 / +0.32 / -0.10 (the mean at T6 is +0.31, so T6 is a tie at best), noise within 0.03 us (the p50 of the
combine moves in steps of about 0.03 us). Per layer half for S11, whose launch is one per layer, divide by two:
about -0.17 us per layer half.
How to read the noise: CZ and CD are the same configuration in two sessions. Their section values differ by at most 0.005
ms per graph and 0.03 us per launch, so every delta above is at least 3 times the repeat's own delta (S11 more than 30 times) and is resolved by the
script's rule (p50 and mean agree in sign, the mean delta above two standard errors, both above the repeat). Spread across
T is not noise: S9 follows the 5T-3 launches saved (1.6-2.2 us per saved launch, below); U5a depends on T
because the pair cost does; S11 is flat (one launch a layer).
What the noise does not cover: a systematic difference that every window of one configuration shares (clock state, the
placement of the weights in memory), because there is one repeat pair only and it is the configuration with all three
switches. The controls (kernels no switch touches) agree across the five windows to 0.03-0.04 us, so no such offset is
visible.
S9 per saved launch: head kernel time falls by 11.2 / 23.3 / 35.5 / 46.5 / 58.3 us (T 2..6) for 7 / 12 / 17 / 22 / 27 saved
launches, about 1.6-2.2 us each (these include the work of the removed norm / gemv / silu / gemv / pre-final kernels
against the multi-token kernels, not only the launch).
## 5. What to enable
* S11 `COMBINE_VEC4`: bitwise (identity P2 PASS, 2057/2057 rows, draft trace 1036/1036, A/A identical) and its section delta
is -0.0144 .. -0.0174 ms per graph (-0.35 us on each of 48 launches) with a noise of <= 0.0004. By the rule of this
step it is enabled by default in the 5090 profiles. The gain is about 0.15 % of a T=3 graph (11 ms, p50 of the windows;
graph totals are session dependent, section 6), well under the ledger's first estimate (0.05-0.10 ms; the ledger's own
expectation of 0.01-0.02 was right).
* S9 `HEAD_MIX_MULTI`: not bitwise (25 of 2057 rows, d_top1 max 0.0015, argmax flips 0), so OFF regardless of the delta,
which is real but small: -0.012 to -0.060 ms per graph for T 2..6 (weighted -0.023), well below the ledger's estimate of
0.06-0.10. It would need its own quality gate; the data above is its section delta for that decision.
* U5a `GR_DOWN_FUSED`: bitwise (identity PASS per the orchestrator; the ledger row still lists P4/P5 as queued) but the fused
kernel is slower in the graph than the two kernels it replaces at T 1-6 (+0.03 .. +0.24 ms per graph, +0.145 weighted), so do not enable. The earlier microbench
(`verify-hc-down-kernel-microbench-vs-upstream`: ours slower than upstream's by 3.1-5.9 us per layer half, cold weights)
suggested a gain from overlapping the weights' DRAM fetch with staging; in the graph the fused kernel (191 registers,
81,920 B shared) takes 15.3-16.7 us against 13.1-16.8 us for the pair. The reason is not measured here (candidates: the
shared-memory staging in front of the dots is serial inside one block, occupancy at 191 registers); a per-instruction
look at the kernel would settle it. The remaining gap of ours to upstream's `gr_down_v3` is therefore still open (K8-K10).
Not decided by these windows: how the three behave together in the e2e A/B (the group A/B), and any effect through the
side streams (the fused kernel's 81,920 B shared block could interact with concurrent side-stream kernels; its duration
here already includes that).
## 6. Verify graph duration (sanity total only)
Graph span p50 per window and T is in the appendix (section 5). It cannot resolve any of the increments: the repeat pair
CZ and CD (same configuration) differs by -214 / -385 / -717 / -157 / -1383 / -729 us at T 1..6 (CZ-CD), i.e. 0.16-1.4 ms,
as large as or far larger than every section delta (S11 0.014-0.017, S9 up to 0.06, U5a 0.03-0.24 ms). The windows are separate sessions with different expert-tier state (the
FFN phase differs between sessions, as in C2v), and T mixes inside a T are not controlled. The graph totals do not track
the switches (for example CH is above CS at T 1-3). Only the section deltas above are comparable across windows.
## Reproduce
```
R=/data/leleka-e2e/spd-gap/runs/verify-s11-s9-u5a-cupti-windows
for v in CP CS CH CD CZ; do
ssh rnr5090 "nice python3 -B - extract $R/$v.1/win-r29.lct $v --engine-log $R/$v.1/engine.log" \
< scripts/e2e/codex/speed/window_increment_report.py > $v.json
done
python3 scripts/e2e/codex/speed/window_increment_report.py report CP.json CS.json CH.json CD.json CZ.json
```
The script is read-only on the server (the script goes in on stdin; `lct.py` may write its demangled-name cache next to the
trace as it does for every reader). The extracted JSON summaries (25 KB each) are not committed.
Method limits: kernel durations and spans are CUPTI timestamps; a section's span is its first kernel's start to its last
kernel's end. The combine, head and pair are on the main stream (serial), so their duration deltas are critical-path time
within the graph unless a wait absorbs them (the combine waits for the join; a saving before a wait could be absorbed by
that wait's slack, as in the ffn-phase design note). The pair and read spans were measured in the layers only; the head's own
read is counted under S9 (the head section) and in the GR role total.
## Appendix: full output of `window_increment_report.py report`
Windows: CP = /data/leleka-e2e/spd-gap/runs/verify-s11-s9-u5a-cupti-windows/CP.1/win-r29.lct, CS = /data/leleka-e2e/spd-gap/runs/verify-s11-s9-u5a-cupti-windows/CS.1/win-r29.lct, CH = /data/leleka-e2e/spd-gap/runs/verify-s11-s9-u5a-cupti-windows/CH.1/win-r29.lct, CD = /data/leleka-e2e/spd-gap/runs/verify-s11-s9-u5a-cupti-windows/CD.1/win-r29.lct, CZ = /data/leleka-e2e/spd-gap/runs/verify-s11-s9-u5a-cupti-windows/CZ.1/win-r29.lct
T values with at least 15 graphs in every window: [1, 2, 3, 4, 5, 6]
### 1. Switches each window ran
Launches per verify graph of the switch kernels (all graphs of the window), and the switch line of the engine log (`requested Sm120Switches`).
| kernel | CP | CS | CH | CD | CZ |
| --- | ---: | ---: | ---: | ---: | ---: |
| `mtp_full_combine` | 48.00 | 0.00 | 0.00 | 0.00 | 0.00 |
| `leleka_verify_combine_k10_vec4` | 0.00 | 48.00 | 48.00 | 48.00 | 48.00 |
| `mtp_full_gr_norm` | 3.13 | 3.00 | 0.00 | 0.00 | 0.00 |
| `mtp_full_down_silu` | 3.13 | 3.00 | 0.00 | 0.00 | 0.00 |
| `mtp_full_pre_final` | 3.13 | 3.00 | 0.00 | 0.00 | 0.00 |
| `mtp_full_native_write` | 6.27 | 6.01 | 6.74 | 7.25 | 5.94 |
| `chain_gr_split` | 96.00 | 96.00 | 97.00 | 1.00 | 1.00 |
| `chain_gr_down_t2w8_nb4` | 96.00 | 96.00 | 97.00 | 1.00 | 1.00 |
| `leleka_gr_down_fused_t2w8` | 0.00 | 0.00 | 0.00 | 96.00 | 96.00 |
| `chain_gr_up8` | 96.00 | 96.00 | 97.00 | 97.00 | 97.00 |
| engine log: combine_vec4 / head_mix_multi / gr_down_fused | false/false/false | true/false/false | true/true/false | true/true/true | true/true/true |
| **ran** (from the kernels) | none | S11 | S11+S9 | S11+S9+U5a | S11+S9+U5a |
### 2. Per-launch p50 duration (us) and launches per graph, by window rows T
Cell: p50 per-launch duration (launches per graph). `pair_dur` = split + down kernel time (U5a: the fused kernel), `pair_span` = split start to down end, `read_span` = split/fused start to `chain_gr_up8` end, all per layer half.
T=1 (graphs 38 / 44 / 55 / 29 / 50)
| kernel | CP | CS | CH | CD | CZ |
| --- | ---: | ---: | ---: | ---: | ---: |
| combine | 1.47 (48.0) | 1.09 (48.0) | 1.09 (48.0) | 1.12 (48.0) | 1.09 (48.0) |
| split | 3.07 (96.0) | 3.07 (96.0) | 3.07 (96.0) | - | - |
| down | 8.03 (96.0) | 8.06 (96.0) | 8.03 (96.0) | - | - |
| fused | - | - | - | 12.64 (96.0) | 12.64 (96.0) |
| up | 6.43 (96.0) | 6.43 (96.0) | 6.43 (96.0) | 6.37 (96.0) | 6.37 (96.0) |
| pair_dur | 11.17 (96.0) | 11.20 (96.0) | 11.17 (96.0) | 12.64 (96.0) | 12.64 (96.0) |
| pair_span | 11.30 (96.0) | 11.30 (96.0) | 11.26 (96.0) | 12.64 (96.0) | 12.64 (96.0) |
| read_span | 17.92 (96.0) | 17.92 (96.0) | 17.92 (96.0) | 19.26 (96.0) | 19.26 (96.0) |
| head launches per graph (mean) | 5.00 | 5.00 | 3.00 | 3.00 | 3.00 |
| head kernel time, us per graph (p50) | 17.25 | 17.15 | 16.77 | 16.93 | 16.80 |
| head span, us per graph (p50) | 17.82 | 17.70 | 17.25 | 17.44 | 17.31 |
| GR kernels per graph (mean) | 288.00 | 288.00 | 291.00 | 195.00 | 195.00 |
| GR kernel time, us per graph (p50) | 1690.23 | 1691.43 | 1706.37 | 1847.15 | 1848.84 |
T=2 (graphs 271 / 295 / 149 / 224 / 278)
| kernel | CP | CS | CH | CD | CZ |
| --- | ---: | ---: | ---: | ---: | ---: |
| combine | 1.50 (48.0) | 1.15 (48.0) | 1.15 (48.0) | 1.15 (48.0) | 1.15 (48.0) |
| split | 3.14 (96.0) | 3.14 (96.0) | 3.14 (96.0) | - | - |
| down | 9.89 (96.0) | 9.89 (96.0) | 9.89 (96.0) | - | - |
| fused | - | - | - | 15.52 (96.0) | 15.49 (96.0) |
| up | 7.36 (96.0) | 7.36 (96.0) | 7.36 (96.0) | 7.39 (96.0) | 7.39 (96.0) |
| pair_dur | 13.06 (96.0) | 13.06 (96.0) | 13.06 (96.0) | 15.52 (96.0) | 15.49 (96.0) |
| pair_span | 13.15 (96.0) | 13.15 (96.0) | 13.15 (96.0) | 15.52 (96.0) | 15.49 (96.0) |
| read_span | 20.70 (96.0) | 20.74 (96.0) | 20.74 (96.0) | 23.14 (96.0) | 23.10 (96.0) |
| head launches per graph (mean) | 10.00 | 10.00 | 3.00 | 3.00 | 3.00 |
| head kernel time, us per graph (p50) | 30.75 | 30.88 | 19.65 | 19.62 | 19.62 |
| head span, us per graph (p50) | 31.81 | 31.94 | 20.16 | 20.13 | 20.10 |
| GR kernels per graph (mean) | 288.00 | 288.00 | 291.00 | 195.00 | 195.00 |
| GR kernel time, us per graph (p50) | 1961.51 | 1962.07 | 1981.00 | 2220.94 | 2217.74 |
T=3 (graphs 286 / 269 / 297 / 150 / 372)
| kernel | CP | CS | CH | CD | CZ |
| --- | ---: | ---: | ---: | ---: | ---: |
| combine | 1.50 (48.0) | 1.15 (48.0) | 1.15 (48.0) | 1.15 (48.0) | 1.15 (48.0) |
| split | 3.04 (96.0) | 3.04 (96.0) | 3.04 (96.0) | - | - |
| down | 10.53 (96.0) | 10.53 (96.0) | 10.53 (96.0) | - | - |
| fused | - | - | - | 15.29 (96.0) | 15.26 (96.0) |
| up | 8.00 (96.0) | 8.00 (96.0) | 8.00 (96.0) | 8.03 (96.0) | 8.03 (96.0) |
| pair_dur | 13.60 (96.0) | 13.60 (96.0) | 13.60 (96.0) | 15.29 (96.0) | 15.26 (96.0) |
| pair_span | 13.70 (96.0) | 13.70 (96.0) | 13.70 (96.0) | 15.29 (96.0) | 15.26 (96.0) |
| read_span | 21.95 (96.0) | 21.92 (96.0) | 21.92 (96.0) | 23.55 (96.0) | 23.52 (96.0) |
| head launches per graph (mean) | 15.00 | 15.00 | 3.00 | 3.00 | 3.00 |
| head kernel time, us per graph (p50) | 44.32 | 44.19 | 20.86 | 20.87 | 20.83 |
| head span, us per graph (p50) | 45.86 | 45.73 | 21.38 | 21.38 | 21.34 |
| GR kernels per graph (mean) | 288.00 | 288.00 | 291.00 | 195.00 | 195.00 |
| GR kernel time, us per graph (p50) | 2076.20 | 2075.18 | 2096.91 | 2258.83 | 2255.82 |
T=4 (graphs 114 / 181 / 100 / 167 / 132)
| kernel | CP | CS | CH | CD | CZ |
| --- | ---: | ---: | ---: | ---: | ---: |
| combine | 1.50 (48.0) | 1.15 (48.0) | 1.15 (48.0) | 1.15 (48.0) | 1.18 (48.0) |
| split | 3.07 (96.0) | 3.07 (96.0) | 3.07 (96.0) | - | - |
| down | 11.14 (96.0) | 11.14 (96.0) | 11.17 (96.0) | - | - |
| fused | - | - | - | 15.68 (96.0) | 15.65 (96.0) |
| up | 8.80 (96.0) | 8.80 (96.0) | 8.80 (96.0) | 8.83 (96.0) | 8.83 (96.0) |
| pair_dur | 14.24 (96.0) | 14.24 (96.0) | 14.24 (96.0) | 15.68 (96.0) | 15.65 (96.0) |
| pair_span | 14.34 (96.0) | 14.34 (96.0) | 14.34 (96.0) | 15.68 (96.0) | 15.65 (96.0) |
| read_span | 23.36 (96.0) | 23.36 (96.0) | 23.39 (96.0) | 24.70 (96.0) | 24.67 (96.0) |
| head launches per graph (mean) | 20.00 | 20.00 | 3.00 | 3.00 | 3.00 |
| head kernel time, us per graph (p50) | 57.60 | 57.54 | 22.14 | 22.14 | 22.05 |
| head span, us per graph (p50) | 59.65 | 59.55 | 22.72 | 22.72 | 22.66 |
| GR kernels per graph (mean) | 288.00 | 288.00 | 291.00 | 195.00 | 195.00 |
| GR kernel time, us per graph (p50) | 2213.10 | 2213.97 | 2238.99 | 2387.47 | 2385.33 |
T=5 (graphs 88 / 41 / 137 / 94 / 57)
| kernel | CP | CS | CH | CD | CZ |
| --- | ---: | ---: | ---: | ---: | ---: |
| combine | 1.54 (48.0) | 1.22 (48.0) | 1.22 (48.0) | 1.22 (48.0) | 1.22 (48.0) |
| split | 3.10 (96.0) | 3.10 (96.0) | 3.10 (96.0) | - | - |
| down | 12.70 (96.0) | 12.70 (96.0) | 12.70 (96.0) | - | - |
| fused | - | - | - | 16.13 (96.0) | 16.10 (96.0) |
| up | 9.82 (96.0) | 9.86 (96.0) | 9.82 (96.0) | 9.86 (96.0) | 9.82 (96.0) |
| pair_dur | 15.84 (96.0) | 15.84 (96.0) | 15.81 (96.0) | 16.13 (96.0) | 16.10 (96.0) |
| pair_span | 15.94 (96.0) | 15.94 (96.0) | 15.94 (96.0) | 16.13 (96.0) | 16.10 (96.0) |
| read_span | 25.98 (96.0) | 25.98 (96.0) | 25.98 (96.0) | 26.18 (96.0) | 26.14 (96.0) |
| head launches per graph (mean) | 25.00 | 25.00 | 3.00 | 3.00 | 3.00 |
| head kernel time, us per graph (p50) | 71.26 | 71.20 | 24.80 | 24.80 | 24.77 |
| head span, us per graph (p50) | 73.76 | 73.70 | 25.47 | 25.47 | 25.44 |
| GR kernels per graph (mean) | 288.00 | 288.00 | 291.00 | 195.00 | 195.00 |
| GR kernel time, us per graph (p50) | 2466.25 | 2464.31 | 2489.36 | 2523.24 | 2520.98 |
T=6 (graphs 27 / 17 / 27 / 38 / 21)
| kernel | CP | CS | CH | CD | CZ |
| --- | ---: | ---: | ---: | ---: | ---: |
| combine | 1.54 (48.0) | 1.25 (48.0) | 1.25 (48.0) | 1.28 (48.0) | 1.28 (48.0) |
| split | 3.10 (96.0) | 3.10 (96.0) | 3.10 (96.0) | - | - |
| down | 13.66 (96.0) | 13.70 (96.0) | 13.66 (96.0) | - | - |
| fused | - | - | - | 16.74 (96.0) | 16.70 (96.0) |
| up | 10.75 (96.0) | 10.75 (96.0) | 10.75 (96.0) | 10.72 (96.0) | 10.72 (96.0) |
| pair_dur | 16.80 (96.0) | 16.80 (96.0) | 16.83 (96.0) | 16.74 (96.0) | 16.70 (96.0) |
| pair_span | 16.90 (96.0) | 16.90 (96.0) | 16.93 (96.0) | 16.74 (96.0) | 16.70 (96.0) |
| read_span | 27.84 (96.0) | 27.87 (96.0) | 27.87 (96.0) | 27.68 (96.0) | 27.68 (96.0) |
| head launches per graph (mean) | 30.00 | 30.00 | 3.00 | 3.00 | 3.00 |
| head kernel time, us per graph (p50) | 84.83 | 84.74 | 26.46 | 26.43 | 26.37 |
| head span, us per graph (p50) | 87.84 | 87.71 | 27.17 | 27.10 | 27.07 |
| GR kernels per graph (mean) | 288.00 | 288.00 | 291.00 | 195.00 | 195.00 |
| GR kernel time, us per graph (p50) | 2649.94 | 2649.74 | 2675.83 | 2702.99 | 2702.51 |
### 3. Increments and noise
Delta = later window minus earlier. Cell: p50 / mean of the per-graph value in ms per graph (negative = the later window is faster), then the verdict against the repeat pair (CZ minus CD, the same configuration). Noise rows give that repeat's own p50 / mean delta.
**S11 combine vec4 (CS - CP)**
| section | T=1 | T=2 | T=3 | T=4 | T=5 | T=6 |
| --- | ---: | ---: | ---: | ---: | ---: | ---: |
| combine kernel time per graph | -0.0174 / -0.0173 (resolved) | -0.0166 / -0.0166 (resolved) | -0.0167 / -0.0167 (resolved) | -0.0165 / -0.0166 (resolved) | -0.0150 / -0.0152 (resolved) | -0.0144 / -0.0145 (resolved) |
| noise: combine kernel time per graph | -0.0001 / -0.0001 | -0.0001 / -0.0002 | +0.0001 / +0.0001 | +0.0001 / +0.0001 | +0.0003 / +0.0004 | +0.0004 / +0.0003 |
Per launch (us, p50 / mean; the combine is one launch per layer, the pair one per layer half):
| per launch | T=1 | T=2 | T=3 | T=4 | T=5 | T=6 |
| --- | ---: | ---: | ---: | ---: | ---: | ---: |
| combine launch | -0.38 / -0.36 | -0.35 / -0.35 | -0.35 / -0.35 | -0.35 / -0.34 | -0.32 / -0.32 | -0.29 / -0.30 |
| noise: combine launch | -0.03 / -0.00 | +0.00 / -0.00 | +0.00 / +0.00 | +0.03 / +0.00 | +0.00 / +0.01 | +0.00 / +0.01 |
**S9 head mix multi (CH - CS)**
| section | T=1 | T=2 | T=3 | T=4 | T=5 | T=6 |
| --- | ---: | ---: | ---: | ---: | ---: | ---: |
| head kernel time per graph | -0.0004 / -0.0004 (resolved) | -0.0112 / -0.0112 (resolved) | -0.0233 / -0.0233 (resolved) | -0.0354 / -0.0355 (resolved) | -0.0464 / -0.0465 (resolved) | -0.0583 / -0.0582 (resolved) |
| noise: head kernel time per graph | -0.0001 / -0.0000 | +0.0000 / -0.0000 | -0.0000 / -0.0001 | -0.0001 / -0.0000 | -0.0000 / -0.0000 | -0.0001 / +0.0000 |
| head span per graph | -0.0004 / -0.0005 (resolved) | -0.0118 / -0.0118 (resolved) | -0.0244 / -0.0243 (resolved) | -0.0368 / -0.0369 (resolved) | -0.0482 / -0.0483 (resolved) | -0.0605 / -0.0605 (resolved) |
| noise: head span per graph | -0.0001 / -0.0000 | -0.0000 / -0.0000 | -0.0000 / -0.0001 | -0.0001 / -0.0000 | -0.0000 / -0.0000 | -0.0000 / +0.0000 |
**U5a fused HC down (CD - CH)**
| section | T=1 | T=2 | T=3 | T=4 | T=5 | T=6 |
| --- | ---: | ---: | ---: | ---: | ---: | ---: |
| pair kernel time per graph (layers) | +0.1438 / +0.1438 (resolved) | +0.2379 / +0.2380 (resolved) | +0.1598 / +0.1604 (resolved) | +0.1460 / +0.1471 (resolved) | +0.0325 / +0.0327 (resolved) | +0.0256 / +0.0299 (resolved) |
| noise: pair kernel time per graph (layers) | +0.0005 / +0.0006 | -0.0026 / -0.0029 | -0.0023 / -0.0026 | -0.0012 / -0.0021 | -0.0023 / -0.0023 | +0.0005 / -0.0046 |
| pair span per graph (layers) | +0.1344 / +0.1344 (resolved) | +0.2285 / +0.2285 (resolved) | +0.1504 / +0.1509 (resolved) | +0.1365 / +0.1376 (resolved) | +0.0229 / +0.0233 (resolved) | +0.0161 / +0.0205 (resolved) |
| noise: pair span per graph (layers) | +0.0005 / +0.0006 | -0.0026 / -0.0029 | -0.0023 / -0.0026 | -0.0012 / -0.0021 | -0.0023 / -0.0023 | +0.0005 / -0.0046 |
| read span per graph (layers) | +0.1318 / +0.1318 (resolved) | +0.2298 / +0.2300 (resolved) | +0.1523 / +0.1532 (resolved) | +0.1391 / +0.1387 (resolved) | +0.0244 / +0.0252 (resolved) | +0.0169 / +0.0185 (resolved) |
| noise: read span per graph (layers) | +0.0017 / +0.0010 | -0.0032 / -0.0029 | -0.0029 / -0.0033 | -0.0019 / -0.0021 | -0.0028 / -0.0037 | -0.0003 / -0.0044 |
| GR role kernel time per graph | +0.1408 / +0.1410 (resolved) | +0.2399 / +0.2399 (resolved) | +0.1619 / +0.1629 (resolved) | +0.1485 / +0.1485 (resolved) | +0.0339 / +0.0349 (resolved) | +0.0272 / +0.0283 (resolved) |
| noise: GR role kernel time per graph | +0.0017 / +0.0010 | -0.0032 / -0.0029 | -0.0030 / -0.0035 | -0.0021 / -0.0021 | -0.0023 / -0.0038 | -0.0005 / -0.0042 |
Per launch (us, p50 / mean; the combine is one launch per layer, the pair one per layer half):
| per launch | T=1 | T=2 | T=3 | T=4 | T=5 | T=6 |
| --- | ---: | ---: | ---: | ---: | ---: | ---: |
| pair kernel time per layer half | +1.47 / +1.50 | +2.46 / +2.48 | +1.69 / +1.67 | +1.44 / +1.53 | +0.32 / +0.34 | -0.10 / +0.31 |
| noise: pair kernel time per layer half | +0.00 / +0.01 | -0.03 / -0.03 | -0.03 / -0.03 | -0.03 / -0.02 | -0.03 / -0.02 | -0.03 / -0.05 |
| pair span per layer half | +1.38 / +1.40 | +2.37 / +2.38 | +1.60 / +1.57 | +1.34 / +1.43 | +0.19 / +0.24 | -0.19 / +0.21 |
| noise: pair span per layer half | +0.00 / +0.01 | -0.03 / -0.03 | -0.03 / -0.03 | -0.03 / -0.02 | -0.03 / -0.02 | -0.03 / -0.05 |
| read span per layer half | +1.34 / +1.37 | +2.40 / +2.40 | +1.63 / +1.60 | +1.31 / +1.44 | +0.19 / +0.26 | -0.19 / +0.19 |
| noise: read span per layer half | +0.00 / +0.01 | -0.03 / -0.03 | -0.03 / -0.03 | -0.03 / -0.02 | -0.03 / -0.04 | +0.00 / -0.05 |
### 4. Section delta weighted by the earlier window's T mix (ms per graph, p50 deltas)
| increment | section | delta | repeat delta | spread over T (min .. max) |
| --- | --- | ---: | ---: | --- |
| S11 combine vec4 | combine kernel time per graph | -0.0164 | +0.0001 | -0.0174 .. -0.0144 |
| S9 head mix multi | head kernel time per graph | -0.0223 | -0.0000 | -0.0583 .. -0.0004 |
| S9 head mix multi | head span per graph | -0.0233 | -0.0000 | -0.0605 .. -0.0004 |
| U5a fused HC down | pair kernel time per graph (layers) | +0.1445 | -0.0019 | +0.0256 .. +0.2379 |
| U5a fused HC down | pair span per graph (layers) | +0.1351 | -0.0019 | +0.0161 .. +0.2285 |
| U5a fused HC down | read span per graph (layers) | +0.1365 | -0.0024 | +0.0169 .. +0.2298 |
| U5a fused HC down | GR role kernel time per graph | +0.1462 | -0.0024 | +0.0272 .. +0.2399 |
### 5. Verify graph duration (first kernel start to last kernel end), p50 us (kernels per graph, p50)
Sanity total only: each window is its own session, so the expert-tier state differs between windows (compare within one T and one window, not as a section delta).
| T | CP | CS | CH | CD | CZ |
| --- | ---: | ---: | ---: | ---: | ---: |
| 1 | 7890.20 (1947.00) | 8027.41 (1947.00) | 8156.21 (1945.00) | 7821.84 (1849.00) | 7608.08 (1849.00) |
| 2 | 9604.35 (1964.00) | 9661.09 (1964.00) | 9975.27 (1957.00) | 9612.25 (1861.00) | 9227.32 (1861.00) |
| 3 | 11301.74 (1981.00) | 10905.99 (1981.00) | 11348.62 (1969.00) | 11265.48 (1873.00) | 10548.71 (1873.00) |
| 4 | 12680.79 (1998.00) | 13328.28 (1998.00) | 13666.17 (1981.00) | 12973.65 (1885.00) | 12816.12 (1885.00) |
| 5 | 16565.90 (2015.00) | 16159.98 (2015.00) | 16004.52 (1993.00) | 16082.47 (1897.00) | 14699.87 (1897.00) |
| 6 | 20303.08 (2032.00) | 22917.43 (2032.00) | 20295.30 (2005.00) | 18194.33 (1909.00) | 17465.17 (1909.00) |
@@ -0,0 +1,31 @@
#!/usr/bin/env bash
# Bitwise probes of the three FFN-phase switches of the verify graph, kernel level, before the teacher-forced identity job (ledger rows S7/D1, D2, D3):
# sm120_probe down : LELEKA_SM120_DOWN_SUB16 (sm120_moe_down_20/_42) against window_moe_down_<T>, T 1-8, 0-16 groups, grid.y cap and 4
# sm120_probe_hits : LELEKA_SM120_HITS_IN_COMBINE (leleka_verify_combine_k10_vec4_hits) against add_hits + combine (scalar and vec4), signed zeros
# sm120_probe_waitrows : LELEKA_SM120_WAIT_M_ROWS (leleka_verify_wait_copy_rows) against wait M + copy rows, late flag, T 1-8
# Small GPU job (minutes, no model): takes /data/leleka-e2e/gpu.lock like the other short stubs. Inputs are frozen in the directory below (MANIFEST.sha256, built in WSL from
# the speed-vs-strata branch merge of ffn-down-sub16, ffn-hits-combine, ffn-wait-m-rows); the job refuses to run on a mismatch and runs copies with the executable bit.
set -uo pipefail
D=/data/leleka-e2e/spd-gap/probes/verify-ffn-d1-d2-d3-bitwise-probes
LOCK=/data/leleka-e2e/gpu.lock
NAME=verify-ffn-d1-d2-d3-bitwise-probes
OUT=$D/../$NAME.result.txt
export LD_LIBRARY_PATH=$HOME/cuda-toolkits/13.2.2/lib64:${LD_LIBRARY_PATH:-}
cd "$D" || { echo "no $D"; exit 2; }
sha256sum --quiet -c MANIFEST.sha256 || { echo "MANIFEST.sha256 does not match the files in $D"; exit 5; }
RUN=$D/../$NAME.exec
rm -rf "$RUN"; mkdir -p "$RUN" && cp -r down hits waitrows "$RUN"/ && chmod -R u+rwx "$RUN" || { echo "cannot stage $RUN"; exit 6; }
got=0
for _ in $(seq 1 360); do
if mkdir "$LOCK" 2>/dev/null; then echo "$NAME $(date -u +%FT%TZ)" >"$LOCK/owner"; got=1; break; fi
sleep 5
done
[ $got = 1 ] || { echo "GPU lock held by: $(cat "$LOCK/owner" 2>/dev/null)"; exit 3; }
release() { if grep -q "$NAME" "$LOCK/owner" 2>/dev/null; then rm -f "$LOCK/owner"; rmdir "$LOCK"; fi; }
trap release EXIT
{
date -u +%FT%TZ; nvidia-smi --query-gpu=name,driver_version --format=csv,noheader
echo "== sm120_probe down (D1)"; timeout 900 "$RUN"/down/sm120_probe "$RUN"/down/ptx down; echo "exit $?"
echo "== sm120_probe_hits (D2)"; timeout 900 "$RUN"/hits/sm120_probe_hits "$RUN"/hits/ptx; echo "exit $?"
echo "== sm120_probe_waitrows (D3)"; timeout 900 "$RUN"/waitrows/sm120_probe_waitrows "$RUN"/waitrows/ptx; echo "exit $?"
} 2>&1 | tee "$OUT"
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
# CUPTI windows (request 29, 15 s) of the 5090 profile set (CP, control) and CP + each FFN-phase verify switch: WD down sub16 (D1), WH hits in combine (D2), WW wait M + rows (D3), WZ all three.
# The window job unsets the per-variant switches between variants, so the variants are independent (the S11/S9/U5a windows were cumulative before that fix).
unset SPD_VARIANTS SPD_CELLS SPD_OUT SPD_MAX SPD_TUNES SPD_BIN
export SPD_BIN=/data/leleka-e2e/spd-gap/bin-ffn-switches SPD_VARIANTS="CP.1 WD.1 WH.1 WW.1 WZ.1" SPD_MAX=30 SPD_CELLS=/data/leleka-e2e/codex-compare/runs/main/VANL/nestng-crm-r2 SPD_OUT=/data/leleka-e2e/spd-gap/runs/verify-ffn-d1-d2-d3-cupti-windows SPD_TRIG_AT=28 SPD_WIN_S=15
exec bash /data/leleka-e2e/spd-gap/tools/spd_ab_job_x.sh
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
# identity gate (teacher forced, one test binary rt-ffn-switches) of the three FFN-phase verify switches; reference = idP1.full of verify-new-switches-identity (lever 1 + MTP attention, switches off), SKIP_P1=1
# P2 DOWN_SUB16 (D1), P3 HITS_IN_COMBINE (D2), P4 WAIT_M_ROWS (D3), P5 the 5090 profile set (SIDE_MIXER/QSA/SHARED, QSA prelude, fused commit) + all three; each process has the A/A pair I1/I2
export D=/data/leleka-e2e/spd-gap/dt ID_BIN=rt-ffn-switches ID_OUT=/data/leleka-e2e/spd-gap/runs/verify-ffn-d1-d2-d3-identity MAX_NEW=240 ADAPT=4 SKIP_P1=1
mkdir -p "$ID_OUT"; [ -f "$ID_OUT/idP1.full" ] || cp -p /data/leleka-e2e/spd-gap/runs/verify-s11-s9-u5a-identity/idP1.full "$ID_OUT/idP1.full"
B="LELEKA_SM120_ATTN_DAILY_MTP=1 LELEKA_SM120_ATTN_DAILY=1 LELEKA_SM120_GU_SWIGLU=1"
export P1_ENV="$B"
export P2_ENV="$B LELEKA_SM120_DOWN_SUB16=1"
export P3_ENV="$B LELEKA_SM120_HITS_IN_COMBINE=1"
export P4_ENV="$B LELEKA_SM120_WAIT_M_ROWS=1"
export P5_ENV="$B LELEKA_SM120_SIDE_MIXER=1 LELEKA_SM120_SIDE_QSA=1 LELEKA_SM120_SIDE_SHARED=1 LELEKA_SM120_FUSED_QSA_PRELUDE=1 LELEKA_DRAFT_FUSED_COMMIT=1 LELEKA_SM120_DOWN_SUB16=1 LELEKA_SM120_HITS_IN_COMBINE=1 LELEKA_SM120_WAIT_M_ROWS=1"
exec bash /data/leleka-e2e/spd-gap/tools/verify-switches-identity.sh
@@ -0,0 +1,356 @@
"""Section deltas between CUPTI windows that differ by one verify switch (ledger rows S11, S9, U5a, K10).
Offline analysis of CUPTI trace directories (tools/cupti-trace, `lct.py`); host-side Python, stdlib only, no GPU.
extract TRACE_DIR LABEL [--lct DIR] [--engine-log FILE] (python3 -B; reads the trace, writes JSON on stdout)
per window row count T (the CPU-row copy grid is T * 10 blocks) of every verify graph (>= 900 kernels per
correlation id, first and last two dropped): per-graph metrics and per-launch durations of the section kernels
(summaries n / mean / sd / p10 / p50 / p90), kernel names with launches per graph, the switch line of the
engine log. `--lct` defaults to /data/leleka-e2e/decode/tools (read only).
report CONTROL STEP1 STEP2 STEP3 REPEAT (five extract JSON files; markdown on stdout)
the switches each window ran (kernel-name evidence), per-T section tables, increments STEP1-CONTROL,
STEP2-STEP1, STEP3-STEP2 with their noise REPEAT-STEP3 (REPEAT is the same configuration as STEP3) and the verify
graph duration.
Sections (all per graph, kernel time = sum of kernel durations, span = first start to last end, gaps included):
combine `mtp_full_combine` (S11 off) or `leleka_verify_combine_k10_vec4` (S11 on): one launch per layer
head kernels after the last `mtp_full_native_write` up to the `head_quant` of the language-model head:
5 launches per token (S9 off) or the multi read (S9 on); span = from that write's end to that quantize
pair layer halves' hyper-connection split + down (`chain_gr_split` + `chain_gr_down*`) or the fused
`leleka_gr_down_fused*` (U5a); the head's instance is not counted here
read the same instance up to `chain_gr_up*` (the whole hyper-connection read of a layer half)
gr every hyper-connection kernel of the graph (layers and head)
A verdict of "resolved" needs the p50 and the mean delta to agree in sign, |delta of the mean| above two standard errors
of the difference, and both above the repeat window pair's own delta.
"""
import argparse
import collections
import json
import re
import statistics as st
import sys
COMBINE_NAMES = ("mtp_full_combine", "leleka_verify_combine_k10_vec4")
SPLIT, DOWN, FUSED, UP = "chain_gr_split", "chain_gr_down", "leleka_gr_down_fused", "chain_gr_up"
SWITCH_RE = re.compile(r"combine_vec4: (\w+), head_mix_multi: (\w+), gr_down_fused: (\w+)")
KEY_NAMES = ("mtp_full_combine", "leleka_verify_combine_k10_vec4", "mtp_full_gr_norm", "mtp_full_down_silu",
"mtp_full_pre_final", "mtp_full_native_write", "chain_gr_split", "chain_gr_down_t2w8_nb4",
"leleka_gr_down_fused_t2w8", "chain_gr_up8")
MIN_GRAPHS = 15
def summary(values):
v = sorted(values)
if not v:
return None
at = lambda p: v[min(len(v) - 1, int(p * len(v)))] # noqa: E731
return {"n": len(v), "mean": st.mean(v), "sd": st.pstdev(v) if len(v) > 1 else 0.0, "p10": at(.1), "p50": at(.5),
"p90": at(.9)}
# ---------------------------------------------------------------- extract
def verify_graphs(trace):
by = collections.defaultdict(list)
for k in trace.kernels:
by[k.corr].append(k)
ids = sorted((c for c, v in by.items() if len(v) >= 900), key=lambda c: min(k.start for k in by[c]))
return [sorted(by[c], key=lambda k: k.start) for c in ids[2:-2]]
def window_rows(ks, name):
rows = collections.Counter(k.gx // 10 for k in ks if "copy_rows" in name(k))
return rows.most_common(1)[0][0] if rows else -1
def hc_instances(ks, name, last_combine_start):
"""(first, down, up, is_head) per hyper-connection read: split or fused kernel, the down kernel after a split, the
up kernel; the instances after the last combine are the head's."""
streams = collections.defaultdict(list)
for k in ks:
streams[k.stream].append(k)
out = []
for seq in streams.values():
for i, k in enumerate(seq):
n = name(k)
if n != SPLIT and not n.startswith(FUSED):
continue
nxt = seq[i + 1:i + 4]
down = nxt[0] if n == SPLIT and nxt and name(nxt[0]).startswith(DOWN) else None
up = next((x for x in nxt if name(x).startswith(UP)), None)
if up is not None:
out.append((k, down, up, k.start > last_combine_start))
return out
def graph_record(ks, name):
"""One graph: its metrics (us) and the per-launch lists of the section kernels."""
us = lambda x: x / 1e3 # noqa: E731
dur = lambda k: us(k.end - k.start) # noqa: E731
combines = [k for k in ks if name(k) in COMBINE_NAMES]
writes = [k for k in ks if name(k) == "mtp_full_native_write"]
quant = [k for k in ks if name(k) == "head_quant"]
if not combines or not writes or not quant:
return None
last_write, last_quant = writes[-1], quant[-1]
head = [k for k in ks if last_write.end <= k.start < last_quant.start]
inst = hc_instances(ks, name, combines[-1].start)
layer = [i for i in inst if not i[3]]
gr_all = [k for i in inst for k in (i[0], i[1], i[2]) if k is not None]
pair_dur = [dur(a) + (dur(d) if d else 0.0) for a, d, u, _ in layer]
pair_span = [us((d or a).end - a.start) for a, d, u, _ in layer]
read_span = [us(u.end - a.start) for a, d, u, _ in layer]
return {
"metrics": {
"kernels": len(ks), "graph_span": us(max(k.end for k in ks) - ks[0].start),
"kernel_sum": sum(dur(k) for k in ks),
"combine_n": len(combines), "combine_sum": sum(dur(k) for k in combines),
"head_n": len(head), "head_sum": sum(dur(k) for k in head),
"head_span": us(last_quant.start - last_write.end),
"pair_n": len(layer), "pair_sum": sum(pair_dur), "pair_span_sum": sum(pair_span),
"read_span_sum": sum(read_span), "gr_n": len(gr_all), "gr_sum": sum(dur(k) for k in gr_all),
},
"launch": {
"combine": [dur(k) for k in combines],
"split": [dur(a) for a, d, u, h in layer if d], "down": [dur(d) for a, d, u, h in layer if d],
"fused": [dur(a) for a, d, u, h in layer if not d], "up": [dur(u) for a, d, u, h in layer],
"pair_dur": pair_dur, "pair_span": pair_span, "read_span": read_span,
},
}
def switch_line(engine_log):
if not engine_log:
return None
for line in open(engine_log, errors="replace"):
m = SWITCH_RE.search(line)
if m and "sm120 switches" in line:
return {"combine_vec4": m.group(1), "head_mix_multi": m.group(2), "gr_down_fused": m.group(3)}
return None
def extract(path, label, lct_dir, engine_log):
sys.path.insert(0, lct_dir)
sys.dont_write_bytecode = True
import lct
trace = lct.Trace(path)
name = lambda k: trace.names.get(k.name, "?") # noqa: E731
graphs = verify_graphs(trace)
by_t = collections.defaultdict(list)
names = collections.defaultdict(lambda: [0, 0.0])
for ks in graphs:
for k in ks:
e = names[name(k)]
e[0] += 1
e[1] += (k.end - k.start) / 1e3
rec = graph_record(ks, name)
if rec:
by_t[window_rows(ks, name)].append(rec)
out = {"label": label, "trace": path, "graphs": len(graphs), "switch_line": switch_line(engine_log), "byT": {},
"names": {n: {"per_graph": c / len(graphs), "mean_us": us / c} for n, (c, us) in names.items()}}
for t, recs in sorted(by_t.items()):
out["byT"][str(t)] = {
"graphs": len(recs),
"graph": {m: summary([r["metrics"][m] for r in recs]) for m in recs[0]["metrics"]},
"launch": {k: summary([x for r in recs for x in r["launch"][k]]) for k in recs[0]["launch"]},
}
json.dump(out, sys.stdout, separators=(",", ":"))
# ---------------------------------------------------------------- report
def per_launch(window, kind, t):
return window["byT"].get(str(t), {}).get("launch", {}).get(kind)
def get(window, t, metric):
return window["byT"].get(str(t), {}).get("graph", {}).get(metric)
def usable_ts(windows):
sets = [{int(t) for t, v in w["byT"].items() if v["graphs"] >= MIN_GRAPHS and int(t) > 0} for w in windows]
return sorted(set.intersection(*sets))
def inferred(w):
n = lambda k: w["names"].get(k, {"per_graph": 0})["per_graph"] # noqa: E731
on = []
if n("leleka_verify_combine_k10_vec4") > 0 and n("mtp_full_combine") == 0:
on.append("S11")
if n("mtp_full_gr_norm") == 0:
on.append("S9")
if n("leleka_gr_down_fused_t2w8") > 0 and n("chain_gr_split") <= 1: # the head's own read keeps split + down
on.append("U5a")
return "+".join(on) or "none"
def evidence(windows):
print("### 1. Switches each window ran\n")
print("Launches per verify graph of the switch kernels (all graphs of the window), and the switch line of the "
"engine log (`requested Sm120Switches`).\n")
print("| kernel | " + " | ".join(w["label"] for w in windows) + " |")
print("| --- |" + " ---: |" * len(windows))
for n in KEY_NAMES:
cells = ["%.2f" % w["names"].get(n, {"per_graph": 0})["per_graph"] for w in windows]
print("| `%s` | " % n + " | ".join(cells) + " |")
log = ["/".join(w["switch_line"][k] for k in ("combine_vec4", "head_mix_multi", "gr_down_fused"))
if w["switch_line"] else "n/a" for w in windows]
print("| engine log: combine_vec4 / head_mix_multi / gr_down_fused | " + " | ".join(log) + " |")
print("| **ran** (from the kernels) | " + " | ".join(inferred(w) for w in windows) + " |\n")
def fmt(s, key="p50"):
return "%.2f" % s[key] if s else "-"
LAUNCH_KINDS = ("combine", "split", "down", "fused", "up", "pair_dur", "pair_span", "read_span")
def launch_tables(windows, ts):
print("### 2. Per-launch p50 duration (us) and launches per graph, by window rows T\n")
print("Cell: p50 per-launch duration (launches per graph). `pair_dur` = split + down kernel time (U5a: the fused "
"kernel), `pair_span` = split start to down end, `read_span` = split/fused start to `chain_gr_up8` end, "
"all per layer half.\n")
for t in ts:
print("T=%d (graphs %s)\n" % (t, " / ".join(str(w["byT"][str(t)]["graphs"]) for w in windows)))
print("| kernel | " + " | ".join(w["label"] for w in windows) + " |")
print("| --- |" + " ---: |" * len(windows))
for kind in LAUNCH_KINDS:
cells = []
for w in windows:
s = per_launch(w, kind, t)
cells.append("%s (%.1f)" % (fmt(s), s["n"] / w["byT"][str(t)]["graphs"]) if s else "-")
print("| %s | " % kind + " | ".join(cells) + " |")
rows = (("head launches per graph (mean)", "head_n", "mean"),
("head kernel time, us per graph (p50)", "head_sum", "p50"),
("head span, us per graph (p50)", "head_span", "p50"),
("GR kernels per graph (mean)", "gr_n", "mean"),
("GR kernel time, us per graph (p50)", "gr_sum", "p50"))
for label, metric, key in rows:
print("| %s | " % label + " | ".join(fmt(get(w, t, metric), key) for w in windows) + " |")
print()
def diff(a, b):
"""b minus a for one metric at one T: (delta p50, delta mean, standard error of the delta of the means)."""
if not a or not b:
return None
se = (a["sd"] ** 2 / a["n"] + b["sd"] ** 2 / b["n"]) ** .5
return b["p50"] - a["p50"], b["mean"] - a["mean"], se
def verdict(d, noise):
if not d or not noise:
return "n/a"
p50, mean, se = d
if (p50 > 0) == (mean > 0) and abs(mean) > 2 * se and min(abs(p50), abs(mean)) > max(abs(noise[0]), abs(noise[1])):
return "resolved"
return "below noise"
INCREMENTS = (("S11 combine vec4 (CS - CP)", 0), ("S9 head mix multi (CH - CS)", 1), ("U5a fused HC down (CD - CH)", 2))
SECTIONS = {
0: (("combine kernel time per graph", "combine_sum"),),
1: (("head kernel time per graph", "head_sum"), ("head span per graph", "head_span")),
2: (("pair kernel time per graph (layers)", "pair_sum"), ("pair span per graph (layers)", "pair_span_sum"),
("read span per graph (layers)", "read_span_sum"), ("GR role kernel time per graph", "gr_sum")),
}
LAUNCH_ROWS = {0: (("combine launch", "combine"),), 1: (),
2: (("pair kernel time per layer half", "pair_dur"), ("pair span per layer half", "pair_span"),
("read span per layer half", "read_span"))}
def increments(w, ts):
print("### 3. Increments and noise\n")
print("Delta = later window minus earlier. Cell: p50 / mean of the per-graph value in ms per graph (negative = the "
"later window is faster), then the verdict against the repeat pair (CZ minus CD, the same configuration). "
"Noise rows give that repeat's own p50 / mean delta.\n")
for title, i in INCREMENTS:
a, b = w[i], w[i + 1]
print("**%s**\n" % title)
print("| section | " + " | ".join("T=%d" % t for t in ts) + " |\n| --- |" + " ---: |" * len(ts))
for label, metric in SECTIONS[i]:
ds = [diff(get(a, t, metric), get(b, t, metric)) for t in ts]
ns = [diff(get(w[3], t, metric), get(w[4], t, metric)) for t in ts]
print("| %s | " % label + " | ".join(
"%+.4f / %+.4f (%s)" % (d[0] / 1e3, d[1] / 1e3, verdict(d, n)) if d else "-"
for d, n in zip(ds, ns)) + " |")
print("| noise: %s | " % label + " | ".join(
"%+.4f / %+.4f" % (n[0] / 1e3, n[1] / 1e3) if n else "-" for n in ns) + " |")
print()
launch_increment(w, i, ts)
mix_summary(w, ts)
def launch_increment(w, i, ts):
if not LAUNCH_ROWS[i]:
return
a, b = w[i], w[i + 1]
print("Per launch (us, p50 / mean; the combine is one launch per layer, the pair one per layer half):\n")
print("| per launch | " + " | ".join("T=%d" % t for t in ts) + " |\n| --- |" + " ---: |" * len(ts))
for label, kind in LAUNCH_ROWS[i]:
ds = [diff(per_launch(a, kind, t), per_launch(b, kind, t)) for t in ts]
ns = [diff(per_launch(w[3], kind, t), per_launch(w[4], kind, t)) for t in ts]
print("| %s | " % label + " | ".join("%+.2f / %+.2f" % d[:2] if d else "-" for d in ds) + " |")
print("| noise: %s | " % label + " | ".join("%+.2f / %+.2f" % n[:2] if n else "-" for n in ns) + " |")
print()
def mix_summary(w, ts):
print("### 4. Section delta weighted by the earlier window's T mix (ms per graph, p50 deltas)\n")
print("| increment | section | delta | repeat delta | spread over T (min .. max) |")
print("| --- | --- | ---: | ---: | --- |")
for title, i in INCREMENTS:
a, b = w[i], w[i + 1]
weights = {t: a["byT"][str(t)]["graphs"] for t in ts}
total = sum(weights.values())
for label, metric in SECTIONS[i]:
ds = {t: diff(get(a, t, metric), get(b, t, metric)) for t in ts}
ns = {t: diff(get(w[3], t, metric), get(w[4], t, metric)) for t in ts}
mixed = sum(weights[t] * ds[t][0] for t in ts) / total / 1e3
repeat = sum(weights[t] * ns[t][0] for t in ts) / total / 1e3
lo, hi = min(d[0] for d in ds.values()) / 1e3, max(d[0] for d in ds.values()) / 1e3
print("| %s | %s | %+.4f | %+.4f | %+.4f .. %+.4f |" % (title.split(" (")[0], label, mixed, repeat, lo, hi))
print()
def graph_totals(windows, ts):
print("### 5. Verify graph duration (first kernel start to last kernel end), p50 us (kernels per graph, p50)\n")
print("Sanity total only: each window is its own session, so the expert-tier state differs between windows "
"(compare within one T and one window, not as a section delta).\n")
print("| T | " + " | ".join(w["label"] for w in windows) + " |")
print("| --- |" + " ---: |" * len(windows))
for t in ts:
cells = ["%s (%s)" % (fmt(get(w, t, "graph_span")), fmt(get(w, t, "kernels"))) for w in windows]
print("| %d | " % t + " | ".join(cells) + " |")
print()
def report(paths):
w = [json.load(open(p)) for p in paths]
ts = usable_ts(w)
print("Windows: " + ", ".join("%s = %s" % (x["label"], x["trace"]) for x in w))
print("T values with at least %d graphs in every window: %s\n" % (MIN_GRAPHS, ts))
evidence(w)
launch_tables(w, ts)
increments(w, ts)
graph_totals(w, ts)
def main():
ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
sub = ap.add_subparsers(dest="cmd", required=True)
e = sub.add_parser("extract")
e.add_argument("trace")
e.add_argument("label")
e.add_argument("--lct", default="/data/leleka-e2e/decode/tools")
e.add_argument("--engine-log")
r = sub.add_parser("report")
r.add_argument("files", nargs=5)
a = ap.parse_args()
if a.cmd == "extract":
extract(a.trace, a.label, a.lct, a.engine_log)
else:
report(a.files)
if __name__ == "__main__":
main()