Causal attention masks out every future position, so many key blocks are completely masked for a given query block. FlashAttention skips those blocks entirely, saving about half the compute in a causal model.
Implement causal_block_needed(qb, kb, bq, bk), deciding whether a key block must be computed.
A key block is needed if its first key index is at most the last query index in the query block.
No results yet
Run your code to check it against the examples, or submit to run every test.