Skip to content

RegTile's shape set is closed to out-of-tree kernels #23

Closed

Description

@feitreim

src/reg.rs ends with:

base_ldtm_rows!(16, 32);
base_ldtm_shapes!((16, 16), (32, 32), (32, 128));

Those macros are private, so the set of shapes a RegTile can take is fixed at
three, inside the library. A downstream kernel cannot name any other one.

Found by the examples (#18): flash-attention wants a [32, 64] band and cannot
say so without editing reg.rs. That makes every new kernel shape a library
change, which defeats the point of shipping this as a library.

This is a direct consequence of the #1 design — the associated-type-plus-macro
pattern that let us avoid generic_const_exprs. That trade was correct and
this is its cost, now that we have a concrete kernel it blocks.

Options

  1. Export the macros. Cheapest. A downstream crate writes
    kittens::base_ldtm_shapes!((32, 64)); — but it is implementing a library
    trait for a library type from outside, so orphan rules need checking.
  2. Widen the in-tree list. Trivially unblocks flash, does not fix the
    general problem, and the list grows without bound.
  3. Revisit the storage representation so Storage is expressible for any
    (M, N) without a per-shape impl — e.g. a fixed maximum with a length, or
    a nested-array encoding whose type is computable from M and N by trait
    projection rather than by arithmetic.

Option 1 is probably right, but check the orphan-rule question before
committing to it — that is the part that decides whether this is a one-line
change or a redesign.

Whatever lands, add a [32, 64] shape so flash can be written, and make the
examples crate the test of whether it actually works from out of tree.

Depends on #1.

Activity

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

    @feitreim
    OwnerAuthor

    Acceptance: update examples/ as part of closing this.

    flash_forward wants a [32, 64] score band and cannot name it from out of tree. The examples crate is the right test of whether the fix actually works from outside the library — it is a separate crate, so a solution that only works in-tree will fail there.

    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:types

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions