39/42
Part 6 of 6 · Follow-upsLearn
FlashAttention never stores the T × T grid
FlashAttention is the answer to the score memory. It computes exact attention in tiles with a running softmax, so the matrix never lands in the GPU's main memory.
In production code you'd call F.scaled_dot_product_attention(q, k, v, is_causal=True) instead of writing these lines. The practice bans it so you show you can.