Attention does two matrix multiplications per head, each costing about two n squared d operations. Knowing that count tells you whether a kernel is limited by compute or by memory.
Implement attention_flops(n, d, causal), the floating-point operations of one attention head.
Count four n squared d operations for the two products, then halve for causal masking.
No results yet
Run your code to check it against the examples, or submit to run every test.