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
Masking and shape utilities: make_causal, tril/triu, fills, transpose #7
swap_layout, swap_layout_8 — row-major <-> col-major fragment layouts
copy between layouts and element types
broadcast_row, broadcast_col
make_causal is the one that hurts today. Every causal attention kernel needs it, and without it the masking is open-coded in the kernel against raw fragment indices — precisely the index math this library exists to delete. value_column() in reg.rs is public for exactly this reason: callers reach in to recover a logical column so they can compare it against a row index and mask by hand.
swap_layout and transpose only become meaningful once RegTile has a layout parameter, which is #1. Until then there is only one layout to swap between.
Suggest landing in two parts: masking and fills first (immediately useful, needs only #1's coordinates), transpose and layout swaps second (needs a second layout impl to be worth anything).
Scope correction from the examples work (#18): make_causal needs a coordinate origin this issue is not filed with.
The issue as written treats masking as a function of a tile's own (row, column). That is only true for the diagonal block. In a real flash-attention kernel the tile being masked is a [query_block, key_block] sub-block of a much larger score matrix, and the diagonal within it sits at query_base - key_base, not at row == column.
with diagonal = query_base - key_base. A tile entirely above the diagonal is fully masked and one entirely below is untouched — both are the common case in a tiled kernel, and both are wrong under the origin-free version.
tril / triu have the same requirement, and it is the same parameter.
Worth getting right at design time: the origin-free form compiles, runs, and produces a subtly wrong mask that only shows up off the diagonal — the failure mode most likely to survive to production.
Acceptance: update examples/ as part of closing this.
flash_forward wants make_causal. See the coordinate-origin correction already commented on this issue — the examples are what surfaced it.
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.
Activity
feitreim commentedon Jul 27, 2026
Scope correction from the examples work (#18):
make_causalneeds a coordinate origin this issue is not filed with.The issue as written treats masking as a function of a tile's own
(row, column). That is only true for the diagonal block. In a real flash-attention kernel the tile being masked is a[query_block, key_block]sub-block of a much larger score matrix, and the diagonal within it sits atquery_base - key_base, not atrow == column.So the signature needs the offset:
with
diagonal = query_base - key_base. A tile entirely above the diagonal is fully masked and one entirely below is untouched — both are the common case in a tiled kernel, and both are wrong under the origin-free version.tril/triuhave the same requirement, and it is the same parameter.Worth getting right at design time: the origin-free form compiles, runs, and produces a subtly wrong mask that only shows up off the diagonal — the failure mode most likely to survive to production.
Examples crate: kernels written against the API we want (#20)
feitreim commentedon Jul 27, 2026
Acceptance: update
examples/as part of closing this.flash_forwardwantsmake_causal. See the coordinate-origin correction already commented on this issue — the examples are what surfaced it.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:
GAPfence inexamples/src/that this issue removes the need for, and replace it with the real API.aspirationaltocompiles: flip its header, take it out of its feature gate, and confirmmodal run modal_app.py::buildbuilds it forsm_100a.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.
examples: the reductions, and what is left after #5 and #6
Reductions: generic row/column/whole-tile folds over a ReduceOp (#37)
examples: the band loop is a call now, in all four kernels
Composed movers: a whole [M, N] band, both memories, both directions (#…
examples: the scalar broadcasts are the real API now
Scalar-operand maps: scale, shift, and a free rsqrt over the existing…
Masking, against the coordinate origin a tiled kernel has (#7)
Flash loses two gaps, and the gap lists get a command to read them with
Masking, against the coordinate origin a tiled kernel has (#7)
Flash loses two gaps, and the gap lists get a command to read them with
Open the RegTile shape set, and mask against a coordinate origin (#23 +