Skip to content

regcount census of .local in the PTX text, and its first run is why it reports rather than gates - #167

Merged
feitreim merged 1 commit into
mainfrom
regcount-local-depot
Jul 31, 2026
Merged

feitreim merged 1 commit into
mainfrom
regcount-local-depot

Conversation

@feitreim

Copy link
Copy Markdown
Owner

Built against the depot a value-select among per-stage shared symbols lowers to — a match yielding pointers or barrier references, one static per stage, which stock LLVM stores to .local and reloads in the hot loop. Measured on the real work-stealing gemm at 8192³ in cuda-learning's kernels/barrier_bench, three otherwise-identical kernels: 710 TFLOP/s for the depot spelling against 857 for stage selection as base.add(i). The rings and SharedPlan exist so selection is always the latter, but that property was emergent and nothing was watching for the class.

The check reads the PTX text — the .local .align frame declaration and its st.local/ld.local traffic — because the depot is LLVM's and a ptxas spill happens after PTX and never appears in it. Disjoint from the spill columns by substrate, which is exactly how the finding stayed hidden: it shipped as a hard gate on the examples crate plus GATED_KERNELS, and its first run failed on every one of them. 256 B with 64 st.local / 16 ld.local across the whole staged-x8x4 family and every gemm_sol_* rung, 528 B on gemm_cg2, 1824 B on flash_forward, ~1540 B on groupnorm_tile — all sitting in ptxas' stack column all along, unread, because #152 and every audit before it watched the spill columns, which are ptxas' own decisions and stayed zero. The register-tile probes carry the same shape — scalar stores, a quarter as many loads — so the suspect is a dynamically-indexed fragment array in reg.rs, not stage selection. That is a guess and is marked as one; #166 carries the attribution work.

So the raise is demoted to a report until the frames are attributed: failing on a number nobody understands gates nothing. The arming condition is written where the census prints — a shipped set that reads zero flips it back (#166 is the exit condition). The gate variant was watched to fail on the real tree before being demoted, and the report ran green through scripts/modal-run regcount with the sentinel seen; the census table diffs across a change the way the register table does.

…t reports rather than gates

Built against the depot a value-select among per-stage shared symbols lowers
to -- a `match` yielding pointers or barrier references, one static per stage,
which stock LLVM stores to `.local` and reloads in the hot loop. Measured on
the real work-stealing gemm at 8192^3 in cuda-learning's `kernels/barrier_bench`,
three otherwise-identical kernels: 710 TFLOP/s for the depot spelling against
857 for stage selection as `base.add(i)`. The rings and `SharedPlan` exist so
selection is always the latter, but that property was emergent and nothing
was watching for the class.

The check reads the PTX *text* -- the `.local .align` frame declaration and
its `st.local`/`ld.local` traffic -- because the depot is LLVM's and a ptxas
spill happens after PTX and never appears in it. Disjoint from the spill
columns by substrate, which is exactly how the finding stayed hidden: it
shipped as a hard gate on the examples crate plus GATED_KERNELS, and its
first run failed on every one of them. 256 B with 64 st.local / 16 ld.local
across the whole staged-x8x4 family and every gemm_sol_* rung, 528 B on
gemm_cg2, 1824 B on flash_forward, ~1540 B on groupnorm_tile -- all sitting
in ptxas' stack column all along, unread, because #152 and every audit before
it watched the spill columns, which are ptxas' own decisions and stayed zero.
The register-tile probes (band_roundtrip, fragment_map_32x128, the
store_ring_* family) carry the same shape -- scalar stores, a quarter as many
loads -- so the suspect is a dynamically-indexed fragment array in `reg.rs`,
not stage selection. That is a guess and is marked as one.

So the raise is demoted to a report until the frames are attributed: failing
on a number nobody understands gates nothing. The arming condition is written
where the census prints -- a shipped set that reads zero flips it back. The
gate variant was watched to fail on the real tree before being demoted, and
the report ran green through `scripts/modal-run regcount` with the sentinel
seen; the census table diffs across a change the way the register table does.
@feitreim
feitreim merged commit caa6075 into main Jul 31, 2026
1 of 3 checks passed
@feitreim
feitreim deleted the regcount-local-depot branch July 31, 2026 01:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant