Repository navigation
Description
flash_forward is capped at 1 CTA/SM by its shared plan, and the only thing that
would move it is a smaller K/V ring — which cannot be checked until the kernel has a
launcher and a CPU reference.
Split out of #78, which is closed by #84 with the measurement below. This issue is the
consequence, not the finding.
What is now known, measured
device-tests' tmem residency census (#84) counts CTAs an SM directly, by %smid and
%globaltimer rather than by asking the occupancy query. Residency is
min(512 / columns, shared per SM / plan), exactly, at every rung. For this kernel, on a
B200 with 233472 B of shared memory per SM:
| resource | flash_forward's value |
CTAs an SM it admits |
|---|---|---|
| TMEM columns | 256 | 2 |
| dynamic shared | 147536 B | 1 |
| both together | 1 (measured) |
So the 1 CTA/SM is real — 4 warps of the 64 an SM can hold — and it is caused by
shared memory alone. A rung carrying the same 147536 B plan with no allocator in the
kernel at all also counts 1, which is what isolates it.
Why this is worth an issue rather than a commit
Every previously proposed lever is now either refuted or blocked:
- Shrinking the TMEM allocation buys nothing here. flash_forward is pinned at 1 CTA/SM with no shared memory and no register pressure to explain it #74/The 1 CTA/SM is tcgen05 itself, and a smaller TMEM allocation buys nothing (#74) #77 said so and were right,
but for the wrong reason — they thought anytcgen05.alloccosts the whole SM's
tensor memory. It does not; 256 columns admit 2 CTAs. It buys nothing because shared
memory already caps the kernel below that. - Shrinking the shared plan is the lever, and flash_forward asks for 147536 B of shared memory and the driver admits 0 blocks per SM #70 explicitly ruled it out. That
conclusion came from querying occupancy at 147536, 73792, 32800 and 0 bytes and
getting 1 block/SM at every one — all four of which were the allocator pinning the
query at 1, not the plan. - Warps per CTA (The 1 CTA/SM is tcgen05 itself, and a smaller TMEM allocation buys nothing (#74) #77's conclusion,
QUERIES / 32= 4) is a different decomposition
rather than a constant to raise, and it was never established as the only lever.
What would have to happen
Two CTAs an SM needs the plan under 116736 B, half of 233472. Current plan is
147536 B, so about 31 KB has to come out. Candidates, none priced:
STAGESon the K/V rings. Each stage of a[64, 128]bf16 tile is 16384 B, and the
two rings carry one each — so one stage off both rings is 32768 B, which is on its
own enough to cross the threshold.PTileis[128, 64]bf16 = 16384 B, staged back to shared as theAoperand of
O = P·V. Whether it can live in TMEM or be recomputed is a real question.
The 116736 B threshold is arithmetic, not measured. The census brackets it between
73768 B (counts 2) and 147536 B (counts 1) and does not locate it between them. Shared
memory allocation granularity could move it. Locating it is cheap — one more rung on the
existing census — and should be done before anyone edits the ring.
The blocker, which is the actual prerequisite
flash_forward has no launcher and no CPU reference. Fewer ring stages changes when
loads land relative to the MMA, so it is exactly the kind of change that can be silently
wrong, and there is nothing in the repo that would notice. Both #74 and #78 record this
and #67 is the precedent for why the harness comes first: the fix there turned on a rung
the ladder did not predict, and only a real reference caught it.
So the order is:
- A launcher and a CPU reference for
flash_forward(plausibly its own issue). - Locate the shared-plan threshold on the census.
- Only then price a smaller ring, against the reference and on a clock.
Housekeeping this leaves
flash_forward.rs's module doc still carries #77's "shrinking the allocation buys
nothing" with the reasoning that a CTA is charged the SM's whole tensor memory. The
advice is accidentally right and the reason is wrong. #84 could not correct it because
examples/src/ belonged to #29 for that window. Same for examples/src/main.rs's
occupancy table, which prints 1 for flash_forward and cluster for gemm — the first
is right for the wrong reason and the second is now answerable with
cuOccupancyMaxActiveClusters.
Related: #84 (the census and the measurement), #78 (which this closes out the
consequence of), #83 (gemm at 3 CTAs/SM, the same model's other case), #70 (which
ruled out the resource that turns out to be the only one binding), #74, #77.
Activity
mma_ab's shape is the band's, and the two callers that read it as the…
feitreim commentedon Aug 4, 2026
The prerequisite landed in #182:
flash_forwardhas a launcher, an f64 causal reference and a check (worst relative error 1.66e-3 against tolerance 2⁻⁸, argument indocs/kernels/flash_forward.md). The first checked run also found and fixed a second latent bug — the epilogue's output cursor dropped the head term, so every head wrote panel zero.Ring experiments are unblocked: a smaller K/V ring variant can now be checked before any residency claim is made about it. Same for #166's last item — whether this kernel's 1824 B accumulator frame is the right cost is now a timeable question rather than a register-count argument (a timed bench case wants a causal-FLOP denominator first;
experiments' SKIPPED note says so).flash_forward earns its checked run, and the run finds the epilogue d…
The SFU exp2 wins on softmax and loses on flash_forward, and the two-…
The SFU exp2 wins on softmax and loses on flash_forward, and the two-…
The SFU exp2 wins on softmax and loses on flash_forward, and the two-…