by WithinReason ยท 3y ago ยท 0 comments
Let ๐ be the sequence length, ๐ be the head dimension, and ๐ be size of SRAM with ๐ <= ๐ <= ๐๐. Standard attention (Algorithm 0) requires ฮ(๐๐+๐ยฒ) HBM accesses, while FlashAttention (Algorithm 1) requires ฮ(๐ยฒ๐ยฒMโปยน) HBM accesses.
"standard attention has memory quadratic in sequence length, whereas FlashAttention has memory linear in sequence length."
I guess you have just reported how many times the layer will need to access the memory, not how much memory usage scales with sequence length.