FPGA加速器ProTEA通过动态分块提升Transformer推理速度
ProTEA: Programmable Transformer Encoder Acceleration on FPGA
- 采用可编程分块策略,动态分配计算与内存资源
- 在U55C上实现2.5倍于GPU的推理速度,接近最优性能
- 适合需低延迟、高灵活性的Transformer部署场景
Transformer神经网络(TNN)广泛应用于自然语言处理、机器翻译和计算机视觉等领域,其核心在于多头自注意力模块对序列特征的提取,以及前馈神经网络引入非线性以学习复杂模式。尽管TNN应用广泛,针对这两个关键模块的硬件加速器仍较少,且多数现有工作聚焦于稀疏结构,难以适配主流TNN变体。本文提出ProTEA,一种面向主流Transformer编码器密集计算的运行时可编程加速器,通过最大化并行性降低延迟。设计了一种高效的大矩阵分块方法,将内存与计算资源分布于FPGA不同硬件单元。在Xilinx Alveo U55C数据中心加速卡上的实验表明,当配置为8个并行注意力头、12层、768维嵌入时,自注意力块采用64×64分块、前馈网络块采用6×6分块,ProTEA可支持多种主流Transformer模型,并实现近最优性能。相比NVIDIA Titan XP GPU,加速比达2.5倍;相较当前最先进的定制FPGA加速器,提速1.3–2.8倍。
原文摘要 · Abstract (English)
Transformer neural networks (TNN) have been widely utilized on a diverse range of applications, including natural language processing (NLP), machine translation, and computer vision (CV). Their widespread adoption has been primarily driven by the exceptional performance of their multi-head self-attention block used to extract key features from sequential data. The multi-head self-attention block is followed by feedforward neural networks, which play a crucial role in introducing non-linearity to assist the model in learning complex patterns. Despite the popularity of TNNs, there has been limited numbers of hardware accelerators targeting these two critical blocks. Most prior works have concentrated on sparse architectures that are not flexible for popular TNN variants. This paper introduces \textit{ProTEA}, a runtime programmable accelerator tailored for the dense computations of most of state-of-the-art transformer encoders. \textit{ProTEA} is designed to reduce latency by maximizing parallelism. We introduce an efficient tiling of large matrices that can distribute memory and computing resources across different hardware components within the FPGA. We provide run time evaluations of \textit{ProTEA} on a Xilinx Alveo U55C high-performance data center accelerator card. Experimental results demonstrate that \textit{ProTEA} can host a wide range of popular transformer networks and achieve near optimal performance with a tile size of 64 in the multi-head self-attention block and 6 in the feedforward networks block when configured with 8 parallel attention heads, 12 layers, and an embedding dimension of 768 on the U55C. Comparative results are provided showing \textit{ProTEA} is 2.5$\times$ faster than an NVIDIA Titan XP GPU. Results also show that it achieves 1.3 -- 2.8$\times$ speed up compared with current state-of-the-art custom designed FPGA accelerators.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。