Repository navigation
The 16384-cubed instrument was never valid, and the fix is a shorter K (#122) - #122
Merged
Merged
Conversation
#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.
This was referenced Jul 29, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#121 took the first reproducibility control on
whole - no drainand it came back 39-46% at 16384³ against 1-5% at 8192³, with #116's 16.34 µs/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:
1/sThe launches were never the problem — they repeat to 0.1–2.1% at every size in that table. The epilogue is per output tile and the launch is per tile times
K, so the share falls as1/Kby construction. The instrument did not degrade at 16384³; it never worked there.Three things it is not, each checked rather than assumed: sampling (
minof 30 is the same estimator at every size and the arms repeat to 0.10% at 8192³), the wave (8192² and 16384² are both 98.8% full and every comparison in the file holds the grid, the tile and the traversal fixed between its arms), and — against the hypothesis in the brief — adding rather than deleting.Tile::drain_staged_twiceretires the dead-code hazard, which is real and different, but one added link is a smaller share of the launch than the whole epilogue, so the ladder is more amplified and not less. #121's own 16384³ ladder row says so: +4.01 and −2.69 µs a tile for one quantity.And a second term nobody could see, because
benchsorted the order awayTimingsnow keeps launch order.driftis the second fifteen launches over the first fifteen;spreadis the same call'smax/min. Six arms over two containers:max/minAt 16384³ and nowhere else the device is 7–11% slower by the end of the call than at the start, in all six arms and both containers, and that drift is essentially the whole of its 18–23% in-call spread — everywhere else the drift is negative. It is not the problem size:
16384² × k1024has the same 4096 tiles, the same 28 items, the same 512 MiB ofCand the same wave, and drifts −1.0 to +0.6%. It is the duration — 154 ms of continuous 1.1 PFLOP/s against 16 ms. A 16384³minis a boost-clock reading from a call whose last launches run 10% slower, which is also the mechanism under cuBLASLt's 1.15–1.19max/minthere.The fix: same output geometry, shorter reduction —
bench reproKis the one axis the epilogue's cost does not sit on, so shortening it holds the tile grid, the waves, the items, theCtraffic and the epilogue's total cost and moves only the launch it is a fraction of. No estimator survives a 60× amplifier; the lever is the share. 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. Oneld.shared+st.global.v4pass, priced by addition, two containers:s1/spredictedtracksobservedacross a twentyfold range and bounds it from above in nine rows of ten, which is the diagnosis stated as a prediction rather than as an explanation. The 16384² number nobody could measure is 2.11 µs a tile, reproduced to 0.5% across two containers; #121's ladder put it at 0.45 and 4.22, and 2.11 is inside neither and between both. The 8192² column calibrates it: 2.34 lands at the top of the 2.0–2.3 #121 already carries. The µs/tile is flat inK— 2.34/2.42/2.07 and 2.34/2.61/2.29 across an eightfold range — which is what makes the substitution legal and is the design's own check. Residual risk stated: shorteningKputsAandBinside L2, and the K sweep bounds that confound to the deep rows' own ±18–33% rather than to 1%.staged8andstaged84are not tied, and the sign is the geometry'ss8/s841/sstaged8, 1.5–2.4%staged8, 1.4–1.7%staged84, 0.4–1.0%The full-depth rows do not merely fail to order them — 16384³ centres on
staged8ahead by 1.4–2.3 µs a tile where the same geometry shortened saysstaged84ahead by 0.07–0.20, and both its ranges straddle 1.000. 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³ would have broken it the other way and shipped the rung that loses at the size the default was chosen for. This is not a request to move the default: a rung that wins at 16384² and loses at 8192² is a shape question, andgemm_wsshippingstaged8besidegemmshippingstaged84is now two answers to two questions.What it does not do
It never measures
whole − no drain— the epilogue-free entry points are ongemm.rs's side of the wall, which this PR does not touch. But the substitution applies to it with a number: the whole epilogue is ~7.3 µs a tile, so at16384² × k1024it is ~0.20 ms of a 0.55 ms launch —sof 37%,1/sof 2.7, and against arms that repeat to 0.5–1.2% that is ±5% where the full-depth version is ±46%. That is the row that would replace #116's 16.34, #117's 5.81 and #118's 2.91 rather than merely retire them, and it is a change ingemm.rs's sweeps. Until it is taken, the status of every 16384³ epilogue total in the file is unmeasured — a weaker claim than wrong, and a much weaker one than those numbers currently read as.Diff
Timings::spread/Timings::driftand the launch order behind them,bench repro, rule 5 in the module docs,--case reproinmodal_app.py, and a §7 section. No default, constant, kernel orgemm.rsline moved.buildgreen twice;bench --case reprorun in two containers at 96 s of GPU function time each.