Repository navigation
The drains dispatch on the ladder's byte count again, and the jump tables were never this tree's (#225) - #227
Merged
Merged
Conversation
…bles were never this tree's (#225) `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
feitreim
added a commit
that referenced
this pull request
Aug 7, 2026
…ow (#228) * A wait on a device has a deadline, and an arm that wedges costs one row `kittens::watchdog` polls the event behind a launch instead of blocking on it, so a kernel that stops making progress ends the process in 30 s naming the row the sweep last announced. Every host wait in the three kernel crates goes through it. `session` now runs the arms after a failed one and summarizes, so `bench --case sol-k` and `profile` -- barred from `ARMS` because a hanging launch takes every row after it -- have arms. `wedge_demo` is the control. Timeouts are re-derived from measured baselines with the baseline in a comment; `device_tests` moves 1200 -> 300 against its measured 83.5 s. * The cache volume was serving a stale build, and rustdoc is what said so * The staging constructors synchronize too, and the demo is what found it * CI.md carries the stale-build finding and the measurement that closes it * The wedge belongs in front of the row's own launch, not in front of the process * The spin says where it is, and its loop cannot be hoisted away * The docs say two minutes because the demo does * The coverage section names all three of the calls that synchronize * Every wait can say how long it took, and the demo asks it to * The spin uses clock64, because a globaltimer spin is a loop LLVM may delete * The trace says the guard reports and the spin is absent, and both files say so * The spin reads memory it can never be sure of, and the demo shows the PTX first * The jump-table census reads zero from a fresh build, where #227 recorded no change * An event cannot sit behind a call that never returns, so the row gets a thread * The design notes carry the two deadlines and the eight runs behind them * The deadline fired at 5.0 s and the arms after it ran, so the docs say the number
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.
Closes #225 — but not with the story the issue has, and the difference is worth
reading before the diff.
The fix
Both drains match
access_width_bytes— three cases and a wildcard — instead ofmatching
AccessWidthexhaustively.AccessWidth,access_widthand everydiscriminant #219 introduced stay exactly as they were;
AccessWidth::RUNGS(
variant_count) and aconst { assert! }at each drain keep the one thing theexhaustive match was there for: a rung added to the type is still a compile
error at both drains.
What an exhaustive match costs is not the typing, it is that it names every
rung whether or not the instantiation can reach one. Measured on rustc's MIR,
same nightly, four spellings of the same dispatch:
match AccessWidth, four arms (#219, main)switchInt [16, 8, 4, 2, otherwise: unreachable]match AccessWidth, three arms +_switchInt [16, 8, 2, 4, otherwise]— rustc re-adds the covered variantif width == …chain over the enumswitchInts, re-merged by LLVMmatch access_width_bytes, three arms +_switchInt [16, 8, 2, otherwise]LLVM tables a switch at four cases and branches at three
(
MinimumJumpTableEntries; confirmed againstllc -mtriple=nvptx64 -mcpu=sm_100aon hand-written IR, where 4 cases →
brx.idxand 3 → compares, with and withouta reachable default). So a caller whose leading dimension or column is a
compile-time constant folds a rung away and gets three — unless the match spells
the fourth back in. That is how oxide-train's
gemm_tcgen05_bf16_optimizedacquired four
brx.idxtables at #219. A wildcard lets the dead rung fold.The reproduction, which failed, and what it found instead
The issue asks for a JIT-load reproducer on a B200. It does not reproduce, and
the negative results are the most useful thing here:
regcountat 3ae07a8 (thecommit before The accumulator note says what #203 did, and the access ladder is a type the drains must cover #219) already emits 51 jump-tabled entry functions; at
bda3329 it emits the same 51, plus the four
gemm_sol_*_earlykernels that did not exist yet. Every count identical, no entry gained or
lost one.
device_tests(57/57),examples,kittens-experiments -- checkandbench --case gemm-solall run at main with those 55 tabled kernels in themodules they JIT-load.
device-tests' newshared_drain_quadcalls both drains at both tile widths in a single kernel — the consumer's
exact shape, 4 tables in one entry, against ferro's previous maximum of 2.
Built at main, its module loads and the harness passes 57/57.
rungs (16/8/4/2) and table; the fp32 drains have three, because
access_widthcannot return 2 for a 4-byte element, and never table — at anycommit, under any of the four spellings above.
So
brxis necessary in the consumer's failure — their opcode diff and bisectare not in doubt — but it is not sufficient: whatever tips
cuModuleLoadDataintoDriverError(218)in their module is not the count, notthe construct alone, and is not reproducible from this repo. This fix restores
the lowering their green build had; if 218 survives it there, the remaining
variable is on their side and worth a fresh issue.
Why the guard is a census and not a gate
regcountgrows a jump-table census beside the local-memory depot —brxperentry function, the same substrate, for the same reason:
ptxasnever reportsit, and it is where a runtime compiler's refusal lives. It is a report,
because a gate would fail every run of a tree that works (55 of 318 at main,
and green everywhere). The thing nobody had was not a gate; it was a column to
diff. The regression downstream was one opcode class appearing in one module,
and it took a consumer's bisect to find because this repo measured registers,
opcodes and
.localand never this. It arms into a gate if the shipped set everreads zero.
The device tier's half is
shared_drain_quad: module load is whole-module, sotier 3 exercises it by starting at all — no extra container, no extra device
time, and the only module in the tree with the consumer's shape. CI.md gains a
tier-2 section on the
ptxas/JIT split that made this invisible.Codegen and timing
regcount, main vs this branch, same arch, same container recipe:gemm_*rows, 0 differbench --case gemm-sol, separate containers (the arms cannot share one acrosstwo trees), with cuBLASLt in the same process as the control:
The unchanged baseline moves further than our arm does at the shape where our
arm moves most, and
ours/theirsat 4096³ improves (0.853 → 0.869). Withevery static counter identical, this is the container-to-container drift CI.md
prices at 2.9%, not the diff.
Gates
scripts/fmt --check,clippy --all-targets -D warnings,test(doctestsincluded) and
doc --no-depslocally;regcountgreen on Modal CPU;session --arms device-tests,bench:gemm-sol,examplesgreen on a B200 —57/57 harness cases, both example binaries,
kittens-experiments -- check.Follow-up
oxide-train is pinned at
3ae07a8(#218) because of this (oxide-train #127).Once this merges the pin can advance to ferro main — and that bump is also the
experiment that says whether the compare-chain dispatch is what their module
needed, which nothing in this repo can answer.