NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

cuDNN: Efficient Primitives for Deep Learning

Sharan Chetlur, Cliff Woolley, Philippe Vandermersch, Jonathan Cohen, John Tran, Bryan Catanzaro, Evan ShelhamerarXiv 2014

Introduction

In the early 2010s, the rapid growth of deep learning created a significant engineering challenge. Training deep neural networks is computationally intensive, requiring low-level, custom-written "kernels" to leverage the parallel processing power of GPUs. However, this approach led to redundant efforts across different frameworks—such as Caffe, Torch, and Theano—and architectural fragility, as kernels required manual re-optimization for every new GPU generation.

To address these issues, NVIDIA introduced cuDNN, a library of highly optimized primitives including convolutions, pooling, and activation functions. Aiming to be the "BLAS for Deep Learning," cuDNN abstracts hardware-specific optimizations, allowing researchers to focus on model design while ensuring high performance and portability across GPU architectures.

Implementation Strategies for Convolution

The primary challenge in cuDNN is optimizing convolutions, which account for the majority of a network's execution time. The library explores several implementation strategies to balance speed and memory usage.

Lowering to GEMM and Lazy Materialization

A common technique is "lowering" convolutions into a large matrix multiplication (GEMM) by rearranging input data (the "im2col" process). While effective for performance, this typically requires significant auxiliary memory. cuDNN innovates by using lazy materialization: instead of storing a massive temporary matrix in global memory, the library generates the necessary data directly in the GPU's fast on-chip memory (caches and SRAM) during computation. This approach provides the speed of matrix multiplication without the high memory overhead.

Visualization of the lowering process where image and filter data are mapped to matrices for GEMM-based convolution.

Indexing Optimization

To support lazy materialization, cuDNN performs complex coordinate math on the fly. The authors implemented specialized algorithms to replace expensive integer division and modulus operations with faster bit-shifts and multiplications, minimizing the computational overhead of flexible indexing.

Performance Evaluation

The performance of cuDNN was evaluated using standard benchmark layers and real-world integration into the Caffe framework.

Benchmarking and Hardware Utilization

On the NVIDIA Tesla K40, cuDNN achieved throughput ranging from 0.8x to 2.25x the speed of existing solutions like cuda-convnet2. The library demonstrated high hardware utilization, reaching between 23% and 51% of theoretical peak single-precision TFlops. Crucially, cuDNN maintains high efficiency even at small minibatch sizes, a scenario where previous implementations often struggled.

Performance comparison (TFlops) of cuDNN against CAFFE and cuda-convnet2 across varying minibatch sizes.

Integration Results

Integrating cuDNN into Caffe resulted in a 36% improvement in overall training time for a standard AlexNet-variant model. Furthermore, the library proved "future-proof," delivering optimal performance on both Kepler (K40) and Maxwell (GTX 980) architectures without requiring user-level code changes.

Conclusion and Future Work

cuDNN successfully established a standardized, high-performance backend for deep learning. By eliminating the need for auxiliary memory buffers and providing a portable API, it enabled the training of larger models and more efficient experimentation. Future iterations of the library aim to expand support for 1D and 3D convolutions, incorporate advanced connectivity patterns like "untied weights," and further optimize multi-GPU scaling.

Summary updated

BibTeX
@misc{chetlur2014cudnn,
  author = {Sharan Chetlur and Cliff Woolley and Philippe Vandermersch and Jonathan Cohen and John Tran and Bryan Catanzaro and Evan Shelhamer},
  title = {{cuDNN: Efficient Primitives for Deep Learning}},
  year = {2014},
  eprint = {1410.0759},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1410.0759},
}
Figure