arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2607.01817cs.DC
收藏

HCMS: 用于长序列并行注意力中通信-计算重叠的头分块多流流水线

HCMS: Head-Chunked Multi-Stream Pipeline for Communication-Computation Overlap in Long-Sequence Parallel Attention

Bilibili Inc.(哔哩哔哩公司)

Chao Yuan, Pan Li, Yingnan Sun, Jing Liu

AI总结:

提出HCMS方法,通过将注意力头分块并利用双CUDA流实现细粒度通信-计算重叠,在长序列并行注意力中加速10%-17.5%。

摘要:

基于全到全的序列并行方法在处理中等长度序列时严格串行执行通信和计算,导致硬件资源利用率不足。本文提出头分块多流流水线(HCMS),该方法通过将注意力头划分为多个块,利用多头注意力的计算独立性,并通过双CUDA流实现细粒度的通信-计算重叠。HCMS与FlashAttention和SDPA等现有优化正交兼容,无需修改底层内核,支持不均匀划分同时保持数值等价性。实验在2-8 GPU规模的四个GPU平台上验证了其有效性:对于典型的31K-56K token视频生成序列长度,HCMS相比Ulysses基线实现10%-17.5%的加速,相比Ring Attention实现5%-14.5%的加速;在Wan2.2模型上实现6.8%的端到端加速。理论分析表明,HCMS的收益与通信比率ρ正相关,建议在ρ>20%时使用。

英文摘要:

All-to-all based sequence parallelism methods execute communication and computation strictly in serial when processing medium-long sequences, resulting in hardware resource underutilization. This paper proposes Head-Chunked Multi-Stream Pipeline (HCMS), which exploits the computational independence of multi-head attention by partitioning attention heads into multiple chunks and achieving fine-grained communication-computation overlap through dual CUDA streams. HCMS is orthogonally compatible with existing optimizations such as FlashAttention and SDPA, requires no modification to underlying kernels, supports uneven partitioning while maintaining numerical equivalence. Experiments validate the effectiveness across four GPU platforms at 2-8 GPU scales: for typical video generation sequence lengths of 31K-56K tokens, HCMS achieves 10\%-17.5\% speedup over the Ulysses baseline and 5\%-14.5\% speedup over Ring Attention; end-to-end acceleration of 6.8\% is achieved on the Wan2.2 model. Theoretical analysis shows that HCMS benefits are positively correlated with communication ratio $ρ$, and its use is recommended when $ρ>20\%$.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