Skip to content

Rewrite flash-attention forward on current ferro-kittens #68

Closed

Description

@feitreim

Blocked on #66. Rewrite the flash-attention forward path (flash_forward_tcgen05, flash_forward_pipelined, flash_forward_persistent in gpu/flash-attn/src/tcgen05.rs) as one kernel on current ferro-kittens, collapsing the three generations.

Reference

examples/src/flash_forward.rs in feitreim/ferro-kittens is a working tcgen05 flash forward on the current surface — start from its shape rather than translating the old kernel.

Surface that did not exist at extraction

  • mm_abt / mm_ab — fresh-accumulator entry points (the S = Q·Kᵀ and O = P·V calls state their initialization statically instead of threading a bool).
  • The softmax toolkit: online_rescale / scale_rows (the flash rescale pattern is a library op now), row_max/row_sum reductions, Exp2Approx/Exp2Hw.
  • Masking with a coordinate origin (make_causal(diagonal), Start milestone 7a: add CUDA-event step profiler #7) — the tile is a sub-block of the score matrix and the diagonal sits at query_base - key_base; the old origin-free masking is only right for the diagonal block.
  • pipeline::run / run_stealing for the persistent form; plan::SharedPlan for the shared layout (ferro Residency is measured, and cuBLASLt's configuration is read (#80) #85 tracked flash_forward's plan specifically).

Known ferro-kittens sharp edges to watch (already filed there)

Anything new the kernel needs that the library lacks: file it on feitreim/ferro-kittens and link it from the PR.

Process

Branch off main, PR, never touch main. Correctness against the existing CPU/reference gates; performance on B200 via modal_app.py against the current flash_forward_persistent numbers as baseline. A Modal check red in ~15s is the spend limit, not the code.

Activity

  1. added 2 commits that reference this issue on Aug 3, 2026
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions