Skip to content

One CTA per SM is worth an unmeasured amount, and #15 is blocked behind the number #98

Closed

Description

@feitreim

#94 priced a shared-memory staging buffer for the epilogue and rejected it:

Against a steady state already at only 67% of dense peak, cutting concurrency
by a third to recover a term now worth 20–22% is a losing trade.

The arithmetic is right and the premise underneath it is unmeasured. "Cutting
concurrency by a third" is MAX_CLUSTERS 222 → 148, which is a third of the
residency. Whether it is a third of the throughput is a different question,
and nothing in this repo has asked it.

Residency buys latency hiding. A kernel whose pipeline already covers its own
latencies does not need the third CTA, and one that is bandwidth-bound may not
either. #84 established that CTAS_PER_SM is a measured property; it did not
establish what each of those CTAs is worth.

This blocks #15. lcsf's store stage needs either 16384 B of shared (one
fp32 band, against 4032 B of headroom — #94 §6) or accumulators held live across
the item boundary (against 3 registers of headroom — #95). Both routes buy the
20–22% boundary term by spending an occupancy step. If a step costs 33% the
trade loses and #15 needs #94's ring-slot-reuse route, which entangles it with
the schedule. If a step costs 10% the trade wins outright and lcsf is a
straightforward epilogue change.

We do not know which, and it is one measurement.

Scope

Price the occupancy step directly, changing nothing about the kernel's work.

  1. Add a dead shared allocation to gemm_cg2 — enough to cross the step,
    4033 B and up — that no code reads or writes. The work, the traversal, the
    instruction mix and the register count are all identical either side. The
    only variable is residency.
  2. Confirm the step actually happened. Count the CTAs instead of asking, and flash_forward's 1 is real for the other reason (#78) #84's %smid/%globaltimer census
    in device-tests counts residency rather than asking for it, and the
    occupancy query is confounded by the mere presence of tcgen05.alloc
    (The 1 CTA/SM is tcgen05 itself, and a smaller TMEM allocation buys nothing (#74) #77), so the census is the instrument. A run where residency did not move is
    a measurement of nothing.
  3. bench either side at 4096³, 8192³ and 16384³. Report throughput per step,
    not only the delta.
  4. Repeat at two step sizes if the plan allows it — 3 → 2 and 2 → 1 — since
    a linear cost and a cliff are different answers and predict differently for
    Sweep the GEMM's pair tile and pipeline depth: [256,256] at three stages should dominate on paper #87, which spends the same budget.

Why the dead allocation rather than building the real thing

Because a real staging buffer changes the epilogue and the residency at once,
and the whole difficulty in #94 §6 was that its cost and its benefit are
entangled. A dead allocation separates them: it has the cost and none of the
benefit, which is precisely the control. Same discipline as #67, #76 and #95 —
the number a decision rests on gets measured on a kernel built to isolate it.

Acceptance

A number for what one CTA per SM is worth to this kernel, with the census
confirming the step occurred, and a stated verdict on whether #15's straight
route is viable. The dead allocation does not land — it is an experiment,
and what lands is examples/README.md recording the result and the method.

Related: #94 §6 (the rejection this re-examines), #84 (the census), #77 (why the
query cannot answer this), #95 (the register half of the same cliff), #15, #87.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions