Repository navigation
Description
Writing the GEMM example (#18) turned up four separate cluster-scope gaps. All
of them were worked around in-file, each fenced with the signature it wanted.
None had an open issue. This was the surprise of that exercise — the gaps were
expected to be compute-side, and instead the compute layer was fine and the
scaffolding was not.
The library has mma_walk_cg2 and commit_multicast_cg2, so it can issue a
CTA-pair MMA — but nothing around that MMA is cluster-aware.
1. No cluster-scope TMEM allocation
tmem::alloc_block is cta_group::1. A cta_group::2 MMA writes an accumulator
the CTA pair shares, and there is no alloc_block_cg2. cuda-device exposes
tcgen05_alloc_cg2 / tcgen05_dealloc_cg2 (the gemm_sol example uses them).
2. No cluster-scope semaphore arrival
Semaphore arrives .shared::cta. A CTA waiting on its peer's progress cannot
be signalled. Related and not a transcription job: Semaphore::expect_tx
also lowers to .shared::cta, so under a cluster the transaction-byte
accounting is a design question — which CTA's barrier counts which bytes.
Decide that deliberately rather than by mirroring the CTA-scoped form.
3. pipeline::run cannot schedule a cluster
Work items are blockIdx.x-strided, so the two CTAs of a pair get different
items — exactly wrong for a cooperative MMA. The GEMM example therefore does
not use the persistent scaffold at all, which is a real indictment of it: the
one kernel that most wants a persistent pipeline cannot use ours.
Needs cluster-aware striding (item per cluster, not per CTA) and a way to ask
which rank in the cluster the calling CTA is.
4. Multicast has no geometry to live in
tma_load_2d_multicast_cg2 has nothing to broadcast under 2-CTA UMMA: both
operands are already split between the pair, so there is no tile two CTAs both
need. It only pays off at cluster >= 4 — which _cg2 rules out by name.
So either the multicast path is dead code as shaped, or it needs a cluster
geometry the library cannot currently express. Worth resolving before anyone
builds on it.
Suggested order
(1) and (2) are prerequisites for any correct cluster kernel and are small.
(3) is a redesign of pipeline::run's indexing. (4) is a question to answer
before it is a change to make.
Promoting the GEMM example from "compiles with four workarounds" to "uses the
library" is the acceptance test for this issue.
Activity
feitreim commentedon Jul 27, 2026
Acceptance: update
examples/as part of closing this.gemmcompiles today with several cluster-scope workarounds, each fenced in-file with the signature it wants. Deleting those fences is the acceptance test for this issue.The examples crate (#18) exists so that "done" is checkable in the terms a kernel author cares about, rather than as a claim about a primitive nobody has tried to hold. Concretely, on closing this:
GAPfence inexamples/src/that this issue removes the need for, and replace it with the real API.aspirationaltocompiles: flip its header, take it out of its feature gate, and confirmmodal run modal_app.py::buildbuilds it forsm_100a.examples/README.md.If the example still does not compile afterwards, that is a finding worth writing down — say what is still missing rather than leaving the README stale.
examples: the reductions, and what is left after #5 and #6
Reductions: generic row/column/whole-tile folds over a ReduceOp (#37)
feitreim commentedon Jul 27, 2026
Item 8 is wrong, and a running GEMM is what corrected it. Item 6 is more urgent than filed.
Found while implementing #8, which got
examples/src/gemm.rsexecuting on a B200 against a CPU reference (pass gemm 512x256x256 exact).Item 8 — "Multicast has no geometry to live in" — retract
This issue and
examples/README.md§8 both claimed the GEMM "uses the commit and the walk and cannot use the load", on the reasoning that under a 2-CTA UMMA both operands are already split across the pair, so nothing is replicated and multicast has nothing to broadcast — hence it only pays at cluster >= 4, which_cg2rules out.The replication argument is correct and the conclusion drawn from it is not. The GEMM hung on its first real run. Cause: a plain
cp.async.bulk.tensorcompletes on a barrier in the issuing CTA's shared memory, so the peer's 24 KiB never reached the leader's 48 KiBexpect_txcharge and the leader waited forever.The fix is
tma_load_2d_multicast_cg2with the CTA's own bit as the entire mask — no replication at all — ontoSemaphore::multicast_alias. What that buys is not delivery to two CTAs; it is a.shared::clusterbarrier operand, which the plain form cannot take.So: what a cluster kernel needs from the multicast load is the address space, not the broadcast. Both primitives were already in the library and the pairing was simply never made. This deletes gemm.rs's
at_leadergap block.Generalizing the cluster mask beyond pairs may still be worth doing on its own merits, but it is not what this item claimed, and the multicast path is not dead code as shaped.
Item 6 — cluster-scope semaphore arrival — promote
The above is the concrete form of item 6, and it is not a nice-to-have: a cluster kernel that stages operands from both CTAs deadlocks without it. The workaround exists and works, but it is a multicast load with a degenerate mask standing in for "arrive on a cluster-scoped barrier", which is not what it says.
Semaphore::at_rank(or whatever shape it takes) should make the intent expressible directly.The transaction-byte accounting question in the original text still stands, and #29 is where the general version of it lives.
Items 1, 3, 5, 7 — unchanged
Still open as filed. Item 5 (cluster-scope TMEM allocation) is exercised by the running GEMM through an open-coded
alloc_cluster, so it now has a working reference implementation to lift rather than a design to invent.feitreim commentedon Jul 28, 2026
Split into per-item issues. This one is now an index, not work.
Filing four cluster gaps as one umbrella made sense when none of them were understood. They have since diverged badly — one was retracted, one turned out to be a live deadlock, one has a hardware-verified reference implementation sitting in an example — so tracking them together now hides more than it groups.
alloc_clusterexists and is hardware-verified inexamples/src/gemm.rs; #46 lifts it intotmem.rs, along with thecta_group::1relinquish bug that shares its root cause.pipeline::runcannot schedule a clusterClosing this in favour of those four. The correction comment above stays worth reading: it is the record of why "multicast is dead code as shaped" was wrong, and the reasoning generalizes — what a cluster kernel needs from a primitive is not always the thing the primitive is named for.
TMEM: relinquish the allocation permit, and lift alloc_cluster into t…