Skip to content

The 1.02 ceiling is an 8192-cubed fact, and the residual is stmatrix's - #121

Merged
feitreim merged 2 commits into
mainfrom
probe/residual-gap
Jul 29, 2026
Merged

feitreim merged 2 commits into
mainfrom
probe/residual-gap

Conversation

@feitreim

Copy link
Copy Markdown
Owner

The 1.02 ceiling is an 8192-cubed fact, and the residual is stmatrix's

Nothing measured. Everything re-measured. bench residual re-runs #114's ceiling,
the shipped rung and cuBLASLt beside each other in one container, twice, and then
opens the residual epilogue with a doubling ladder that deletes nothing.

The framing survives at 8192^3 and only there. no drain / cuBLASLt is
1.024 and 1.018 in two fresh containers, so #114's 1.02 reproduces after both of
the changes that could have invalidated it, and the epilogue is 127-136% of the
6.5% gap. At 16384^3 the same ratio is 0.993 and 0.984 -- the epilogue-free
kernel LOSES -- so 10-23% of that gap is not epilogue. At 4096^3 it is
0.955/0.988 and the rest is the wave, which is a different mechanism and is
reported as one. Below 2048^3 cuBLASLt's own MINIMUM moves 23-26% between two
calls in one session, so no ratio there is a measurement.

What is inside the ~7.3 us/tile, at 8192^3, both sessions:

us/tile share lever
cvt + stmatrix 3.8-4.1 55-64% none identified
ld.shared + st.global 2.0-2.3 31-36% a TMA store, ~+2.7%
LDTM after .x8 0.09 / -0.04 0% spent by #117
unattributed 0.8-1.5 9-20% --

The instrument is Tile::drain_staged_twice, which ADDS one link of the chain
per rung rather than removing one, because an epilogue nobody observes is one
the compiler may delete. The census says every rung stepped by exactly one pass
and that the second .x8 LDTM survived CSE despite being spelled _pure.

Two negative results, each retiring a lever. s84 hot deletes the
epilogue's entire HBM traffic and is worth -2.3% to +1.8%: the stores are not
bandwidth-bound, so #15's "hand the write to a TMA engine so it stops pressing
on memory" has no pressure to relieve -- what is left to buy is the issue, and
that is a smaller and different claim. And .x8 on the REGISTER drain
(gemm_cg2_lcf8, new, on the correctness gate, 166 registers byte-identical to
gemm_cg2) is a clean null at -1.1% to +5.8%, against +23.6/+8.6/+3.6% on the
staged path -- the scattered stores were already covering the LDTM latency.

One positive one. That null is the arm #116's A/B never had, and it re-prices
the shared round trip at #117's LDTM width: staged8 beats lcf8 by
+12.6%/+12.8% at 8192^3 where #116 measured +4.2% at .x1. The hop is worth
three times what it was measured at, because recoalescing only gets paid once
the drain has stopped waiting sixteen times a band.

And a control this file has never taken. Table 6 takes the same
whole - no drain subtraction twice in one container: it reproduces to 1-5% at
8192^3, 0.4-7% at 4096^3, and 39-46% at 16384^3. Every 16384^3 epilogue
figure above it -- #116's 16.34, #117's 5.81, #118's 2.91 -- is inside that band
and none of them carries it. It is also why staged8 and staged84 trading
places here does not contradict #117 so much as locate it: that +1.5-point
composition gain was a 16384^3 row.

New: Tile::drain_staged_twice, Tile::drain::<WIDE>, five entry points
(lcf8, s84 hot, s84 2g/2m/2x), bench --case residual, six tables. No
default, constant or shipped kernel moved; lcf8 is on the correctness gate and
the four probes say UNCHECKED in their own labels. build, regcount
(occupancy gate green, 80/87/125/102 and 166) and examples all pass.

feitreim added 2 commits July 29, 2026 10:37
Nothing measured. Everything re-measured. `bench residual` re-runs #114's ceiling,
the shipped rung and cuBLASLt beside each other in one container, twice, and then
opens the residual epilogue with a doubling ladder that deletes nothing.

**The framing survives at 8192^3 and only there.** `no drain / cuBLASLt` is
1.024 and 1.018 in two fresh containers, so #114's 1.02 reproduces after both of
the changes that could have invalidated it, and the epilogue is 127-136% of the
6.5% gap. At 16384^3 the same ratio is 0.993 and 0.984 -- the epilogue-free
kernel LOSES -- so 10-23% of that gap is not epilogue. At 4096^3 it is
0.955/0.988 and the rest is the wave, which is a different mechanism and is
reported as one. Below 2048^3 cuBLASLt's own MINIMUM moves 23-26% between two
calls in one session, so no ratio there is a measurement.

**What is inside the ~7.3 us/tile, at 8192^3, both sessions:**

| | us/tile | share | lever |
| --- | ---: | ---: | --- |
| `cvt` + `stmatrix` | 3.8-4.1 | 55-64% | **none identified** |
| `ld.shared` + `st.global` | 2.0-2.3 | 31-36% | a TMA store, ~+2.7% |
| LDTM after `.x8` | 0.09 / -0.04 | 0% | spent by #117 |
| unattributed | 0.8-1.5 | 9-20% | -- |

The instrument is `Tile::drain_staged_twice`, which ADDS one link of the chain
per rung rather than removing one, because an epilogue nobody observes is one
the compiler may delete. The census says every rung stepped by exactly one pass
and that the second `.x8` LDTM survived CSE despite being spelled `_pure`.

**Two negative results, each retiring a lever.** `s84 hot` deletes the
epilogue's entire HBM traffic and is worth -2.3% to +1.8%: the stores are not
bandwidth-bound, so #15's "hand the write to a TMA engine so it stops pressing
on memory" has no pressure to relieve -- what is left to buy is the issue, and
that is a smaller and different claim. And `.x8` on the REGISTER drain
(`gemm_cg2_lcf8`, new, on the correctness gate, 166 registers byte-identical to
`gemm_cg2`) is a clean null at -1.1% to +5.8%, against +23.6/+8.6/+3.6% on the
staged path -- the scattered stores were already covering the LDTM latency.

**One positive one.** That null is the arm #116's A/B never had, and it re-prices
the shared round trip at #117's LDTM width: `staged8` beats `lcf8` by
**+12.6%/+12.8%** at 8192^3 where #116 measured +4.2% at `.x1`. The hop is worth
three times what it was measured at, because recoalescing only gets paid once
the drain has stopped waiting sixteen times a band.

**And a control this file has never taken.** Table 6 takes the same
`whole - no drain` subtraction twice in one container: it reproduces to 1-5% at
8192^3, 0.4-7% at 4096^3, and **39-46% at 16384^3**. Every 16384^3 epilogue
figure above it -- #116's 16.34, #117's 5.81, #118's 2.91 -- is inside that band
and none of them carries it. It is also why `staged8` and `staged84` trading
places here does not contradict #117 so much as locate it: that +1.5-point
composition gain was a 16384^3 row.

New: `Tile::drain_staged_twice`, `Tile::drain::<WIDE>`, five entry points
(`lcf8`, `s84 hot`, `s84 2g/2m/2x`), `bench --case residual`, six tables. No
default, constant or shipped kernel moved; `lcf8` is on the correctness gate and
the four probes say UNCHECKED in their own labels. `build`, `regcount`
(occupancy gate green, 80/87/125/102 and 166) and `examples` all pass.
@feitreim
feitreim merged commit b9aff86 into main Jul 29, 2026
4 checks passed
feitreim added a commit that referenced this pull request Jul 29, 2026
#122) (#122)

#121 took the first reproducibility control on `whole - no drain` and it came back
39-46% at 16384^3 against 1-5% at 8192^3, with #116's 16.34 us/tile, #117's 5.81
and #118's 2.91 all inside the band. This is what the band is.

**It is error propagation, and the arithmetic reaches backwards with nothing
measured.** A difference carries its arms' error divided by its own share of them.
Reconstructed from #121's own printed table 6: share 17.9% / 7.8% / 5.3% at
4096/8192/16384^3, so 1/s of 5.6 / 12.9 / 19.0, and against arms that repeat to
0.86+0.58% / 0.15+0.10% / 0.45+2.11% that predicts 8.1% / 3.2% / **49%** against
#121's observed 7% / 1% / **46%**. The launches were never the problem -- they
repeat to 0.1-2.1% everywhere. The epilogue is per output tile and the launch is
per tile times K, so the share falls as 1/K by construction. **The instrument did
not degrade at 16384^3; it never worked there.**

Three things it is not, each checked: sampling (`min` of 30 is the same estimator
at every size and the arms repeat to 0.10% at 8192^3), the wave (8192^2 and
16384^2 are both 98.8% full and every comparison holds the grid fixed between its
arms), and -- against the hypothesis -- **adding rather than deleting**.
`drain_staged_twice` retires the dead-code hazard, which is real and different,
but one added link is a *smaller* share than the whole epilogue, so the ladder is
more amplified. #121's own 16384^3 ladder row is +4.01 and -2.69 for one quantity.

**And a second term nobody could see, because `bench` sorted the order away.**
`Timings` now keeps launch order; `drift` is the second fifteen launches over the
first. At 16384^3 and nowhere in the sweep, all six arms over two containers, the
device is **+6.85 to +11.33% slower by the end of a call** -- essentially the whole
of its 18-23% in-call spread -- where every other size drifts *negative*. Not the
problem size: `16384^2 x k1024` has the same tiles, items, C and wave and drifts
-1.0 to +0.6%. It is the duration, 154 ms of continuous 1.1 PFLOP/s against 16.
A 16384^3 `min` is a boost-clock reading from a call whose last launches run 10%
slower, which is also the mechanism under cuBLASLt's 1.15-1.19 max/min there.

**The fix is `bench repro`: same output geometry, shorter reduction.** K is the one
axis the epilogue's cost does not sit on, so shortening it holds the tiles, the
waves, the items, the C traffic and the epilogue total and moves only the launch
it is a fraction of. Four whole measurements per arm, round-robin so every pair is
adjacent in time, and the spread the amplification *predicts* printed beside the
one it got. One `ld.shared` + `st.global.v4` pass, two containers:

| shape | us/tile | s | observed | predicted | session to session |
| --- | ---: | ---: | ---: | ---: | ---: |
| 8192^2 x k1024 | **2.34 / 2.34** | 10.8% | 17 / 17% | 16 / 18% | **0.0%** |
| 8192^3 | 2.07 / 2.29 | 2.2% | 33 / 18% | 41 / 30% | 10.6% |
| 16384^2 x k1024 | **2.11 / 2.12** | 10.8% | 5 / 8% | 12 / 13% | **0.5%** |
| 16384^3 | 3.01 / 3.82 | 1.6% | **167 / 111%** | 235 / 177% | **26.9%** |

`predicted` tracks `observed` across a twentyfold range and bounds it above in
nine rows of ten. The 16384^2 number nobody could measure is **2.11 us/tile**,
reproduced to 0.5%; #121's ladder put it at 0.45 and 4.22. The us/tile is flat in
K (2.34/2.42/2.07 and 2.34/2.61/2.29 over an eightfold range), which is what makes
the substitution legal and is the design's own check.

**`staged8` and `staged84` are not tied, and the sign is the geometry's.** At
8192^2 `staged8` leads by 1.4-2.4% in four cells, no range reaching 1.000; at
16384^2 `staged84` leads by 0.4-1.0%, same sign both containers. The full-depth
rows do not merely fail to order them -- 16384^3 centres on `staged8` ahead by
1.4-2.3 us/tile where the shortened row says `staged84` ahead by 0.07-0.20, and
both its ranges straddle. **So #120's default is right for a reason its own row
could not carry**, and #121's advice to break the tie at 8192^3 would have broken
it the other way. Not a request to move the default.

New: `Timings::spread` / `Timings::drift` and the launch order behind them, `bench
repro`, rule 5 in the module docs, a section in README §7. Nothing measured is
inherited; no default, constant or kernel moved; `gemm.rs` untouched. `build` green
twice, `bench --case repro` run in two containers at 96 s of GPU each.
feitreim added a commit that referenced this pull request Jul 29, 2026
…123)

#121 left one lever with a number on it: `ld.shared` + `st.global` at 2.0-2.3 us a
tile, 31-36% of the residual epilogue, ~+2.7% of the launch. This builds that change
two ways and measures it in four containers. **It does not win anywhere the
instrument can see it, and the warp-scope form loses by 1.0-1.7%.**

**The full-depth A/B cannot see it, and #122 is why.** At 8192^3 this comparison is a
few tenths of a percent between two 0.65 ms launches -- `1/share` of 458-709, a
HARDER measurement than `whole - no drain` and not an easier one. Three containers of
it read +0.2, +0.4 and -0.2 percent. So it was re-taken with #122's substitution
applied to a ratio rather than to a subtraction: hold M and N, shorten K, interleave
the arms round-robin, four whole measurements each. `staged84` over each arm, so
above 1.000 is the TMA arm ahead, `session 1 / session 2`:

| shape | 1/share | s84/tma | range | s84/tmac | range |
| --- | ---: | ---: | --- | ---: | --- |
| 8192^2 x k1024 | 61-191 | 0.9885 / 0.9835 | 0.9743 - 0.9952 | 0.9948 / 0.9980 | 0.9924 - 0.9987 |
| 16384^2 x k1024 | 85-427 | 0.9882 / 0.9899 | 0.9853 - 0.9913 | 0.9977 / 1.0061 | 0.9971 - 1.0069 |
| 8192^3 | 294-709 | 0.9978 / 1.0018 | 0.9969 - 1.0023 | 1.0014 / 1.0034 | 0.9984 - 1.0062 |

`s84 tma` is behind in four independent cells and not one range reaches 1.000.
`s84 tmac` is a tie to a small loss, and the two containers disagree in sign at
16384^2 with non-overlapping ranges -- reported rather than averaged away.

**Even the doubling probe never promised 2.7%.** `s84t 2g` doubles the TMA hop
exactly as `s84 2g` doubles `ld.shared` + `st.global`. At 8192^3 over four
containers: 2.33/2.41/2.56/2.58 us a tile for the vectorized stores against
1.57/1.90/1.91/1.99 for the engine. 2.7% was that term going to ZERO; the engine
takes it to about three quarters of itself, worth 0.42-0.75 us a tile.

**And the realised value is below even that, for a reason the probe cannot see.** A
DOUBLED store is an extra one left in flight; a REPLACING store is on the critical
path of the next band. At `IN_FLIGHT = 0` the ring's `acquire` is
`cp.async.bulk.wait_group.read` at zero groups, so band k+1's `stmatrix` waits out
the engine's read of band k's buffer, four times an item, where `store_shared_rows`
retires into the memory pipeline and blocks on nothing. Depth 1 is not a choice: the
envelope leaves 1920 B and a second set of buffers is 16 384.

**The block barrier was the obvious suspect and the hypothesis was backwards.** The
census says the barriers are real -- `bar.sync` 2/5 and `bar.warp.sync` 3/0 against
`staged84`'s 2/1 -- and **the arm that pays them wins**, by 0.6-1.6% in all four
paired cells. One [128,64] box a band beats four [32,64] boxes by more than eight
`bar.sync` an item cost.

**So `StoreRing` was usable as built and is the faster of the two.** What it could
not express was the layout, so it gained a `Scope` parameter (`Cta`, the default and
the shipped behaviour, and `Warp`): 40 lines, no byte moved, only which barrier
`converge` is and which thread `issuing` is. Every argument in the type survived
untouched, because none of them mentions how many threads are in the barrier. The
parameter earned its keep by producing the arm that lost.

