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
Rewrite flash-attention backward on current ferro-kittens (first backward consumer — expect library gaps) #69
Blocked on #66, and best sequenced after the forward rewrite (see the flash-forward issue) so the staging/scheduling decisions are settled once.
Rewrite the flash-attention backward path — flash_backward_q_tcgen05 / flash_backward_kv_tcgen05 and their _pipelined forms in gpu/flash-attn/src/tcgen05.rs — on current ferro-kittens.
This one has no reference kernel
Unlike gemm and flash forward, ferro-kittens has no backward kernel in examples/ or experiments/ — this is the first consumer of the current surface for the backward dataflow (dS, dQ/dK/dV, the recomputation or stash of P). Expect it to be the biggest source of library gaps of the four rewrite issues, and treat that as part of the deliverable:
Every gap goes on feitreim/ferro-kittens as an issue, linked from the PR. Candidates visible from GAPS.md before writing a line:
No transpose / swap_layout / second FragmentLayout (GAPS §1.3, §3.4, filed nowhere) — the backward wants Sᵀ/Pᵀ operands; check whether the MMA operand-order square (mma_atb, mma_atbt) covers each site before concluding a register-side transpose is needed. If one genuinely is, that's the issue that finally motivates a second FragmentLayout — file it with the concrete dataflow attached.
TMA reduction stores (store_add_async) are absent from the generated crate though upstream records exist (ferro Convert the flash attention kernels to HD=128 #42) — relevant if dQ is accumulated across KV blocks.
Surface to build on
mm_*/mma_* operand-order entry points (all four orders exist single-CTA), pipeline::run/run_stealing, SharedPlan, the shipped epilogue pattern (store_tile_x4 + store_shared_rows), masking with coordinate origin for the causal case.
Process
Branch off main, one PR per kernel (q and kv split as today unless a fused form measures better); never touch main. Correctness against existing gradient gates; performance on B200 via modal_app.py against the _pipelined baselines. A Modal check red in ~15s is the spend limit, not the code.
Activity
One flash-attention forward, at 128 query rows
Merge pull request #75 from feitreim/feat/issue-69-flash-backward