Hardware-Aware Reformulation of Convolutions for Efficient Execution on Specialized AI Hardware: A Case Study on NVIDIA Tensor Cores
Ganesh Bikshandi
TL;DR
This work introduces a hardware-aware, post-training reformulation for CNNs that targets NVIDIA Tensor Core alignment by trading width for channels through width folding. The core idea reshapes inputs and expands filters so that convolution computations become block-diagonal and inherently compatible with hardware tiling, all while preserving exact input–output semantics without retraining or zero-padding. The authors formalize the transformation, prove correctness, and show how to realize it as an MLIR IR pass with extensions to GEMM via 1×1 convolutions. Empirical results on NVIDIA A100 indicate substantial speedups over baseline cuDNN/TensorRT implementations, validating the potential of semantic tuning to improve hardware utilization. This semantic-tuning framework lays groundwork for broader, compiler-driven, hardware-aware CNN optimizations across accelerators.
Abstract
Convolutional Neural Networks (CNNs) are central to modern AI, but their performance is often limited by hardware constraints. NVIDIA Tensor Cores, for instance, require input channels to be multiples of 8 and sometimes 512 for efficient execution. {\em oneDNN} framework for CPU imposes such a requirement for the blocked format. Traditional approaches address such alignment issue using zero-padding, which can be inefficient. In this work, we present a first-step, hardware-aware reformulation of CNN computations using rewrite rules, restructuring the underlying math to satisfy hardware alignment entirely {\bf post-training} without modifying network weights. While our current implementation focuses on a single transformation for Tensor Cores, this approach is generalizable, laying the foundation to explore additional transformations for CPU and accelerators. This study represents an initial step toward {\em semantic tuning}, a systematic, hardware-aware optimization strategy for efficient deployment of CNN models on specialized AI hardware.
