FlashAttention (Dao et al., 2022) computes exact attention one block of keys at a time, so the full score matrix never reaches slow memory. Each block contributes a running max and a running sum. Two such summaries merge exactly by rescaling to the larger max.
Implement online_softmax_merge(m1, l1, m2, l2), merging two blocks' softmax statistics exactly.
Take the larger max as the new max, then scale each sum by exp(old_max - new_max) before adding.
No results yet
Run your code to check it against the examples, or submit to run every test.