Repository navigation
The warpgroup split lost to a .local depot rather than to the lanes, and both 256-wide entries take it now - #197
Merged
Merged
Conversation
…, and both 256-wide entries take it now `bench sol-ablate`'s table 6 recorded the epilogue's column split losing 1.4 to 1.8% at 4096³ and winning 0.3 to 0.4% at 8192³, and the reading offered was hardware: warps 0 and 4 own the same 32 tensor-memory lanes, so splitting an accumulator's columns puts two requesters on each of four sub-partitions rather than spreading over eight. That argument is still true and it was not what the table measured. Every row of it was taken through a `.local` depot the library no longer emits — `store_tile_x4` homed each drained band to local memory until the rolled walks were marked (#166, landed in #180/#181/#184), and a band *is* the frame, a `RegTile<32, 64>` being 64 f32 being 256 B. The split pays that frame twice per accumulator where one warpgroup pays it once, so the arm doing more of the broken thing read as the arm that was worse. Re-run at f64a27b, same table, same two round-robin passes, `regcount` reading zero stack and zero spill on every `gemm_sol` rung: 4096³ [256, 256] launch +0.8%, +0.9% drain 3.35 -> 3.10, 3.28 -> 3.17 us 8192³ [512, 256] launch +2.1%, +2.1% drain 4.72 -> 3.05, 4.70 -> 3.04 us The sign reverses at both entries and both passes, and the term that was blamed is the term that moves: the drain gets 35% cheaper at [512, 256] rather than slower. The `no drain` control at its own 320 threads still matches the 192-thread one to a tenth of a percent, so the extra warps remain free when they do nothing. `SHIPPED_GROUPS` is `TWO_WARPGROUPS` for `gemm_sol_m256` and `gemm_sol_m512`. The shared plan is byte-identical either way — eight warps stage half the columns each — so no `dynamic_shared` moves; what moves is the block, to 320, which is why `Variant::threads` now sits beside `Variant::shared_bytes` and the launcher asks the variant instead of reading one `THREADS`. `gemm_sol_m256_n128` keeps one warpgroup. The split is legal there and the asserts cover it; table 6 simply has no `[256, 128]` arm, and shipping it would be shipping a geometry nothing here has timed. The ablation and watch probes are pinned to `ONE_WARPGROUP` explicitly rather than following `SHIPPED_GROUPS`. They were reading the shipped constant to mean "the geometry this ladder is held at", and those are two different facts: with `SHIPPED_GROUPS` flipped, thirty-three probe kernels would have silently reshaped and every historical arm would have stopped comparing to itself. The three entries join `GATED_KERNELS`. Their residency is fixed by the shared plan and no register count can raise it, but at 320 threads a thread may have 168 registers before an SM cannot place one CTA at all — a launch the driver refuses rather than a slow one. They read 82 and 83 against that step.
feitreim
added a commit
that referenced
this pull request
Aug 6, 2026
`Drain<const LDTM_X8: bool, const STMATRIX_X4: bool>` shipped with #126 and the shape is wrong twice over. The TMEM axis has three instructions a drain can issue and not two — `.x1`, `.x8`, and `.x8` with the band's issues batched behind one `tcgen05.wait::ld` — and the third carries an `ISSUES` count no `bool` can hold. And a `bool` puts the rung in the *walk*: each arm is an `if` inside the loop and a position in every dial that reaches it, so a fourth rung edits the epilogue and five launch sites rather than adding an impl. So the axes are traits, in `Swizzle`'s and `Scope`'s idiom: `TmemRead` with `X1`, `X8` and `X8Batched<ISSUES>`, `FragmentStore` with `X2` and `X4`, one unit struct per rung with the instruction on the impl. `Drain::<X8, X4>` is the pair that ships and it says which pair at the launch site where `Drain::<true, true>` said only where in a table it sat — which is the complaint `gemm_ws`' own doc makes about `Ws::<STAGES, true, false, false, true>`, answered on this axis. `experiments`' `Staged` job takes the two rungs the same way, so its five entry points read `Staged::<true, X8, X2>` instead of `Staged::<true, true, false>`. An `adt_const_params` enum would express the same set; it is unstable and this crate takes no incomplete features. The traits need none. Two things are deliberately not rungs, and the docs say why for both. `stmatrix.m8n8.x1` is in the ISA and not in the library: four instructions per block where `.x2` is two and `.x4` is one, at identical addresses, in the direction #117 measured as losing — it is an `ldst` entry point plus an impl whenever someone wants it priced. `TmemTile::fragments_pack16_x8` returns packed b16 words rather than an fp32 `RegTile`, so it is not a width of the read axis but a different route: the only thing that can store its product is `store_packed_x4`, which by its own doc computes a wrong `C`. Admitting it would make the read's product an associated type and bind the write axis to it — the two axes would stop being independent, for an ablation that never ships. `X8Batched` is the rung `gemm_sol`'s drain reads with, and a doctest compiles `Drain::<X8Batched<2>, X4>::staged` so that is checked rather than claimed. It is not enough to migrate that kernel and the axes are no longer what separates them — the walk is. It fills a 128-wide staging tile out of two 64-wide bands on purpose, because four `.x8` issues behind one wait is 176 registers against 96; it drains a column *span* of a wider accumulator because two warpgroups split the tile (#197); and it converges twice a pass. Those are three parameters on the walk, and `gemm_sol` is the tightest register count in the repo, so the migration is a measurement and not a refactor. No instruction moves: this is a pure API change and `regcount`'s opcode census, registers, spills and frames are identical on every kernel.
feitreim
added a commit
that referenced
this pull request
Aug 6, 2026
… replaces measured as nothing (#218) * An accumulator releases from one lane a warp, and the 512 arrivals it replaces measured as nothing `release_accumulator` had every lane of every epilogue warp arrive on `empty`, for a fact that is one per warp: a warp is done with the accumulator when its last `tcgen05.wait::ld` has retired, and that instruction retires the warp's loads and not the lane's. #197's split doubled the epilogue's warps and doubled the count with them -- 256 arrivals a slot to 512, against oxide-train's 8 -- on the barrier between an accumulator's drain and the next item's MMA. It was the most concrete follow-up that PR's review left, and it is worth nothing. The guard is a lane test and the count `empty` is armed with is the same statement read from the other end, so both move together: [256, 256] and [512, 256] RANKS * epilogue_warps(2) * 32 = 512 -> 16 [256, 128] RANKS * epilogue_warps(1) * 32 = 256 -> 8 Nothing else arrives on `empty` at either entry. The `[512, 256]` epilogue's two halves are two slots of the same ring signalled by the same call -- which is why `Large::epilogue` stops spelling the arrival itself and calls `release_accumulator(half)`, so one lane guard covers both entries and both slots. The epilogue and the MMA warp break their item loops on the same `has_work == 0`, so a launch's last item leaves no half-signalled slot behind. What makes the guard legal is the drain's closing `warp::sync_mask`: past it, no lane of the warp still has the accumulator in flight. `bench sol-ablate` table 7 is the A/B, both arms in one container, round-robin, two passes, against the `no drain` control at the same 320 threads: 4096^3 [256, 256] all lanes 0.0980, 0.0969 ms one lane 0.0979, 0.0980 ratio 1.001, 0.989 drain 3.46 -> 3.42, 3.16 -> 3.43 us 8192^3 [512, 256] all lanes 0.5385, 0.5387 ms one lane 0.5384, 0.5387 ratio 1.000, 1.000 drain 3.13 -> 3.11, 3.19 -> 3.19 us At [512, 256] the arms agree to four figures in both passes. At [256, 256] the passes disagree in sign by less than that shape's own spread on a fixed arm -- the all-lanes row alone moves 1.1% between them. It is a null: an arrival is one atomic increment on a shared word, a warp issues its 32 in one instruction, and the waiter is a parity spin that does not care how many ended it. It ships guarded anyway, because one a warp is what the code means. `bench sol-ablate` also could not run at all before this. #197 pinned the ablation probes to ONE_WARPGROUP and took the shipped kernels to 320 threads, but `Arm::Whole` launches the shipped kernel and kept asking for 192 -- which the launch contract rejects rather than runs, so table 1 died on `block (192, 1, 1) does not match required block (320, 1, 1)` and every table after it was lost. `whole` gets pinned probes of its own at the geometry every ladder here is held at, which is what #197 intended for the other thirty-three. regcount: the gate is green and every `gemm_sol` rung reads zero stack and zero spill. `gemm_sol_m512` moves 83 -> 95 registers and `gemm_sol_m256` does not move at all, and the two arms in one crate say the guard is what did it -- `gemm_sol_m512_wg2` 84 against `gemm_sol_m512_wg2_lane` 95. Residency is fixed by the shared plan either way; the step at 320 threads is 168 and 95 leaves 73. * The PR number the release-scope notes point at is 218
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.
The brief was to port oxide-train's recent GEMM work back, led by
#86 — "One CTA an SM, six K
stages and two accumulators: the configuration cuBLASLt runs", which moved that
tree's model-shape mean from 0.906 to 0.939 of cuBLASLt.
Almost none of #86 is portable, because almost all of it is already here.
The one thing it genuinely contributed was a reason to re-open a closed
question, and re-opening it found that the epilogue's warpgroup split — recorded
in
docs/kernels/gemm_sol.mdas a null attributed to the hardware — was measuredthrough a
.localdepot that #166's walk marking has since removed. Re-run, itwins at both entries and both passes, and it ships here.
bench --case gemm-sol, ours against a cuBLASLt FP16 taken in the same process,same stream, same clock:
[256, 256][512, 256][512, 256]Read the two large rows' ratios and not the small one's. The denominator held to
0.04% across the two containers at 8192³ and 16384³, so 0.930 → 0.948 and
0.978 → 0.989 are the measurement. At 4096³ cuBLASLt's own time moved 2.11%
between containers — more than the change is worth — so that ratio says nothing;
our own time still improved 1.52%, and the same-container A/B below is what
covers that shape.
The same-container A/B, which is the actual evidence
bench sol-ablatetable 6 already runs both geometries round-robin in onecontainer against a
no draincontrol at each thread count. It is the table thatrecorded the loss, so it is the table re-run — two passes, unchanged code, at
f64a27b:[256, 256][512, 256]no draincontrol, 192 vs 320 threadsThe sign reverses at both entries and both passes, and the term that was blamed
is the term that moves: at
[512, 256]the drain gets 35% cheaper ratherthan slower. The
no draincontrols still match to a tenth of a percent, so thetwo extra warps remain free when they do nothing and the whole difference is the
drain.
Why it was wrong the first time
The lane argument in the docs is still true — warps 0 and 4 own the same 32
tensor-memory lanes, so a column split puts two requesters on each of four
sub-partitions instead of spreading over eight. It was simply not the term the
table was reaching.
Every row of the original was taken through a
.localdepot the library nolonger emits.
store_tile_x4homed each drained band to local memory until therolled walks were marked (#166, landed in #180/#181/#184), and a band is the
frame — a
RegTile<32, 64>is 64 f32 is 256 B, which is the staged family'srecorded frame exactly. The split pays that frame twice per accumulator where
one warpgroup pays it once, so the arm doing more of the broken thing read as the
arm that was worse.
regcountnow reads zero stack and zero spill on everygemm_solrung.Registers and occupancy
The three entries join
GATED_KERNELS. Their residency is fixed by the sharedplan — 196 864 and 229 632 B of the 233 472 an SM divides — so no register count
can raise it; what the gate watches is the other direction,
_ctas_by_registersreaching zero, which is a launch the driver refuses rather than a slow one.
At 320 threads that step is 168 registers a thread:
82 and 83 against 89 and 80 before, zero spill and zero stack throughout. The
split lowers the register count at
[256, 256]— each warp carries half thecolumns.
The shared plan is byte-identical either way (eight warps stage half the
columns each), so no
dynamic_sharedmoves. What moves is the block, to 320,which is why
Variant::threadsnow sits besideVariant::shared_bytesand thelauncher asks the variant rather than reading one
THREADS.What did not ship, and why
gemm_sol_m256_n128keeps one warpgroup. The split is legal there and theasserts cover it, but table 6 has arms at
[256, 256]and[512, 256]only,so
[256, 128]has no A/B of its own. Shipping it would be shipping a geometrynothing in this tree has timed.
widedrain rung stays a rung. It was the other candidate confoundedby the same frame (the docs say outright "the loss is not separated from that
frame"), and re-measuring it was worth doing: 1.001 / 0.998 of
pairedat4096³ and 1.004 / 1.007 at 8192³, against −1.1 to −1.3% as recorded. So about
a point and a quarter of its original loss was the frame. But it does not
compose with the bigger win — at two warpgroups
[512, 256]'s per-warp tile is64 columns, which a 128-column band does not divide — and the warpgroup split
is worth four times as much at the same entry. Documented, not shipped.
The ablation and watch probes are pinned to
ONE_WARPGROUPexplicitly ratherthan following
SHIPPED_GROUPS. They had been reading the shipped constant tomean "the geometry this ladder is held at", and those are two different facts:
flipping
SHIPPED_GROUPSwould otherwise have silently reshaped thirty-threeprobe kernels and stopped every historical arm comparing to itself.
The port decisions
From #86 — the configuration is already here
SLOTS = 2, release moves toempty(i + SLOTS))ACCUMULATORS = 2with aSemaphoreRing<2>;Small::multiplywaitsempty.wait(sequence - ACCUMULATORS). Algebraically identical — oxide spells it as a release atsem(sequence + SLOTS)over a 4-deep ring, we let the phase parity carry it over a 2-deep one.alloc_cluster(.., 2 * BLOCK_N)at both 256-wide entries.STAGES3 → 6k % (STAGES · BLOCK_K) == 0; at six that isk % 384, which excludes every shape this repo benchmarks — k blocks 16/32/64/128/256, none divisible by 6. oxide's model shapes are multiples of 3072 and divide by 384; powers of two cannot. The only depth above 4 that divides them is 8. And the memory says no independently:[256, 256]at six stages is 262 400 B against the 232 448 optin, fitting only if the staging tile is halved back to 128 — i.e. by giving up increment 2 to buy the stages — and[512, 256]is 294 912 B of ring alone.STAGE_N64 → 128 (wide staging tile)[256, 256]entry stages 256 columns per warp, twice oxide's, so its drain is already one shared→global pass where oxide's is two. #86 attributes this increment to two effects — half the TMEM waits and half the store passes — and we already had the second at its floor. The first half is thewiderung above.GROUPstays 8 at 74 clustersbench soltable 3 has it flat to 0.2% over{1,2,4,8,16}.From everything merged after
ea8e147c3c2d66— dK/dV epilogue deferred into the next item's opening movepipeline::Job(src/pipeline.rs), tail-flush obligation and all. oxide applied the library's existing feature to a second kernel.525d1ce/2f1e016— AdamW load-before-storeptx_asm!with order fixed by construction.a5d3359,3927b5c— MoE dead-bin walk, router reduction widthdab1c44,8996e6aPortable, real, and deliberately not in this PR
Two things oxide has that we do not, both genuine and both wanting their own A/B
rather than a ride on this one:
Release::nowfires between the twoTMEM lifts, as soon as the last
tcgen05.ldhas its registers; ours releasesonly after the whole drain returns. What binds the GEMM at 1081 TFLOP/s, and does the curve flatten at 16384 cubed #86's own text says it "costs nothing and
still bounds the worst case", and this PR reshapes the drain underneath it.
release_accumulatorhas no lane guard,so all 32 lanes of every epilogue warp arrive: 256 arrivals a slot against
oxide's 8 — and this PR doubles that to 512. Three lines, on a barrier on the
critical path, and therefore exactly the kind of change that should be timed
rather than assumed. The most concrete follow-up here.
On
gemm_wsThe brief flagged a tension: our warp-specialized GEMM at 1 CTA/SM measured −7.3%
at 16384³, while #86 runs 1 CTA/SM and wins. It dissolves without a measurement.
gemm_ws's −7.3% is againstgemm_cg2, the other GEMM lineage, which runs twoCTAs an SM.
gemm_sol— the faster lineage, and the one this PR touches — has runone CTA an SM at all three entries since it was ported, forced by its shared plan
and not chosen. Residency was never the variable in the
gemm_wsresult; warpspecialization inside a single CTA was. #86's residency is not something this repo
can adopt, because it already has it.
Gates
scripts/modal-run build— clippy clean on all four manifests,sm_100acodegen for
device-tests,examplesandexperiments,ptxasclean.(The run exited 4 on
Timed out waiting for final app logsafter the lastcommand completed — the client lost the tail, not a failure.)
scripts/modal-run regcount— occupancy gate green, table above; zero stackand zero spill on every
gemm_solrung.bench --case gemm-sol— every row checked exact against the CPU referencebefore it is timed, all three green.
bench --case sol-ablate— every arm checked, both passes.