Skip to content

flash_forward's 1 CTA/SM is its shared plan, and shrinking the ring needs a reference first #85

Open

Description

@feitreim

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:

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:

  • STAGES on 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.
  • PTile is [128, 64] bf16 = 16384 B, staged back to shared as the A operand 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:

  1. A launcher and a CPU reference for flash_forward (plausibly its own issue).
  2. Locate the shared-plan threshold on the census.
  3. 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

  1. added
    area:compute
    on Jul 28, 2026
  2. feitreim commented on Aug 4, 2026

    @feitreim
    OwnerAuthor

    The prerequisite landed in #182: flash_forward has a launcher, an f64 causal reference and a check (worst relative error 1.66e-3 against tolerance 2⁻⁸, argument in docs/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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:compute

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions