Skip to main content
QUICK REVIEW

[Paper Review] Characterizing and Demystifying the Implicit Convolution Algorithm on Commercial Matrix-Multiplication Accelerators

Yangjie Zhou, Mengtian Yang|arXiv (Cornell University)|Oct 8, 2021
Parallel Computing and Optimization TechniquesComputer Science5 citations
TL;DR

This paper proposes a memory-efficient, hardware-friendly implicit im2col algorithm that dynamically maps convolutions to GEMM with near-zero performance and memory overhead on GEMM-based accelerators like Google's TPU and NVIDIA's Tensor Cores. By exploiting convolutional associativity and commutativity, and optimizing memory layout and tiling, the method enables full overlap of off-chip memory access with computation, achieving performance on par with or better than proprietary implementations.

ABSTRACT

Many of today's deep neural network accelerators, e.g., Google's TPU and NVIDIA's tensor core, are built around accelerating the general matrix multiplication (i.e., GEMM). However, supporting convolution on GEMM-based accelerators is not trivial. The naive method explicitly lowers the convolution to GEMM, commonly known as im2col, which introduces significant performance and memory overhead. Existing implicit im2col algorithms require unscalable hardware and are inefficient in supporting important convolution variants such as strided convolution. In this paper, we propose a memory-efficient and hardware-friendly implicit im2col algorithm used by Google's TPU, which dynamically converts a convolution into a GEMM with practically zero performance and memory overhead, fully unleashing the power of GEMM engines. Through comprehensive experimental results, we quantitatively argue that this algorithm has been adopted in commercial closed-source platforms, and we are the first to describe its high-level idea and implementation details. Finally, we show that our algorithm can also be generally applied to Nvidia's Tensor Cores (TC), matching and out-performing the measured performance on TCs.

Motivation & Objective

  • To address the high memory and performance overhead of explicit im2col in GEMM-based DNN accelerators like TPUs and GPUs.
  • To reverse-engineer and describe the first publicly available implementation of a hardware-friendly implicit im2col algorithm used in commercial accelerators.
  • To demonstrate that the proposed implicit im2col method achieves near-zero overhead and matches or exceeds proprietary implementations on both TPUs and NVIDIA Tensor Cores.
  • To enable broader research and optimization in DNN acceleration by open-sourcing a configurable TPU simulator and GPU implementation.

Proposed method

  • Proposes a channel-first implicit im2col algorithm that leverages the associativity and commutativity of convolution to avoid explicit data reformatting.
  • Designs a memory layout and tiling strategy that allows off-chip memory access to be fully overlapped with computation on systolic arrays.
  • Develops a configurable cycle-level TPU simulator validated against cloud TPUv2 with less than 5% average error rate.
  • Adapts the algorithm to NVIDIA Tensor Cores using a blocked im2col approach with tile reordering to minimize stalls from global memory access.
  • Optimizes data reuse across tiles via inter-tile reuse to improve on-chip data locality and reduce global memory bandwidth pressure.
  • Implements the method in software on a V100 GPU and compares performance against cuDNN, using micro-optimizations not available to the authors.
Figure 1: Illustration of the im2col algorithm that converts a CONV layer to a GEMM operation. For simplicity, this examples assumes no padding in the IFMap.
Figure 1: Illustration of the im2col algorithm that converts a CONV layer to a GEMM operation. For simplicity, this examples assumes no padding in the IFMap.

Experimental results

Research questions

  • RQ1How can convolution be efficiently mapped to GEMM on GEMM-specialized accelerators like TPUs and Tensor Cores with minimal performance and memory overhead?
  • RQ2What architectural and algorithmic techniques enable implicit im2col to avoid the memory and computational costs of explicit im2col?
  • RQ3Why is the existing implicit im2col method from prior work unsuitable for large-scale, commercial accelerators like TPUs?
  • RQ4Can a generic, open-source implicit im2col algorithm be implemented on both systolic arrays and modern GPU Tensor Cores with competitive performance?
  • RQ5What role do memory layout, tiling, and data reuse play in achieving high performance on GEMM accelerators?

Key findings

  • The proposed implicit im2col method achieves near-zero performance and memory overhead by dynamically mapping convolutions to GEMM without explicit data transformation.
  • The method enables full overlap of off-chip memory access with computation on TPU, reducing idle time and maximizing hardware utilization.
  • On V100 GPUs, the implementation is within 1% of cuDNN performance at batch size 8, demonstrating strong competitiveness with proprietary code.
  • For strided convolutions, the method is on average 20% faster and up to 40% faster than cuDNN, highlighting its superiority in handling non-unit stride operations.
  • Inter-tile reuse optimization improves performance by an average of 16.7% on GPU workloads with high global memory access overhead.
  • The authors' simulator for TPUv2 achieves less than 5% average error rate when compared to real cloud TPUv2 measurements, validating its accuracy.
(a) NVIDIA V100 GPU.
(a) NVIDIA V100 GPU.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.