Skip to content

Movers work in [16,16] blocks; every kernel rewrites the same composition loop #22

Closed

Description

@feitreim

TmemTile::fragment_tile, TmemTile::store_fragment_tile (#10), and
ldst::store_fragment all move exactly one [16, 16] Fragment. A kernel
holding a RegTile<32, 128, BaseLdtm> has to write the composition itself:

tile[2 * row_block + slot, 4 * column_block + value] = fragment[slot, value]

Every consumer spells that out. device-tests needed it three times before it
was factored into local drain_band / stage_band helpers (#10) — and those
helpers live in the test crate, so the next kernel writes them again.

Worse, reg.rs's own test suite asserts this composition as an invariant while
no library function implements it. The rule is documented, tested, and
unavailable.

Surfaced by the examples (#18): all four kernels wanted it.

Shape

Library-level movers over the composed shape, generic on [M, N] the way
RegTile already is:

impl<const R: usize, const C: usize> TmemTile<R, C> {
    pub unsafe fn tile<const M: usize, const N: usize>(self, row: u32, column: u32)
        -> RegTile<M, N, BaseLdtm> where BaseLdtm: FragmentLayout<M, N>;
    pub unsafe fn store_tile<const M: usize, const N: usize>(self, row: u32, column: u32,
        tile: RegTile<M, N, BaseLdtm>) where BaseLdtm: FragmentLayout<M, N>;
}

drain_band / stage_band in device-tests/src/main.rs are a working
reference implementation — lift them, do not redesign them.

Note this was a deliberate scope call in #10 ("composing a taller or wider
shape out of these is the caller's, exactly as it is on the drain side"), which
was right for that issue and is what this one revisits. Both directions should
land together so they cannot drift.

Depends on #1. Related: #21 (the shared-side mover has the same problem, and a
composed form should land with it rather than after).

Activity

  1. added
    area:memory
    on Jul 27, 2026
  2. feitreim commented on Jul 27, 2026

    @feitreim
    OwnerAuthor

    Acceptance: update examples/ as part of closing this.

    gemm writes the block-composition loop by hand today, and flash_forward would. device-tests' drain_band/stage_band are the reference implementation to lift.

    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:

    • Delete any workaround or GAP fence in examples/src/ that this issue removes the need for, and replace it with the real API.
    • If a kernel becomes fully unblocked, move it from aspirational to compiles: flip its header, take it out of its feature gate, and confirm modal run modal_app.py::build builds it for sm_100a.
    • Update the status table and the blocked-on lists in 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:memory

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions