Optimizing Dynamic-Shape Neural Networks on Accelerators via On-the-Fly Micro-Kernel Polymerization
Open Access
- 27 April 2024
- conference paper
- Published by Association for Computing Machinery (ACM)
- p. 797-812
Abstract
In recent times, dynamic-shape neural networks have gained widespread usage in intelligent applications to address complex tasks, introducing challenges in optimizing tensor programs due to their dynamic nature. As the operators' shapes are determined at runtime in dynamic scenarios, the compilation process becomes expensive, limiting the practicality of existing static-shape tensor compilers. To address the need for effective and efficient optimization of dynamic-shape neural networks, this paper introduces MikPoly, a novel dynamic-shape tensor compiler based on micro-kernel polymerization. MikPoly employs a two-stage optimization approach, dynamically combining multiple statically generated micro-kernels using a lightweight cost model based on the shape of a tensor operator known at runtime. We evaluate the effectiveness of MikPoly by employing popular dynamic-shape operators and neural networks on two representative accelerators, namely GPU Tensor Cores and Ascend NPUs. Our experimental results demonstrate that MikPoly effectively optimizes dynamic-shape workloads, yielding an average performance improvement of 1.49× over state-of-the-art vendor libraries.Keywords
Funding Information
- National Key R&D Program of China (2021ZD0110101)
- National Natural Science Foundation of China (62232015, 62090024, 62302479, U23B2020)
- China Postdoctoral Science Foundation (2023M733566)
- Innovation Funding of ICT, CAS (E361010)
This publication has 36 references indexed in Scilit:
- Hugging Face2022
- MLIR: Scaling Compiler Infrastructure for Domain Specific Computation2021
- Ascend: a Scalable and Unified Architecture for Ubiquitous Deep Neural Network Computing : Industry Track Paper2021
- Tiramisu: A Polyhedral Compiler for Expressing Fast and Portable Code2019
- Adaptive Batch Normalization for practical domain adaptationPattern Recognition, 2018
- R-CNN for Small Object Detection2017
- Deep Residual Learning for Image Recognition2016
- Fast Algorithms for Convolutional Neural Networks2016
- Fast R-CNN2015
- Going deeper with convolutions2015