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
{{ message }}
Repository navigation
Generalize RegTile to a logical shape with a layout parameter #1
SLOTS is owned rows, VALUES is owned values per row. The doc comment calls the logical shape [16*SLOTS-ish, 4*VALUES] — the "-ish" is the problem. value_column() exists solely to recover a logical column from a physical value index by hand.
ThunderKittens has rt<T, M, N, layout>: logical rows, logical cols, and a layout parameter that owns the (lane, register) -> (row, col) map. Every op is written against M/N; the layout is what varies.
Why first. Every op in #5, #6, and #7 has to name a coordinate. Written against SLOTS/VALUES they all bake in the base-LDTM 16x256b map, and adding a second layout later means rewriting them, not extending them. This is the one type in the crate that is a rewrite rather than a widening — reg.rs is 392 lines and roughly half of it is affected.
Shape
trait FragmentLayout carrying the ownership map as associated consts (owned rows per 16-row block, value column offsets, rows-per-thread) plus the lane arithmetic.
RegTile<const M: usize, const N: usize, L: FragmentLayout> with per-thread storage sized from L and M/N.
Fragment becomes an alias for the base-LDTM layout at the shape one TMEM drain returns, preserving today's call sites.
The ownership contract currently documented in the reg.rs module header moves onto the layout impl, where it can be asserted.
Only one layout impl is needed to close this. The point is that the signatures stop lying about shape.
Landed. RowLayout<M> / FragmentLayout<M, N> with BaseLdtm as the sole impl; RegTile<M, N, L> and RegVec<M, L> now carry logical shapes. Storage is an associated type per shape (macro-generated), avoiding generic_const_exprs.
Derived SLOTS = M/8, VALUES = N/4, per warp — so Fragment is a logical 16x16 and the flash accumulator is 32x128. Confirmed against a B200 in #4: the drain probe indexes accumulator rows as 32*warp + row, i.e. one warp owns 32 accumulator rows, exactly this reading. The old "4 rows of a 64-row warpgroup tile" prose was not reconcilable with per-warp arithmetic and has been replaced.
Both hardware-validated paths (fragment_tile interleaving, store_fragment stmatrix addressing) are byte-identical. Also fixed a wrong doc claim in TmemTile::fragment: the low simd carries column offsets {0,1} of both rows, not the lane/4 row.
Activity
feitreim commentedon Jul 26, 2026
Landed.
RowLayout<M>/FragmentLayout<M, N>withBaseLdtmas the sole impl;RegTile<M, N, L>andRegVec<M, L>now carry logical shapes. Storage is an associated type per shape (macro-generated), avoidinggeneric_const_exprs.Derived
SLOTS = M/8,VALUES = N/4, per warp — soFragmentis a logical 16x16 and the flash accumulator is 32x128. Confirmed against a B200 in #4: the drain probe indexes accumulator rows as32*warp + row, i.e. one warp owns 32 accumulator rows, exactly this reading. The old "4 rows of a 64-row warpgroup tile" prose was not reconcilable with per-warp arithmetic and has been replaced.Both hardware-validated paths (
fragment_tileinterleaving,store_fragmentstmatrix addressing) are byte-identical. Also fixed a wrong doc claim inTmemTile::fragment: the low simd carries column offsets {0,1} of both rows, not thelane/4row.