Full-Stack Optimizing Transformer Inference on ARM Many-Core CPU
- 29 May 2023
- journal article
- research article
- Published by Institute of Electrical and Electronics Engineers (IEEE) in IEEE Transactions on Parallel and Distributed Systems
- Vol. 34 (7) , 2221-2235
Abstract
The past several years have witnessed tremendous success of transformer models in natural language processing (NLP), and their current landscape is increasingly diverse. Although GPU gradually becomes the dominating workhorse and de facto standard for deep learning, there are still many scenarios where using CPU remains a prevalent choice.Recently, ARM many-core processor starts emigrating to cloud computing and high-performance computing, which is promising to deploy transformer inference. In this paper, we identify several performance bottlenecks of existing inference runtime on many-core CPU including low-core usage, isolated thread configuration, inappropriate implementation of general matrix multiply (GEMM), and redundant computations for variable-length inputs. To tackle these problems, full-stack optimizations are conducted for these challenges from service level to operator level. We explore multi-instance parallelization at the service level to improve CPU core usage. To improve parallel efficiency of the inference runtime, we design NUMA-aware thread scheduling and a look-up table for optimal parallel configurations. The GEMM implementation is tailored for some critical modules to exploit the characteristics of transformer workload. To eliminate redundant computations, a novel storage format is designed and implemented to pack sparse data and a load balancing strategy is proposed for tasks with different sparsity. Experiments show that our implementation can outperform existing solutions by 1.1x to 6x with fixed-length inputs. For variable-length inputs, it achieves 1.9x to 8x speedups on different ARM many-core processors.Keywords
Funding Information
- National Key R&D Program of China (2021YFB0301300)
- Zhejiang Lab (2021KC0AB04)
- Major Program of Guangdong Basic and Applied Research (2019B030302002)
- Program for Guangdong Natural Science Foundation (2018B030312002)
This publication has 13 references indexed in Scilit:
- NUMA-Aware DGEMM Based on 64-Bit ARMv8 Multicore Processors ArchitectureElectronics, 2021
- TurboTransformers2021
- Co-Design for A64FX Manycore Processor and ”Fugaku”2020
- Performance and energy consumption of HPC workloads on a cluster based on Arm ThunderX2 CPUFuture Generation Computer Systems, 2020
- The Deep Learning Compiler: A Comprehensive SurveyIEEE Transactions on Parallel and Distributed Systems, 2020
- How to Efficiently Train Your AI Agent? Characterizing and Evaluating Deep Reinforcement Learning on Heterogeneous Platforms2020
- TSM22019
- Scale-Out vs Scale-UpACM Transactions on Modeling and Performance Evaluation of Computing Systems, 2018
- The Sunway TaihuLight supercomputer: system and applicationsScience China Information Sciences, 2016
- High-performance implementation of the level-3 BLASACM Transactions on Mathematical Software, 2008