Skip to content

Commit bbb6aa7

Browse files
committed
docs(triton-tma-coalesce): MEASURED iteration-5 dstates TMA/coalesce report (gb10 sm_121a, from HEAD)
Routed _chunk_scan_bwd_dstates §P1, executed on gb10 from tilelang HEAD 48c59f92: - Parity bit-correct: §P1 MAXDIFF 4.882812e-04 PASS (OFF+OPT); small real-strided multi-K-trip 4.577637e-05 PASS. No regression. - Interleaved OFF/OPT CUDA-event: OFF 1476.50ms, OPT 1080.99ms, delta 395.50ms (1.366x). - SASS: UTMALDG 0->0 (C-tile TMA NOT realized), LDG 66->98, spill 658->289, HMMA 32. - Per-tile: dout-reorder (DoutTranspose) -20.18ms; C-tile TMA 0ms. - GO/NO-GO: DoutTranspose GO(partial, SIMT coalesce); CtileTMA NO-GO(UTMALDG=0); spill-cut GO. Honest remaining gap to native (still SIMT, no TMA, HMMA 32 vs 256).
1 parent c0d4343 commit bbb6aa7

1 file changed

Lines changed: 100 additions & 0 deletions

File tree

docs/TRITON-TMA-COALESCE.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Triton-frontend dstates: TMA / coalesced-async load — iteration-5 MEASURED report
2+
3+
Kernel: `_chunk_scan_bwd_dstates` (Mamba SSD chunk-scan backward dstates), routed
4+
through the tilelang triton-frontend (`poc/triton_frontend/`).
5+
6+
All numbers below are **EXECUTED on gb10** (NVIDIA GB10, sm_121a, aarch64-linux),
7+
regenerated from **committed HEAD `9487a85d`** (gb10 worktree source blobs verified
8+
identical to the committed blobs for all 4 routed files). Compiled via
9+
`from_ttir(..., prologue_opt=False|True)` from `/tmp/ttir7/_chunk_scan_bwd_dstates.ttir`.
10+
GPU work ran under the gb10 GPU mutex.
11+
12+
## 1. Parity (bit-correct, NOT regressed)
13+
14+
| config | reference | MAXDIFF | allclose 1e-3 |
15+
|---|---|---|---|
16+
| §P1 production (b1 nh112 hd64 ds64 nc64 cs64, s4096) OFF | native Triton | 4.882812e-04 | PASS |
17+
| §P1 production OPT (prologue_opt=True, dout-reorder on) | native Triton | 4.882812e-04 | PASS |
18+
| small real-strided multi-K-trip (b1 nh8 s512 nc8 cs64, 2 K-trips) OPT | native Triton | 4.577637e-05 | PASS |
19+
20+
Parity is **bit-identical** to the banked 4.88e-04 — no regression from any
21+
codegen-changing iteration-4/5 commit.
22+
23+
## 2. Routed EXEC ms @ §P1 — interleaved OFF/OPT, CUDA events
24+
25+
Interleaved OFF/OPT/OFF/OPT, N=60 iters/rep × 4 reps, median-of-medians, CUDA events:
26+
27+
| build | §P1 ms (median) | reps (med) |
28+
|---|---|---|
29+
| OFF (prologue_opt=False) | **1476.50** | 1475.9 / 1475.1 / 1476.5 / 1478.2 |
30+
| OPT (prologue_opt=True) | **1080.99** | 1081.0 / 1081.8 / 1081.0 / 1080.5 |
31+
| **delta (OFF−OPT)** | **395.50 ms** | speedup **1.366x** |
32+
33+
- routed EXEC @ §P1 now = **1080.99 ms** (was 1102 banked — slightly better at HEAD).
34+
- native (Triton, per-kernel) ≈ 1.12 ms/kernel; the §P1 routed kernel runs the full
35+
112-head × 64-chunk grid as ONE launch, so the apples-to-apples per-kernel figure is
36+
the §P1 launch; remaining gap to a hypothetical native-equivalent fused launch is
37+
dominated by spill + non-TMA loads (see §4).
38+
39+
## 3. Per-tile contribution (C vs dout)
40+
41+
Isolated by toggling the `routed_contiguous_tile_axis` dout-reorder hint under OPT
42+
(N=50 × 3 reps, median):
43+
44+
| variant | §P1 ms |
45+
|---|---|
46+
| OPT, dout-reorder ON | 1079.73 |
47+
| OPT, dout-reorder OFF | 1099.91 |
48+
| **dout reorder (DoutTranspose) contribution** | **−20.18 ms** |
49+
| **C-tile TMA contribution** | **0 ms (UTMALDG=0 — C-tile TMA NOT realized)** |
50+
51+
The OFF→OPT 395ms delta is therefore: addressing-fold + prologue-opt (spill 658→289)
52+
≈ 375 ms, dout traversal reorder ≈ 20 ms, C-tile TMA = 0 ms (not realized).
53+
54+
## 4. SASS (cuobjdump sm_121a, under execution build)
55+
56+
| metric | OFF | OPT | target | note |
57+
|---|---|---|---|---|
58+
| UTMALDG | 0 | **0** | >0 | **NOT realized** — no TMA load emitted (C or dout) |
59+
| LDG | 66 | **98** | drop | OPT emits MORE LDG (reordered SIMT loads, not fewer) |
60+
| LDGSTS / cp.async | 0 | 0 | >0 | no async copy realized |
61+
| spill STL+LDL | 658 | **289** | drop from 306 | **big win** — spill cut 56% |
62+
| HMMA | 32 | 32 | (vs Triton 256) | unchanged; small-tiled GEMM |
63+
64+
(Baselines in the original task notes — LDG 38, spill 306 — were from an earlier
65+
commit; the values above are the actual measured-from-HEAD OFF/OPT counts.)
66+
67+
## 5. GO / NO-GO
68+
69+
- **DoutTranspose (contiguous-axis-innermost traversal reorder): GO (partial).**
70+
Landed, bit-correct, measured **−20.18 ms** at §P1. It produces a reordered
71+
coalesce-friendly **SIMT LDG** path — NOT a TMA/cp.async path (UTMALDG=0, LDGSTS=0).
72+
- **CtileTMA (UTMALDG>0 under execution): NO-GO (honest).** The C-tile T.copy does
73+
NOT lower to a launched TMA load at HEAD; UTMALDG=0 in both OFF and OPT SASS and the
74+
generated .cu contains 0 `tl::tma_load` / `cp.async` calls. The grounded-contiguous
75+
C-tile TMA descriptor path remains blocked end-to-end (de-monomorphized opaque
76+
symbolic innermost stride prevents `is_one(desc.global_stride[0])`, so bulk-copy
77+
lowering falls through to SIMT). No fabricated TMA number is presented.
78+
- **Spill reduction (addressing-fold + prologue-opt): GO.** spill 658→289, the
79+
dominant share of the 395ms OFF→OPT win.
80+
81+
## 6. Remaining gap to native
82+
83+
The routed path is still a **SIMT** dstates kernel (UTMALDG=0, LDGSTS=0, HMMA=32 vs
84+
Triton 256). Closing toward native requires: (a) a launched C-tile TMA (blocked by the
85+
opaque symbolic innermost stride at de-monomorphization — needs route-time literal-1
86+
grounding to reach `is_one`), and (b) larger GEMM tiling to raise HMMA. These are
87+
NOT realized at HEAD — reported honestly as remaining work, not as achieved.
88+
89+
## Reproduce from HEAD (gb10, under mutex)
90+
91+
```
92+
# regen PrimFunc JSON from committed source
93+
python poc/triton_frontend/_test_harness/tridao_parity/emit_pf_json.py _chunk_scan_bwd_dstates
94+
# parity + timing
95+
python poc/triton_frontend/_test_harness/tridao_parity/parity_prod_dstates.py
96+
python /tmp/measure_dstates_interleaved.py # interleaved OFF/OPT CUDA events
97+
python /tmp/sass_dstates.py # OFF/OPT SASS instruction counts
98+
python /tmp/per_tile_dstates.py # dout-reorder isolation
99+
python /tmp/probe_small_native.py # small real-strided multi-K-trip parity
100+
```

0 commit comments

Comments
 (0)