Repository navigation
Description
The first run of the .local census (regcount's fifth table, branch regcount-local-depot, commit 956b88a) shipped as a hard gate on the examples crate plus GATED_KERNELS — and failed on every row. Every kernel either crate ships carries an LLVM local-memory frame in its PTX:
| kernel | frame | st.local / ld.local |
|---|---|---|
gemm_cg2_staged_x8x4 (both crates), every gemm_sol_* / gemm_ws_* rung |
256 B | 64 / 16 |
gemm_cg2 |
528 B | 419 / 139 |
flash_forward |
1824 B | 1362 / 679 |
groupnorm_tile |
~1540 B | 1464 / 608 |
Why nobody saw it
The frame is LLVM's, so it lives in the PTX text and in ptxas' stack column — with zero spill stores/loads. Every audit including #152 read the spill columns, which count only ptxas' own decisions. Disjoint substrates: a ptxas spill happens after PTX and never appears in it, and an LLVM frame is not a ptxas spill. The stack numbers were printed on every regcount run and read by nobody.
What it probably is, and what that claim rests on
The census was built against the depot a value-select among per-stage shared symbols lowers to (cuda-learning kernels/barrier_bench: 710 vs 857 TFLOP/s at 8192³, otherwise-identical kernels). That is not what this is. The rings came out clean by construction; the signature here — many scalar st.local, about a quarter as many loads, so an array built element-wise and read back .v4 — shows up in the pure register-tile probes too (band_roundtrip 272/144, fragment_map_32x128 272/144, store_ring_depth_1 74/42), which points at a dynamically-indexed fragment array in reg.rs that LLVM could not SROA. That is a guess and is marked as one in the census' section comment.
The 64/16 shape is byte-identical across the whole staged-x8x4 family and every gemm_sol_* port — one shared code path, so one fix likely clears most of the shipped set.
What is unestablished
- Attribution: which
reg.rspath produces the 64/16 pattern. - Cost: whether any of the traffic sits in a hot loop.
x8x4reaches 95.8% of cuBLASLt with the depot, but The item boundary was the epilogue, and BLOCK_K was already right #114/The epilogue is the gap, and at 4K it is only a fifth of it (#138) #144 put the epilogue as the dominant remaining cost and a 256 B round-trip per drained tile is epilogue-shaped._print_sass_loopson the x8x4 cubin can say without a GPU.
Exit condition
The census reports today because failing on a number nobody understands gates nothing. When the shipped set reads zero, flip the report back to a raise — the arming condition is written where the census prints.
Activity
feitreim commentedon Aug 3, 2026
Two independent data points from the oxide-train kernel-rewrite wave (2026-08-03), both this issue's phenomenon surfacing downstream:
feat/issue-70-tile-probesbranch there.Together they sharpen this issue's ask: the depot appears when the width a register op works at crosses a threshold near 32 fp32 columns, and the regcount census (#167) would have caught both before a kernel paid for them.
feitreim commentedon Aug 3, 2026
Attributed and two-thirds fixed in #180. The frames are the register tiles themselves: a storage walk that stops unrolling (LLVM's budget, ~32 fp32 columns) leaves a dynamic GEP, SROA cannot split the aggregate, and the tile is homed to
.local— one rolled reader is enough to home a tile whose builder unrolled fine. The working fix is cuda-oxide's__unroll_config::<0>()marker plus an inline-constbound (the trip-count analysis readsM / 16as a runtime division otherwise). Movers (ldst/tmem/global) are done: staged family, gemm_sol rungs and gemm_cg2 read zero, andbench --case gemmmoved 0.939 → 0.978 of cuBLASLt at 8192³. The remainder is thereg.rsmap walks onflash_forward/groupnorm_tile, and blanket-unrolling those was measured at 255 regs + 208/208 spills on flash_forward — worse than the depot. Arming the gate waits on a per-kernel answer there.The depot was the tile behind a rolled walk, and the mover walks now …
feitreim commentedon Aug 3, 2026
groupnorm_tile resolved in #181, and it sharpens what a map-walk frame is: not a rolled loop to unroll but a band that does not fit. The kernel held its whole [32, 128] band — 128 fp32 a thread against launch_bounds' 168-register cap — and the fix is the streaming layernorm_rows already proved, once the kernel had a launcher and reference to make a rewrite checkable (it passed its first-ever check as filed, worst absolute error 7.76e-3 = half a bf16 ulp at the seed's largest outputs). Measured on B200: 168 regs / 1536 B frame / 3 blocks/SM / 594 GB/s → 48 / 0 / 6 / 5996 GB/s, a factor of 10.1 at bit-identical error.
The census now reads 1 of 12 shipped kernels carry local memory: flash_forward, whose 1824 B is the algorithm's own live state (a [32, 128] fp32 accumulator across the whole key loop). Its launcher + CPU reference (#85) is in flight; only past that check can any register-side change there be honestly measured. The gate arms when that last kernel reads zero — or when its frame is ruled the right cost and the census learns to say so.
A map walk's frame is a band that does not fit, and groupnorm_tile st…
feitreim commentedon Aug 4, 2026
Downstream attribution: oxide-train's three flash kernels, before and after the c648c67 pin. Posting here rather than opening a duplicate — no ferro change is asked for, but the numbers close out the flash half of this issue's census and confirm #181's category from a second codebase.
The census, post-#180
modal run modal_app.py::main --kernel flash-attn --ptx, sm_100a, ferroc648c67. Depots inflash.ptx:flash_backward_qflash_backward_kvflash_forward__local_depot2[560], 405ld/st.localSo #180 did all of the backwards' frames and none of the forward's. That matches the realized timings at [32,1024,24,128] on B200: dQ 1.298 → 1.094 ms (−15.7%), dK/dV 1.990 → 1.552 (−22.0%), forward only 1.343 → 1.211 (−9.8%).
The 528 B in both backwards was the
pipeline::Jobstruct reached through the mover walks; nothing downstream had to change for it.The forward's 560 B is #181's category
It was a
RegTile<32, 128, BaseLdtm>output accumulator held across the whole key stream, address-taken because both writers —reg::online_rescaleand a localmerge_output_tile— take it by&mut. Not hot in the usual sense: the only in-loop reader is a correction path that fires on 0.00% of tile visits at every gated shape. It cost ~30% anyway, because the two unconditional touches (the tile-0 rescale and the epilogue merge) run once per work item over 128 depot slots each.Four formulations, one container, same shape
&mutaccumulator (baseline)&mutbandtile_x8(...).mul_row(f))OutHalf = RegTile<32, 64>)Two things worth recording from that table:
&mutit is address-taken; by value the drain and the result are live together and ptxas allocates 253. Only the 64-wide form is both zero-frame and fastest — exactlygroupnorm_tile's streaming fix in A map walk's frame is a band that does not fit, and groupnorm_tile streams its own (#166) #181, one axis over.Also worth noting for #181's write-up: the same kernel's
.x8drain at the full 128 is fine when nothing is done to it. Both backward kernels dotile_x8::<32, 128>straight intostore_rowsand carry 0 B. It is the transform in between that makes the band not fit, not the width by itself.What ferro supplied
TmemTile::store_tile+store_wait(thetcgen05.stpath, §2.1) is the whole of the fix: the correction now rescales O in its own segment and keepsenable_don, instead of restarting the segment and carrying the running output in registers. Device-tested round-trip indevice-testsgave enough confidence to write it without a probe of my own, and parity came out identical to the digit at all five gated shapes.No API gap found. If anything is wanted in ferro from this, it would be a doc note on
reg::online_rescalethat its&mut RegTileargument is a band-width decision and not just a calling convention — at 64 it is free, at 128 it is a frame. Happy to send that as a one-paragraph PR if you want it.Downstream PR: feitreim/oxide-train#77.
The drain probes' band fill unrolls, so its own depot stops sitting i…
An fp32 band reaches a shared staging tile, because a scatter is not …
The warpgroup split lost to a `.local` depot rather than to the lanes…