Repository navigation
Description
Found by the 2026-07-29 library audit (GAPS.md §1.1, §7). Nothing is broken;
the crate says one thing four ways and a new user has to learn all four.
StoreRing gained a Scope parameter in #123 because scope was implicit and
wrong — a ring hard-wired to bar.sync could not express gemm's per-warp
staging tile. That fix is right and it is also the only place in the crate where
a collective's scope is named in its type. Three other spellings of the same
decision are live:
| where | spelling | rungs it covers |
|---|---|---|
epilogue::StoreRing |
SC: Scope — { issuing(), converge() } |
warp, CTA |
pipeline::Job |
const RANKS: u32, branched in pipeline::boundary |
CTA, cluster |
sync::block_reduce |
const WARPS: usize |
CTA, of a named width |
global::store_shared_rows |
const THREADS: u32 + a thread argument |
any cooperative set |
Scope and Job::RANKS are the same decision at adjacent rungs of one ladder —
warp < CTA < cluster — implemented twice with no rung in common. A job whose
barriers are cluster-wide cannot be spelled with Scope; a ring owned by one
warp cannot be spelled with RANKS. pipeline::boundary::<J>() is
Scope::converge under another name and an if on a const instead of a trait.
Everything else keeps its scope in its index math and does not say so in its
type:
tmem::alloc_blockiswarp_id() == 0plussync_threads, and
alloc_clusteris that pluscluster_sync—src/tmem.rs:126-193.sync::block_reduceislane_id() == 0plus twosync_threads—
src/sync.rs:545.pipeline::runelects its leader asthreadIdx_x() == 0—src/pipeline.rs:325.
Why this is worth doing and why #3 is not a precedent against it
#3 closed on the argument that a Scope of { WARPS, THREADS, rank(), sync() }
cannot express a block reduction, because a fold across warps needs storage
between two barriers and no such trait has any. That argument is correct and it
does not reach this: Scope as #123 shipped it makes no claim about storage. It
names a barrier and an issuing thread, which is all every case above needs,
because in each of them the storage is already a parameter (SharedVec for the
reduction, the ring's own tiles for the store, the job's own plan for the
pipeline).
So the ask is narrower than #3's: one Scope ladder with three rungs —
Warp, Cta, Cluster — and the existing users moved onto it, not a
scope-generic op surface.
Scope
- Add a
Clusterrung toepilogue::Scope(converge=cluster_sync,
issuing= rank 0's thread 0) or move the trait somewhere it can serve both
users — it is currently inepilogue, which is the wrong home for a crate-wide
concept. - Replace
Job::RANKS's branch with the trait.RANKSis also read by callers
forTransactionBytes::across_ranks(examples/src/gemm.rs:1148,
gemm_ws.rs:671), so whatever replaces it has to keep a rank count
reachable, not only a barrier. - Decide whether
block_reduce'sWARPSandstore_shared_rows'THREADS
become scope parameters or stay counts. They may honestly be counts:WARPS
sizes the scratch vector andTHREADSdivides the tile's chunks. Say which in
the doc rather than leaving four spellings unexplained.
Non-goal: making every op scope-generic. That is #3 again and it lost.
Acceptance
One trait, three rungs, and the doc says for each remaining const count why it
is a count and not a scope. tests/gaps.rs's the_store_ring_names_its_scope
extends to whatever the ladder becomes.
Related: #123 (where Scope came from), #3 (the argument this does not repeat),
#51 (which filed the rank half against #3 and was right that it separates).
Activity
Audit the library whole: three doc claims were wrong, and the surface…