ViTCoD: Vision Transformer Acceleration via Dedicated Algorithm and Accelerator Co-Design

被引:59
作者
You, Haoran [1 ]
Sun, Zhanyi [2 ]
Shi, Huihong [1 ]
Yu, Zhongzhi [1 ]
Zhao, Yang [2 ]
Zhang, Yongan [1 ]
Li, Chaojian [1 ]
Li, Baopu [3 ]
Lin, Yingyan [1 ]
机构
[1] Georgia Inst Technol, Atlanta, GA 30332 USA
[2] Rice Univ, Houston, TX USA
[3] Oracle Hlth & AI, Redwood City, CA USA
来源
2023 IEEE INTERNATIONAL SYMPOSIUM ON HIGH-PERFORMANCE COMPUTER ARCHITECTURE, HPCA | 2023年
关键词
SPARSE;
D O I
10.1109/HPCA56546.2023.10071027
中图分类号
TP3 [计算技术、计算机技术];
学科分类号
0812 ;
摘要
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 and more extensive applications to resource constrained platforms. Meanwhile, existing accelerators dedicated to NLP Transformers are not optimal for ViTs. This is because there is a large difference between ViTs and Transformers for natural language processing (NLP) tasks: ViTs have a relatively fixed number of input tokens, whose attention maps can be pruned by up to 90% even with fixed sparse patterns, without severely hurting the model accuracy (e.g., <=1.5% under 90% pruning ratio); 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 aforementioned enforced denser and sparser workloads for boosted hardware utilization, while integrating on-chip encoder and decoder engines to leverage ViTCoD's algorithm pipeline for much reduced data movements. 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. Our code implementation is available at https://github.com/GATECH-EIC/ViTCoD.
引用
收藏
页码:273 / 286
页数:14
相关论文
共 50 条
[1]  
[Anonymous], SYN IC COMP 2
[2]  
[Anonymous], Synopsys design compiler
[3]   Attention Augmented Convolutional Networks [J].
Bello, Irwan ;
Zoph, Barret ;
Vaswani, Ashish ;
Shlens, Jonathon ;
Le, Quoc V. .
2019 IEEE/CVF INTERNATIONAL CONFERENCE ON COMPUTER VISION (ICCV 2019), 2019, :3285-3294
[4]  
Beltagy I, 2020, Arxiv, DOI arXiv:2004.05150
[5]  
Bhojanapalli S, 2020, PR MACH LEARN RES, V119
[6]  
Chen C.F., 2021, arXiv
[7]  
Chen M, 2020, PR MACH LEARN RES, V119
[8]  
Dai XL, 2021, Arxiv, DOI arXiv:2006.02049
[9]  
Deng J, 2009, PROC CVPR IEEE, P248, DOI 10.1109/CVPRW.2009.5206848
[10]  
Dosovitskiy A., 2021, INT C LEARNING REPRE, P1