ViTCoD:通过专用算法与加速器协同设计实现Vision Transformer加速
ViTCoD: Vision Transformer Acceleration via Dedicated Algorithm and Accelerator Co-Design
AI总结:
针对ViTs自注意力模块硬件效率受限的问题,提出算法与加速器协同设计框架ViTCoD,通过注意力图剪枝极化与轻量级auto-encoder减少数据移动,并设计专用加速器提升利用率,在90%稀疏度下最高实现235.3倍加速。
摘要:
Vision Transformers(ViTs)在各种视觉任务上取得了最先进的性能。然而,ViTs的自注意力模块仍然可以说是主要的瓶颈,限制了其可实现的硬件效率。同时,专用于NLP Transformers的现有加速器对ViTs而言并非最优。这是因为ViTs和NLP Transformers之间存在巨大差异:ViTs具有相对固定数量的输入token,其注意力图即使采用固定的稀疏模式也能被剪枝高达90%;而NLP Transformers需要处理不同数量token的输入序列,并依赖对每个输入的动态稀疏注意力模式进行实时预测,以实现可观的稀疏度(例如,>=50%)。为此,我们提出了一种名为ViTCoD的专用算法与加速器协同设计框架,用于加速ViTs。具体而言,在算法层面,ViTCoD对注意力图进行剪枝和两极化,使其形成更密集或更稀疏的固定模式,从而在不损害精度的前提下规整两级工作负载,大幅减少注意力计算,同时为缓解剩余的主要数据移动留出空间;在此基础上,我们进一步集成了一个轻量级且可学习的auto-encoder模块,以实现将占主导地位的高成本数据移动替换为低成本的计算。在硬件层面,我们开发了一种专用加速器,以同时协调强制实施的密集/稀疏工作负载与encoder/decoder引擎,从而提升硬件利用率。大量实验和消融研究验证了ViTCoD大幅降低了主要的数据移动成本,在90%的注意力稀疏度下,相较于通用计算平台CPU、EdgeGPU、GPU,以及先前的Transformer加速器SpAtten和Sanger,分别实现了高达235.3倍、142.9倍、86.0倍、10.1倍和6.8倍的加速。
英文摘要:
Vision Transformers (ViTs) have achieved state-of-the-art performance on various vision tasks. However, ViTs' self-attention module is still arguably a major bottleneck, limiting their achievable hardware efficiency. Meanwhile, existing accelerators dedicated to NLP Transformers are not optimal for ViTs. This is because there is a large difference between ViTs and NLP Transformers: ViTs have a relatively fixed number of input tokens, whose attention maps can be pruned by up to 90% even with fixed sparse patterns; while NLP Transformers need to handle input sequences of varying numbers of tokens and rely on on-the-fly predictions of dynamic sparse attention patterns for each input to achieve a decent sparsity (e.g., >=50%). To this end, we propose a dedicated algorithm and accelerator co-design framework dubbed ViTCoD for accelerating ViTs. Specifically, on the algorithm level, ViTCoD prunes and polarizes the attention maps to have either denser or sparser fixed patterns for regularizing two levels of workloads without hurting the accuracy, largely reducing the attention computations while leaving room for alleviating the remaining dominant data movements; on top of that, we further integrate a lightweight and learnable auto-encoder module to enable trading the dominant high-cost data movements for lower-cost computations. On the hardware level, we develop a dedicated accelerator to simultaneously coordinate the enforced denser/sparser workloads and encoder/decoder engines for boosted hardware utilization. Extensive experiments and ablation studies validate that ViTCoD largely reduces the dominant data movement costs, achieving speedups of up to 235.3x, 142.9x, 86.0x, 10.1x, and 6.8x over general computing platforms CPUs, EdgeGPUs, GPUs, and prior-art Transformer accelerators SpAtten and Sanger under an attention sparsity of 90%, respectively.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。