You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
so adding modes is adding impls — but the subtile scheme in shared.rs assumes the 128-byte atom in more places than the trait suggests, and the "width must be a whole number of subtiles" assertion is written against it.
What the other modes buy:
64B — narrow operands. A [R, 32] bf16 tile is a whole subtile under 64B swizzle and an illegal width under 128B, so today it cannot be expressed at all.
32B — narrower still, same argument.
Unswizzled — staging tiles that never feed an MMA (statistics, masks, scratch). Swizzling them costs address math for nothing.
Lower priority than it looks: everything the current kernels do is 128B, and the restriction is documented as deliberate rather than accidental. Worth doing when a kernel actually needs a narrow operand.
Depends on #8 (the descriptor mode has to be threaded through the layout type).
From the 2026-07-29 library audit — a concrete cost of the single-swizzle slice that this issue does not currently name, and which sharpens what "ATOM_BYTES is doing two jobs" means at a call site.
SharedTile::k_walk carries const { assert!(C * E::BYTES == S::ATOM_BYTES) } (src/shared.rs:794-808): a linear K-major walk needs K to span exactly one swizzle atom, because the step is a byte offset along a row and a stacked subtile is not reachable that way. At bf16 under Swizzle128B that fixes K at 64.
So a stage with BLOCK_K > 64 cannot produce a walk. examples/src/gemm.rs gets one by re-wrapping each subtile as a narrower tile type and walking that (gemm.rs:1199-1209):
while atom < ATile::<BLOCK_K>::SUBTILES{mma_walk_cg2::<Bf16,ATOM_CHUNKS>(self.accumulator.raw(),Atom::<BLOCK_M>::from_raw(a.subtile(atom)).k_walk(),Atom::<HALF_N>::from_raw(b.subtile(atom)).k_walk(), ...
with Atom<R> (gemm.rs:510) existing only to be one atom wide. gemm_ws.rs sidesteps it by fixing BLOCK_K = 64 (gemm_ws.rs:412) and calling k_walk() directly. The kernel's own host-side doc says the consequence outright (gemm.rs:5846-5852): "It cannot be swept as a walk width. SharedTile::k_walk carries const { assert!(C * E::BYTES == S::ATOM_BYTES) } … so 64 is what a walk is at bf16."
Two things this is evidence for:
The atom is a walk step as well as a swizzle period and a box width, so ATOM_BYTES is doing three jobs, not two. Whatever separates them for an unswizzled mode should separate this one too.
A multi-atom k_walk is worth having regardless of the swizzle work.mma.rs already knows the arithmetic — k_major_offset(k, subtile_bytes) at src/mma.rs:103-105 steps across stacked subtiles correctly, and it is what mma_abt/mma_ab use. It is only the value-levelOperandWalk, the one a runtime layout choice needs, that cannot cross a subtile. Giving OperandWalk a subtile stride would remove the re-wrap and make BLOCK_K sweepable, and it does not depend on a second Swizzle impl.
Filing this here rather than as its own issue because item 1 is squarely this issue's; item 2 could be split out if the swizzle work is not imminent.
These are useful references but not a drop-in solution to this issue: upstream's XOR address transform is a software shared-memory mapping, while this issue also owns CUDA TMA descriptor swizzle modes and the separation of swizzle period, TMA box width and walk step. Before implementing new local modes, compare the formulas and reuse upstream conflict/access arithmetic where the semantics match rather than maintaining two derivations.
Activity
SharedVec: an unswizzled run of elements in shared memory
Shared vectors: an unswizzled run of elements, and the box to deliver…
feitreim commentedon Jul 29, 2026
From the 2026-07-29 library audit — a concrete cost of the single-swizzle slice that this issue does not currently name, and which sharpens what "
ATOM_BYTESis doing two jobs" means at a call site.SharedTile::k_walkcarriesconst { assert!(C * E::BYTES == S::ATOM_BYTES) }(src/shared.rs:794-808): a linear K-major walk needs K to span exactly one swizzle atom, because the step is a byte offset along a row and a stacked subtile is not reachable that way. At bf16 underSwizzle128Bthat fixes K at 64.So a stage with
BLOCK_K > 64cannot produce a walk.examples/src/gemm.rsgets one by re-wrapping each subtile as a narrower tile type and walking that (gemm.rs:1199-1209):with
Atom<R>(gemm.rs:510) existing only to be one atom wide.gemm_ws.rssidesteps it by fixingBLOCK_K = 64(gemm_ws.rs:412) and callingk_walk()directly. The kernel's own host-side doc says the consequence outright (gemm.rs:5846-5852): "It cannot be swept as a walk width.SharedTile::k_walkcarriesconst { assert!(C * E::BYTES == S::ATOM_BYTES) }… so 64 is what a walk is at bf16."Two things this is evidence for:
ATOM_BYTESis doing three jobs, not two. Whatever separates them for an unswizzled mode should separate this one too.k_walkis worth having regardless of the swizzle work.mma.rsalready knows the arithmetic —k_major_offset(k, subtile_bytes)atsrc/mma.rs:103-105steps across stacked subtiles correctly, and it is whatmma_abt/mma_abuse. It is only the value-levelOperandWalk, the one a runtime layout choice needs, that cannot cross a subtile. GivingOperandWalka subtile stride would remove the re-wrap and makeBLOCK_Ksweepable, and it does not depend on a secondSwizzleimpl.Filing this here rather than as its own issue because item 1 is squarely this issue's; item 2 could be split out if the swizzle work is not imminent.
Audit the library whole: three doc claims were wrong, and the surface…
feitreim commentedon Jul 29, 2026
Upgrade note (
20a5616): cuda-oxide now shipscuda_device::swizzle::Swizzle<B, M, S>plus bank/conflict arithmetic and transaction-width access planning.These are useful references but not a drop-in solution to this issue: upstream's XOR address transform is a software shared-memory mapping, while this issue also owns CUDA TMA descriptor swizzle modes and the separation of swizzle period, TMA box width and walk step. Before implementing new local modes, compare the formulas and reuse upstream conflict/access arithmetic where the semantics match rather than maintaining two derivations.