Efficient Inference on GPUs for the Sparse Deep Neural Network Graph Challenge 2020

Mert Hidayetoglu, Carl Pearson, Vikram Sharma Mailthody, Eiman Ebrahimi, Jinjun Xiong, Rakesh Nagi, Wen-mei W. Hwu

TL;DR

This paper tackles the challenge of efficiently running large, sparse deep neural networks (SpDNNs) on GPUs for inference. They introduce optimized GPU kernels that significantly speed up computations by intelligently reusing data and minimizing memory access, achieving up to 180 TeraEdges/second on NVIDIA V100 GPUs and outperforming previous champions.

What Problem Does This Paper Address?

Modern deep learning models are becoming increasingly large and complex to achieve higher accuracy. This growth often outstrips the memory capacity of available hardware accelerators like GPUs. Sparse Deep Neural Networks (SpDNNs) offer a solution by reducing the memory footprint and computational cost by representing many connections as zero. However, efficiently implementing SpDNN operations, particularly inference, on GPUs is challenging. Traditional GPU architectures are optimized for dense matrix operations, leading to performance bottlenecks when dealing with the irregular memory access patterns and data reuse opportunities in sparse computations. This paper aims to bridge this gap by developing highly optimized GPU kernels for SpDNN inference.

Methods

The core of this work lies in developing optimized GPU kernels for sparse matrix-vector multiplication (SpMM) fused with the ReLU activation function. The authors identify key inefficiencies in a baseline implementation, primarily irregular memory accesses to input features and redundant reads of sparse weights. To address these, they propose several optimizations:

  • Register Tiling: Reusing sparse weights within registers across multiple feature computations to improve arithmetic intensity and reduce memory bandwidth usage.
  • Shared-Memory Tiling: Pre-loading frequently accessed input features into shared memory to mitigate irregular and redundant global memory accesses. This involves creating a "preload list" and mapping input elements to a shared buffer.
  • Efficient Weight Matrix Access: Storing weight matrices in a transposed sliced ELLPACK format to enable more coalesced memory access patterns.
  • Compact Representation: Using smaller data types (e.g., unsigned short) for indices to reduce memory footprint and data transfer times.
  • Multi-GPU Parallelism: Employing a batch parallelism strategy where weights are replicated across GPUs, and input feature maps are statically partitioned.

Datasets

The paper evaluates their implementation using datasets provided by the Sparse Deep Neural Network Challenge 2020. These datasets are derived from the MNIST dataset, with images resized to various resolutions (32x32, 64x64, 128x128, and 256x256 pixels) and then linearized. This results in input feature matrices of sizes 60k x 1K, 60k x 4K, 60k x 16K, and 60k x 64K. The challenge also provides three different sparse DNN models with varying depths (120, 480, and 1920 layers), leading to a total of 12 different network configurations.

Key Insights and Ideas

  • Irregularity is the Enemy: The paper clearly demonstrates that the primary performance bottleneck for SpDNN inference on GPUs is the irregular memory access patterns, both for input features and weights, and the resulting redundant data fetches.
  • Data Reuse is King: By intelligently reusing weights in registers and input features in shared memory, significant performance gains can be achieved, effectively turning sparse computations into more dense-like operations from a hardware perspective.
  • Shared Memory is a Powerful Intermediate: Leveraging shared memory as a staging area for input features is crucial for overcoming the limitations of global memory bandwidth and latency in sparse computations.
  • Weight Format Matters: The choice of sparse matrix storage format (sliced ELLPACK in this case) significantly impacts memory access patterns and overall performance.
  • Scaling Requires Careful Partitioning: While batch parallelism is a straightforward strategy for multi-GPU scaling, managing load imbalance due to sparsity is an ongoing challenge.

Key Results

  • Single GPU Performance: The optimized fused kernel achieves up to 11.84x speedup over a baseline implementation on NVIDIA V100 GPUs. Compared to the 2019 Sparse DNN Challenge champions, their single-GPU implementation is up to 4.3x faster.
  • Multi-GPU Performance: The multi-GPU implementation scales up to 768 V100 GPUs, achieving up to 180 TeraEdges/second. This is an order of magnitude faster than the 2019 champions at full scale.
  • NVIDIA A100 Performance: On the newer NVIDIA A100 GPU, the same implementation (without A100-specific optimizations) achieves up to 2.37x faster throughput compared to the V100.
  • Memory Optimization Impact: Using compact representations (e.g., unsigned short for indices) reduces memory footprint by approximately 33%.

Limitations and Future Work

  • Load Imbalance in Multi-GPU: The paper acknowledges that pruning inactive features in multi-GPU settings can lead to load imbalance between GPUs, causing per-GPU throughput to drop when the number of active features becomes small. This is left as future work.
  • A100-Specific Optimizations: While the A100 shows promising results, the paper notes that further optimizations tailored to its specific architectural features could yield even greater improvements.
  • Handling Inactive Features: The current implementation does not explicitly handle inactive features, which could be an area for further research to improve efficiency.
  • Real-World Data: The evaluation was performed on synthetic sparse DNNs generated by RadiX-Net. While the authors state their approach can work with arbitrary sparsity patterns, testing on real-world datasets would be valuable.

Summary updated

Abstract

This paper presents GPU performance optimization and scaling results for inference models of the Sparse Deep Neural Network Challenge 2020. Demands for network quality have increased rapidly, pushing the size and thus the memory requirements of many neural networks beyond the capacity of available accelerators. Sparse deep neural networks (SpDNN) have shown promise for reining in the memory footprint of large neural networks. However, there is room for improvement in implementing SpDNN operations on GPUs. This work presents optimized sparse matrix multiplication kernels fused with the ReLU function. The optimized kernels reuse input feature maps from the shared memory and sparse weights from registers. For multi-GPU parallelism, our SpDNN implementation duplicates weights and statically partition the feature maps across GPUs. Results for the challenge benchmarks show that the proposed kernel design and multi-GPU parallelization achieve up to 180 tera-edges per second inference throughput. These results are up to 4.3x faster for a single GPU and an order of magnitude faster at full scale than those of the champion of the 2019 Sparse Deep Neural Network Graph Challenge for the same generation of NVIDIA V100 GPUs. Using the same implementation, we also show single-GPU throughput on NVIDIA A100 is 2.37$\times$ faster than V100.
BibTeX
@misc{hidayetoglu2020efficient,
  author = {Mert Hidayetoglu and Carl Pearson and Vikram Sharma Mailthody and Eiman Ebrahimi and Jinjun Xiong and Rakesh Nagi and Wen-mei W. Hwu},
  title = {{Efficient Inference on GPUs for the Sparse Deep Neural Network Graph Challenge 2020}},
  year = {2020},
  eprint = {2007.14152},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2007.14152},
}
Figure