Repository navigation
Description
Split out of #70, which set out to explain a zero and explained it — the zero
was the missing >48 KB opt-in — and then found something the issue had ruled
out in advance.
#70 assumed that if the opt-in were the cause, "the remaining question is
whether 1 block/SM is acceptable", pointing at the K/V rings as the thing to
shrink. Shrinking them buys nothing. flash_forward answers 1 block/SM at
its own 147536 B, at 73792, at 32800, and at zero dynamic shared memory.
The measurement
B200, flash_forward at 128 threads, a fresh module load per probe — this
is load-bearing, because the opt-in is a persistent mutation of the loaded
function, so a naive sweep admits once at the largest size and every later
query answers about that ceiling instead of the one asked for.
device opt-in ceiling: 232448
before admit: max_dynamic=49152 static=0 blocks=0
after admit : max_dynamic=147536 blocks=1
what a smaller plan would buy, each on its own function:
147536 B -> 1 blocks 49152 B -> 1 blocks
114752 B -> 1 blocks 40960 B -> 1 blocks
98368 B -> 1 blocks 32800 B -> 1 blocks
73792 B -> 1 blocks 16384 B -> 1 blocks
65536 B -> 1 blocks 0 B -> 1 blocks
And the same query against block width, every entry at 0 dynamic shared, with
the two normalizations as controls:
flash_forward max_threads=512 32->1 64->1 128->1 256->1
softmax_rows max_threads=896 32->28 64->14 128->7 256->3
layernorm_rows max_threads=256 32->8 64->4 128->2 256->1
The controls scale inversely with block width exactly as a register-bound
kernel should. flash_forward is flat in both axes — flat in shared
memory, flat in warp count. That is not a shared-memory ceiling and not a
register ceiling; it is a per-CTA resource that one CTA exhausts on its own.
ptxas prices flash_forward at 124 registers a thread, 0 spills, 1824 B
stack, 0 static shared. 124 registers at 128 threads would admit 4 blocks. So
the register file is not what is binding, and the occupancy query knows
something ptxas -v does not — which is the #63 point from the other side.
The hypothesis, which is NOT a finding
TMEM, and specifically the allocation granularity. flash_forward is the
only queryable entry point here that uses tcgen05 — gemm is the other user
and the query cannot describe a #[cluster_launch] kernel — so it is the only
kernel in the table holding a per-CTA resource the other two do not hold at
all. That correlation is the whole of the argument.
Nobody has tested this. #70's agent states plainly that it inferred TMEM
and never varied the TMEM allocation, never queried TMEM occupancy, and never
built a control. It is an unexcluded-alternatives argument from a sample of
one, which is the shape of reasoning #47 exists to warn about — recorded here
so the next person starts from the right question, not so they skip it.
What would settle it
- Vary
flash_forward's TMEM allocation and re-query. If blocks/SM moves with
the column count, that is the answer; if it does not, TMEM is excluded and
the flatness needs another explanation. - A control in
device-tests: a trivialtcgen05kernel with a small TMEM
allocation and no shared plan. If it also pins at 1, the ceiling belongs to
tcgen05rather than to anythingflash_forwarddoes. - Check whether the driver is reporting a cluster-related constraint instead.
flash_forwardis a plain#[kernel]today, but if its MMA path implies a
cta_group::2 shape the query may be answering about a launch geometry the
kernel does not declare.
Why it matters
1 block/SM is 4 warps of the 64 an SM can hold. Nothing is in flight and
nothing can hide a latency — the same condition #47 measured on softmax and
priced at 2.6x. Flash has no launcher and no CPU reference, so this cannot yet
be confirmed as a time; it is currently an occupancy fact with an obvious
implication. Getting flash to runs is the prerequisite for pricing it, and
this issue is the prerequisite for that being worth doing.
Related: #70 (which produced this), #47 (the same shape, measured), #63
(ptxas reports what was allocated, never what it cost), #67 (registers
capping occupancy, where the register count is the explanation).
Activity
The 1 CTA/SM is tcgen05 itself, and a smaller TMEM allocation buys no…