SageAttention2++:SageAttention2 的更高效实现
SageAttention2++: A More Efficient Implementation of SageAttention2
AI总结:
本文提出 SageAttention2++,采用 FP16 累加的 FP8 Matmul 指令进一步优化量化注意力,相比 FlashAttention 提速 3.9 倍且精度不变。
摘要:
注意力机制的效率至关重要,因为其时间复杂度随序列长度呈二次增长。SageAttention2 通过利用量化来加速注意力中的矩阵乘法(Matmul)解决这一问题。为进一步加速 SageAttention2,我们提出使用在 FP16 中累加的更快 FP8 Matmul 指令。该指令比 SageAttention2 中使用的 FP8 Matmul 快 2 倍。实验表明,SageAttention2++ 相比 FlashAttention 实现了 3.9 倍加速,同时保持与 SageAttention2 相同的注意力精度。这意味着 SageAttention2++ 可有效加速多种模型,包括用于语言、图像和视频生成的模型,且端到端指标损失可忽略不计。代码将在 https://github.com/thu-ml/SageAttention 提供。
英文摘要:
The efficiency of attention is critical because its time complexity grows quadratically with sequence length. SageAttention2 addresses this by utilizing quantization to accelerate matrix multiplications (Matmul) in attention. To further accelerate SageAttention2, we propose to utilize the faster instruction of FP8 Matmul accumulated in FP16. The instruction is 2x faster than the FP8 Matmul used in SageAttention2. Our experiments show that SageAttention2++ achieves a 3.9x speedup over FlashAttention while maintaining the same attention accuracy as SageAttention2. This means SageAttention2++ effectively accelerates various models, including those for language, image, and video generation, with negligible end-to-end metrics loss. The code will be available at https://github.com/thu-ml/SageAttention.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。