How Much Can We Gain From Tensor Kernel Fusion on GPUs?
Open Access
- 7 June 2024
- journal article
- research article
- Published by Institute of Electrical and Electronics Engineers (IEEE) in IEEE Access
- Vol. 12, 126135-126144
Abstract
Kernel fusion is a crucial optimization technique for GPU applications, particularly deep neural networks, where it involves combining multiple consecutive kernels into a single larger kernel. This approach aims to enhance performance by reducing the need for slow off-chip memory accesses. Instead, intermediate results between successive kernels are stored in faster on-chip memory like shared memory. This strategy has the potential to not only boost performance, but also reduce energy consumption. Typically, GPU kernels fall into two categories: tensor operations and element operations. In deep learning, fusing a tensor operation kernel with an element operation kernel that follows it, such as combining convolution with ReLU, is a common practice to achieve improved performance. While combining two tensor kernels in a single GPU kernel has shown benefits in certain applications, it is not a straightforward task. The advantages and limitations of this approach remain unclear, prompting several questions: 1) What advantages does tensor kernel fusion offer on GPGPUs? 2) What limitations does it have and why is it not widely adopted? 3) In what practical scenarios is tensor kernel fusion beneficial? To address these questions, we conducted both analytical and experimental studies on Nvidia Tensor Core GPUs, using the CUTLASS kernel library with extensions. Our experimental findings revealed that for tall and narrow matrix multiplications, employing a 1D tiling strategy outperforms the commonly used 2D tiling strategy. By comparing tensor kernel fusions with a 1D tiling baseline, we demonstrated significant performance gains for tall and narrow matrix multiplications with fusion. However, we observe that these benefits diminish as the matrix sizes increase in width.Keywords
Funding Information
- Dutch Research Council (NWO) Perspectief Program ZERO-ARM P3
- U.S. Department of Energy, Office of Science, Office of Advanced Scientific Computing Research, ComPort: Rigorous Testing Methods to Safeguard Software Porting (78284)
This publication has 11 references indexed in Scilit:
- Benchmarking and Dissecting the Nvidia Hopper GPU Architecture2024
- How to Train Accurate BNNs for Embedded Systems?2023
- Attention Is All You NeedarXiv, 2023
- Efficient Transformers: A SurveyACM Computing Surveys, 2022
- Dissecting Tensor Cores via Microbenchmarks: Latency, Throughput and Numeric BehaviorsIEEE Transactions on Parallel and Distributed Systems, 2022
- A Survey of Quantization Methods for Efficient Neural Network Inference2022
- ConvFusion: A Model for Layer Fusion in Convolutional Neural NetworksIEEE Access, 2021
- Schedule Synthesis for Halide Pipelines on GPUsACM Transactions on Architecture and Code Optimization, 2020
- Deep Residual Learning for Image Recognition2016
- RooflineCommunications of the ACM, 2009