arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2208.03646cs.LGcs.AR
收藏

基于稀疏注意和动态流水的Transformer在FPGA上的长度自适应并行硬件协同设计

A Length Adaptive Algorithm-Hardware Co-design of Transformer on FPGA Through Sparse Attention and Dynamic Pipelining

University of Connecticut(康涅狄格大学);Stevens Institute of Technology(史蒂文斯理工学院);Pacific Northwest National Laboratory(太平洋西北国家实验室);George Mason University(乔治梅森大学);Lehigh University(理海大学)

Hongwu Peng, Shaoyi Huang, Shiyang Chen, Bingbing Li, Tong Geng, Ang Li, Weiwen Jiang, Wujie Wen, Jinbo Bi, Hang Liu, Caiwen Ding

摘要:

自2018年以来,Transformers被认为是最重要的深度学习模型之一,部分原因是它建立了最先进的(SOTA)记录,并有可能取代现有的深度神经网络(DNN)。尽管取得了显著的胜利,但Transformer型号的周转时间延长是一个公认的障碍。序列长度的变化强加了额外的计算开销,其中输入需要被零填充到批处理中的最大句子长度以适应并行计算平台。针对现场可编程门阵列(FPGA),提出了一种用于Transformer加速的相干序列长度自适应算法-硬件协同设计。特别是,我们开发了一个硬件友好的稀疏注意算子和长度感知的硬件资源调度算法。稀疏注意算子将基于注意力模型的复杂度降低到线性复杂度,并减少了片外内存流量。提出的长度感知资源硬件调度算法动态分配硬件资源,以填补流水线槽,并消除气泡的NLP任务。实验结果表明,该算法的精度损失很小,与CPU和GPU相比,具有80.2 $\times$和2.6 $\times$的加速比,并且比通过CUBLAS GEMM优化的GPU加速器高4 $\times$的能效。

英文摘要:

Transformers are considered one of the most important deep learning models since 2018, in part because it establishes state-of-the-art (SOTA) records and could potentially replace existing Deep Neural Networks (DNNs). Despite the remarkable triumphs, the prolonged turnaround time of Transformer models is a widely recognized roadblock. The variety of sequence lengths imposes additional computing overhead where inputs need to be zero-padded to the maximum sentence length in the batch to accommodate the parallel computing platforms. This paper targets the field-programmable gate array (FPGA) and proposes a coherent sequence length adaptive algorithm-hardware co-design for Transformer acceleration. Particularly, we develop a hardware-friendly sparse attention operator and a length-aware hardware resource scheduling algorithm. The proposed sparse attention operator brings the complexity of attention-based models down to linear complexity and alleviates the off-chip memory traffic. The proposed length-aware resource hardware scheduling algorithm dynamically allocates the hardware resources to fill up the pipeline slots and eliminates bubbles for NLP tasks. Experiments show that our design has very small accuracy loss and has 80.2 $\times$ and 2.6 $\times$ speedup compared to CPU and GPU implementation, and 4 $\times$ higher energy efficiency than state-of-the-art GPU accelerator optimized via CUBLAS GEMM.

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

↑