Fast Algorithms for Convolutional Neural Networks

Andrew Lavin, Scott GrayCVPR 2016

Introduction

Convolutional Neural Networks (CNNs) have revolutionized computer vision, yet their computational intensity remains a significant hurdle for real-time applications. Modern architectures have converged on the use of small 3x3 filters, which are efficient and accurate but challenging to optimize using traditional methods. Direct convolution is often slow, while Fast Fourier Transform (FFT) approaches carry excessive overhead for small kernels. Furthermore, edge applications like autonomous driving require low-latency processing at small batch sizes, a regime where standard GPU libraries often struggle. This paper introduces a class of fast algorithms based on Winograd’s minimal filtering theory, specifically optimized for the small-filter, small-batch constraints of modern deep learning.

Winograd Minimal Filtering

The core of the proposed method is the application of Winograd’s minimal filtering algorithms. These algorithms are designed to compute a block of outputs using the minimum possible number of multiplications. For a 1D convolution producing $m$ outputs with a filter of size $r$, Winograd demonstrated that only $m+r-1$ multiplications are required. By nesting these 1D algorithms, we derive 2D versions suitable for CNNs. For example, the $F(2\times2, 3\times3)$ algorithm reduces the multiplication count from 36 to 16, yielding a theoretical 2.25x speedup.

The computation follows a "Transform-Multiply-Inverse Transform" pipeline. Both the filter and the data tiles are transformed into a specialized Winograd domain. In this domain, the convolution operation is reduced to element-wise multiplication, which can be efficiently implemented as a dense matrix multiplication (GEMM) across multiple channels.

Implementation

To achieve peak performance, a custom "fused" kernel was implemented for NVIDIA Maxwell GPUs. This kernel performs the entire Winograd process—transforms and multiplications—within the GPU's fast on-chip memory (registers and shared memory), significantly reducing memory bandwidth requirements. Unlike FFT-based methods that require large workspace buffers, the Winograd approach is memory-efficient, requiring at most 16MB of workspace.

Results and Discussion

The algorithms were benchmarked using the VGG Network (Network E), which consists entirely of 3x3 convolutions. Performance was measured in effective TFLOPS across various layers and batch sizes.

Performance of Winograd algorithms on vgg.conv5 across batch sizes, including the legend for all algorithm variants.

As illustrated in the performance data, the Winograd-based implementations (light and dark blue bars) consistently outperform NVIDIA’s cuDNN v3 (orange and red bars). On an NVIDIA Titan X, the implementation achieved 9.49 TFLOPS for fp32 data at batch size 16. Most notably, at batch size 1, the Winograd algorithm provided a 2.26x speedup over cuDNN, demonstrating its suitability for low-latency inference.

Performance on vgg.conv1.1, showing the algorithm's behavior on early network layers.

Comparison across layers shows that these gains are consistent throughout the network. While larger Winograd tiles (e.g., $F(6,3)$) offer higher theoretical speedups, they can suffer from numerical instability. The $F(2,3)$ and $F(4,3)$ variants were found to be the optimal "sweet spots," maintaining high precision even in half-precision (fp16) computations.

Conclusion

Winograd-based algorithms offer a significant performance leap for CNNs utilizing small filters. By reaching the mathematical lower bound for multiplications and leveraging optimized GEMM operations, these algorithms provide high, stable throughput across all batch sizes. This approach is particularly valuable for real-time, low-latency applications where traditional GPU optimizations fall short.

Summary updated

BibTeX
@inproceedings{lavin2016fast,
  author = {Andrew Lavin and Scott Gray},
  title = {{Fast Algorithms for Convolutional Neural Networks}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2016},
  doi = {10.1109/cvpr.2016.435},
}
Figure