Repository navigation
The accumulator note says what #203 did, and the access ladder is a type the drains must cover - #219
Merged
Merged
Conversation
…ype the drains must cover Two finds from the compressed-API audit, neither of which changes what any kernel emits. `mma::descriptor`'s note read as though a typed accumulator were waiting on #128. It is not: #203 closed #128 by typing the walks' accumulator *address* and deliberately stopping there, so an accumulator element type is owned by nothing and asked for by nobody. The note now says that. `access_width` returned a `usize` and both drains ended in `_ =>`, so a fifth rung would have arrived at the 4-byte arm instead of failing to compile. It returns `AccessWidth` now, a `#[repr(usize)]` enum whose discriminants are the byte counts, and `store_shared_rows`/`accumulate_shared_rows` name every rung.
feitreim
added a commit
that referenced
this pull request
Aug 7, 2026
…bles were never this tree's (#225) (#227) `store_shared_rows` and `accumulate_shared_rows` match `access_width_bytes` — three cases and a wildcard — instead of matching `AccessWidth` exhaustively. The enum stays exactly what #219 made it, and `AccessWidth::RUNGS` keeps the guarantee the exhaustive match was there for: a rung added to the type is a compile error at both drains. The reason is what an exhaustive match spells. Four arms lower to `switchInt(.., [16, 8, 4, 2, otherwise: unreachable])`, so a rung a caller has constant-folded away — a compile-time leading dimension, a known column — is materialised back into a live switch case, and LLVM tables a switch at four cases where it branches at three. That is how oxide-train's `gemm_tcgen05_bf16_optimized` acquired four `brx.idx` tables at #219 and lost its module to `DriverError(218)` at `cuModuleLoadData` (#225, oxide-train #127). A wildcard lets the dead rung fold. **The tables were not new here, and that is measured.** At 3ae07a8 — the commit before #219 — this tree's PTX already carried 51 of them, and at bda3329 it carries the same 51 plus the four kernels that did not exist yet. Every count identical. They load: `device_tests`, `examples`, `kittens-experiments -- check` and `bench --case gemm-sol` all run on a B200 on driver 580.95.05, the driver in the report. ferro's four-rung bf16 drains table; its three-rung fp32 drains never do, which is the in-tree control on where the threshold is. So `regcount` grows a **jump-table census** rather than a gate — `brx` per entry function, beside the local-memory depot, on the substrate `ptxas` never reports and a runtime compiler can refuse. A gate would fail every run of a tree that works; what was missing was a column to diff, which is exactly what the consumer had to run in their own repo to find this. `device-tests` grows `shared_drain_quad`: every drain in one entry, the consumer's shape, in a module the harness JIT-loads on every run at no extra container and no extra device time. It loads here — four tables in one entry are not what a JIT refuses — and it is the standing check for a driver that changes its mind. Codegen unmoved: 317 kernels, every register, spill, stack and smem counter identical to main, and no kernel gains or loses a table.
feitreim
added a commit
that referenced
this pull request
Aug 7, 2026
…is a gate (#225) (#229) * The jump tables were #219's after all, and the census that missed it is a gate (#225) Three readings of `regcount`'s jump-table census, each from a build that `_freshen` (#228) forced and whose four crates are seen to recompile in the container log, same image and same pinned nightly: 3ae07a8 #218, before the access ladder 0 of 309 bda3329 after #219, before #227 55 of 318 (9 shipped) 09beda9 main, after #227 0 of 319 #219 introduced every `brx` in this tree and #227 removed every one of them, which is the consumer's bisect exactly. #227 reported the opposite -- 51 already present at 3ae07a8, identical counts across its own fix -- from a comparison taken across the warm cache volume #228 later found serving stale builds. Both numbers are superseded. 3ae07a8 has no `AccessWidth` to match on at all, so zero is the only count that tree can produce. Half of #225's "necessary but not sufficient" survives and half does not. No GPU entry point mounts the cache volume (#226), so #227's B200 runs at then-main really were runs of the 55-table tree and those modules really did load. `shared_drain_quad` is the half that goes: it was added on the fix branch, after the fix had put both drains back on a three-case dispatch, so it has never carried a table and it is inside main's 0 of 319. Its doc said it demonstrated a JIT taking four of them; it demonstrated nothing of the kind, and now says so. So the census arms on the condition it set for itself. A kernel in the shipped set -- `examples/` plus `GATED_KERNELS` -- carrying a `brx` fails the run; probes are printed and do not, the way the local-memory depot's are. The table stays as the diagnostic. Watched in both directions: green at this branch (0 of 319) and red at bda3329's sources under the same armed `modal_app.py`, naming the nine shipped kernels. * The access ladder's note carries the in-tree numbers, not only the consumer's
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.
Two finds from today's compressed-API audit. Neither changes what any kernel
emits; one is prose and one is a match shape.
1.
mma::descriptor's note pointed at an issue that closedThe hardcoded
Tcgen05AccumulatorType::F32was explained as waiting on"whatever gives
TmemTilean element (#128 deliberately did not)", which readsas a future home that #128 was next to. It is not: #203 closed #128 by typing
the walks' accumulator address —
TmemTile<M, N>in place of au32, andMmaShapederived off it — and explicitly stopped there ("No accumulatorelement type. fp32 accumulate stays hardcoded in
descriptor").So the true statement is that fp16 accumulate is a
.kind::f16-only mode withno caller,
TmemTilecarries no element type, and threading one through isowned by nothing and asked for by nobody. The note says that now, citing
#128/#203 as what happened. No new issue filed — there is no ask to record.
docs/library/mma.mdstates the same fact and already reads as past tense(
#128 gave the walks the tile and deliberately stopped there), so it isuntouched.
2.
access_width's rung set is a type, and the drains cover itThe 16/8/4/2 ladder was correct, but
access_widthreturned ausizeand bothconsumers ended in
_ =>. A fifth rung added to the ladder would have arrivedsilently at the 4-byte arm of
store_shared_rowsandaccumulate_shared_rows—a wrong-width access at a cursor that does not admit it, which is a fault or
worse, and nothing would have failed to compile.
The shape: a
#[repr(usize)]enum, public, discriminants equal to the bytecounts.
Exhaustiveness over
usizeis not a thing Rust can check, so amatchthatfails to compile on a new rung has to be a
matchon a closed set. Thealternatives and why not:
usizereturn plus aconstassert at the arms — an assert can only fireat codegen for a width the ladder returns at runtime, which is a panic in a
kernel rather than a compile error, and it is not the ask.
pub fn access_width(..) -> usize—zero churn outside
global.rs, but it leaves the same hole one level up: apublic function whose whole point is that the rung set is closed, handing back
an integer that says otherwise. Two names for one thing to avoid touching
three call sites is the wrong trade.
AccessWidth::bytes()reads the count back for a caller doing arithmetic. Callsites stay clean: the drains match four named arms, and the ladder's own tests
name the rung instead of an integer.
The
E::BYTES == 2guard is preserved, as anifinside the named arm:Const-false at a 4-byte element, which is what kept the 2-byte drain from being
emitted for one and still does. The old guard fell through to the
_ =>4-bytearm when false; this arm does nothing instead. Both are dead code —
access_widthcannot returnBytes2at fp32, which is whata_four_byte_element_never_descends_below_its_own_widthpins.Callers touched: the doctest, the two ladder tests (
>= 4becameassert_ne!(.., AccessWidth::Bytes2), which is the claim that test's proseactually makes), and
tests/gaps.rs' §2.2 record. No kernel crate callsaccess_widthdirectly.Gates
GitHub Actions is in an outage, so tier 1 was run by hand rather than read off a
check. Everything below is a local or Modal run:
scripts/fmt --checkcargo test(root, device-only)gaps, 86 doctestscargo clippy --all-targets -- -D warnings(root)cargo clippy --features host --all-targetscuda_cudartredist viaCUDA_TOOLKIT_PATH)RUSTDOCFLAGS=-D warnings cargo doc --no-deps --features hostcargo clippy --all-targets×3 kernel cratesscripts/modal-run buildcargo doc --features host,cargo oxide build --arch sm_100aof all three kernel crates, thecublasFFI link, the vendored upstream buildscripts/modal-run regcountexamples/flash_forwardat 690st.local/ 383, the figuremodal_app.pyalready recordsregcountis here rather than skipped because Fix 2 restructures a match in twoshipped drains, and "the generated code is identical" is a claim worth a census
rather than an argument. It is.
device_testsandexampleswere not run: nothing in this diff changes aninstruction, a width, or a shape.