Implement one-head Flash Attention: the same math as scaled dot-product attention,
but do not materialize the score matrix. Stream and in tiles of length (use ) and fold each tile into a running state with the online-softmax recurrence.
For query row , start from , , . For each key/value tile with scores (already scaled by ):
After the last tile, . Suggested launch: one block per query row. There is no causal mask.
Complete:
__global__ kernel that runs tiled online attention.void solve(const float* Q, const float* K, const float* V, float* O, int S, int D) where every pointer is a host pointer of length S * D. Allocate, copy in, launch, copy out, and free.Constraints: 1 <= S <= 32, 1 <= D <= 16. Do not write a main() in your solution.