**One hardware fact fell out.** `gemm` rounds its staging run to 128 bytes and not
1024, so every staging tile starts mid-swizzle-period. `store ring warp phased` is
the store side of `swizzle roundtrip short` and it passes: the engine reads the phase
off the absolute address in both directions. That is why no alignment padding was
needed and why both TMA rungs declare `staged84`'s 114 816 B to the byte.

Named and not built: the loss is attributed to depth 1 by mechanism, and a depth-2
warp ring of [16,64] buffers is 2 x 2048 = 4096 B a warp -- exactly what a [32,64]
buffer costs today, so the envelope would not move. It needs a 16-row band out of
`TmemTile::tile_x8`, whose `.x8` shape is 32.

New: `Scope`/`Cta`/`Warp` on `StoreRing`, `Tile::drain_staged_tma`,
`Tile::drain_staged_tma_cta`, `Tile::cta_origin`, three entry points (`s84 tma`,
`s84 tmac`, `s84t 2g`), a C tensor map on the host side, `gemm::tma_ordering` and two
`bench --case residual` tables, two device-test cases. No default, constant or
shipped kernel moved; `staged84` still ships. Both TMA rungs are on the correctness
gate and pass the element-exact bf16 `==` at every size; the doubling probe says
UNCHECKED in its own label. `build` green four times, `regcount` (occupancy gate
green, 98/94/96 against `staged84`'s 96, zero spill), `device_tests` 41 of 41.
feitreim added a commit that referenced this pull request Jul 29, 2026
…123)

#121 left one lever with a number on it: `ld.shared` + `st.global` at 2.0-2.3 us a
tile, 31-36% of the residual epilogue, ~+2.7% of the launch. This builds that change
two ways and measures it in four containers. **It does not win anywhere the
instrument can see it, and the warp-scope form loses by 1.0-1.7%.**

**The full-depth A/B cannot see it, and #122 is why.** At 8192^3 this comparison is a
few tenths of a percent between two 0.65 ms launches -- `1/share` of 458-709, a
HARDER measurement than `whole - no drain` and not an easier one. Three containers of
it read +0.2, +0.4 and -0.2 percent. So it was re-taken with #122's substitution
applied to a ratio rather than to a subtraction: hold M and N, shorten K, interleave
the arms round-robin, four whole measurements each. `staged84` over each arm, so
above 1.000 is the TMA arm ahead, `session 1 / session 2`:

| shape | 1/share | s84/tma | range | s84/tmac | range |
| --- | ---: | ---: | --- | ---: | --- |
| 8192^2 x k1024 | 61-191 | 0.9885 / 0.9835 | 0.9743 - 0.9952 | 0.9948 / 0.9980 | 0.9924 - 0.9987 |
| 16384^2 x k1024 | 85-427 | 0.9882 / 0.9899 | 0.9853 - 0.9913 | 0.9977 / 1.0061 | 0.9971 - 1.0069 |
| 8192^3 | 294-709 | 0.9978 / 1.0018 | 0.9969 - 1.0023 | 1.0014 / 1.0034 | 0.9984 - 1.0062 |

`s84 tma` is behind in four independent cells and not one range reaches 1.000.
`s84 tmac` is a tie to a small loss, and the two containers disagree in sign at
16384^2 with non-overlapping ranges -- reported rather than averaged away.

**Even the doubling probe never promised 2.7%.** `s84t 2g` doubles the TMA hop
exactly as `s84 2g` doubles `ld.shared` + `st.global`. At 8192^3 over four
containers: 2.33/2.41/2.56/2.58 us a tile for the vectorized stores against
1.57/1.90/1.91/1.99 for the engine. 2.7% was that term going to ZERO; the engine
takes it to about three quarters of itself, worth 0.42-0.75 us a tile.

**And the realised value is below even that, for a reason the probe cannot see.** A
DOUBLED store is an extra one left in flight; a REPLACING store is on the critical
path of the next band. At `IN_FLIGHT = 0` the ring's `acquire` is
`cp.async.bulk.wait_group.read` at zero groups, so band k+1's `stmatrix` waits out
the engine's read of band k's buffer, four times an item, where `store_shared_rows`
retires into the memory pipeline and blocks on nothing. Depth 1 is not a choice: the
envelope leaves 1920 B and a second set of buffers is 16 384.

**The block barrier was the obvious suspect and the hypothesis was backwards.** The
census says the barriers are real -- `bar.sync` 2/5 and `bar.warp.sync` 3/0 against
`staged84`'s 2/1 -- and **the arm that pays them wins**, by 0.6-1.6% in all four
paired cells. One [128,64] box a band beats four [32,64] boxes by more than eight
`bar.sync` an item cost.

**So `StoreRing` was usable as built and is the faster of the two.** What it could
not express was the layout, so it gained a `Scope` parameter (`Cta`, the default and
the shipped behaviour, and `Warp`): 40 lines, no byte moved, only which barrier
`converge` is and which thread `issuing` is. Every argument in the type survived
untouched, because none of them mentions how many threads are in the barrier. The
parameter earned its keep by producing the arm that lost.

**One hardware fact fell out.** `gemm` rounds its staging run to 128 bytes and not
1024, so every staging tile starts mid-swizzle-period. `store ring warp phased` is
the store side of `swizzle roundtrip short` and it passes: the engine reads the phase
off the absolute address in both directions. That is why no alignment padding was
needed and why both TMA rungs declare `staged84`'s 114 816 B to the byte.

Named and not built: the loss is attributed to depth 1 by mechanism, and a depth-2
warp ring of [16,64] buffers is 2 x 2048 = 4096 B a warp -- exactly what a [32,64]
buffer costs today, so the envelope would not move. It needs a 16-row band out of
`TmemTile::tile_x8`, whose `.x8` shape is 32.

New: `Scope`/`Cta`/`Warp` on `StoreRing`, `Tile::drain_staged_tma`,
`Tile::drain_staged_tma_cta`, `Tile::cta_origin`, three entry points (`s84 tma`,
`s84 tmac`, `s84t 2g`), a C tensor map on the host side, `gemm::tma_ordering` and two
`bench --case residual` tables, two device-test cases. No default, constant or
shipped kernel moved; `staged84` still ships. Both TMA rungs are on the correctness
gate and pass the element-exact bf16 `==` at every size; the doubling probe says
UNCHECKED in its own label. `build` green four times, `regcount` (occupancy gate
green, 98/94/96 against `staged84`'s 96, zero spill), `device_tests` 41 of 41.
feitreim added a commit that referenced this pull request Jul 29, 2026
…123) (#123)

#121 left one lever with a number on it: `ld.shared` + `st.global` at 2.0-2.3 us a
tile, 31-36% of the residual epilogue, ~+2.7% of the launch. This builds that change
two ways and measures it in four containers. **It does not win anywhere the
instrument can see it, and the warp-scope form loses by 1.0-1.7%.**

**The full-depth A/B cannot see it, and #122 is why.** At 8192^3 this comparison is a
few tenths of a percent between two 0.65 ms launches -- `1/share` of 458-709, a
HARDER measurement than `whole - no drain` and not an easier one. Three containers of
it read +0.2, +0.4 and -0.2 percent. So it was re-taken with #122's substitution
applied to a ratio rather than to a subtraction: hold M and N, shorten K, interleave
the arms round-robin, four whole measurements each. `staged84` over each arm, so
above 1.000 is the TMA arm ahead, `session 1 / session 2`:

| shape | 1/share | s84/tma | range | s84/tmac | range |
| --- | ---: | ---: | --- | ---: | --- |
| 8192^2 x k1024 | 61-191 | 0.9885 / 0.9835 | 0.9743 - 0.9952 | 0.9948 / 0.9980 | 0.9924 - 0.9987 |
| 16384^2 x k1024 | 85-427 | 0.9882 / 0.9899 | 0.9853 - 0.9913 | 0.9977 / 1.0061 | 0.9971 - 1.0069 |
| 8192^3 | 294-709 | 0.9978 / 1.0018 | 0.9969 - 1.0023 | 1.0014 / 1.0034 | 0.9984 - 1.0062 |

`s84 tma` is behind in four independent cells and not one range reaches 1.000.
`s84 tmac` is a tie to a small loss, and the two containers disagree in sign at
16384^2 with non-overlapping ranges -- reported rather than averaged away.

**Even the doubling probe never promised 2.7%.** `s84t 2g` doubles the TMA hop
exactly as `s84 2g` doubles `ld.shared` + `st.global`. At 8192^3 over four
containers: 2.33/2.41/2.56/2.58 us a tile for the vectorized stores against
1.57/1.90/1.91/1.99 for the engine. 2.7% was that term going to ZERO; the engine
takes it to about three quarters of itself, worth 0.42-0.75 us a tile.

**And the realised value is below even that, for a reason the probe cannot see.** A
DOUBLED store is an extra one left in flight; a REPLACING store is on the critical
path of the next band. At `IN_FLIGHT = 0` the ring's `acquire` is
`cp.async.bulk.wait_group.read` at zero groups, so band k+1's `stmatrix` waits out
the engine's read of band k's buffer, four times an item, where `store_shared_rows`
retires into the memory pipeline and blocks on nothing. Depth 1 is not a choice: the
envelope leaves 1920 B and a second set of buffers is 16 384.

**The block barrier was the obvious suspect and the hypothesis was backwards.** The
census says the barriers are real -- `bar.sync` 2/5 and `bar.warp.sync` 3/0 against
`staged84`'s 2/1 -- and **the arm that pays them wins**, by 0.6-1.6% in all four
paired cells. One [128,64] box a band beats four [32,64] boxes by more than eight
`bar.sync` an item cost.

**So `StoreRing` was usable as built and is the faster of the two.** What it could
not express was the layout, so it gained a `Scope` parameter (`Cta`, the default and
the shipped behaviour, and `Warp`): 40 lines, no byte moved, only which barrier
`converge` is and which thread `issuing` is. Every argument in the type survived
untouched, because none of them mentions how many threads are in the barrier. The
parameter earned its keep by producing the arm that lost.

**One hardware fact fell out.** `gemm` rounds its staging run to 128 bytes and not
1024, so every staging tile starts mid-swizzle-period. `store ring warp phased` is
the store side of `swizzle roundtrip short` and it passes: the engine reads the phase
off the absolute address in both directions. That is why no alignment padding was
needed and why both TMA rungs declare `staged84`'s 114 816 B to the byte.

Named and not built: the loss is attributed to depth 1 by mechanism, and a depth-2
warp ring of [16,64] buffers is 2 x 2048 = 4096 B a warp -- exactly what a [32,64]
buffer costs today, so the envelope would not move. It needs a 16-row band out of
`TmemTile::tile_x8`, whose `.x8` shape is 32.

New: `Scope`/`Cta`/`Warp` on `StoreRing`, `Tile::drain_staged_tma`,
`Tile::drain_staged_tma_cta`, `Tile::cta_origin`, three entry points (`s84 tma`,
`s84 tmac`, `s84t 2g`), a C tensor map on the host side, `gemm::tma_ordering` and two
`bench --case residual` tables, two device-test cases. No default, constant or
shipped kernel moved; `staged84` still ships. Both TMA rungs are on the correctness
gate and pass the element-exact bf16 `==` at every size; the doubling probe says
UNCHECKED in its own label. `build` green four times, `regcount` (occupancy gate
green, 98/94/96 against `staged84`'s 96, zero spill), `device_tests` 41 of 41.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant