Abstract
Convolutional neural networks (CNNs) are a cornerstone of modern deep learning, yet the convolution operation remains a significant computational bottleneck, often accounting for the majority of execution time. This paper observes that feature maps in deep layers are inherently sparse, containing a high percentage of zero values that lead to redundant computations. Furthermore, the traditional separation of convolution and pooling layers results in excessive data transfer between CPU and GPU. We propose two novel methods to address these inefficiencies: the Extended and Compressed Row (ECR) format to accelerate convolution by skipping zero-value calculations, and the Pooling-pack Extended and Compressed Row (PECR) format which fuses convolution and pooling operations. Experimental results demonstrate significant performance gains, with the proposed Optional Convolution and Pooling Algorithm (OCPA) achieving up to a 4.3X speedup over cuDNN for VGG-19 and a 2.74X speedup for DenseNet-121.
Introduction
In the landscape of computer vision, Convolutional Neural Networks (CNNs) are the primary workhorses. However, their computational intensity is a major hurdle, with convolution operations typically consuming over 70% of a model's total execution time. A key observation driving this research is the increasing "sparsity" of feature maps as data progresses deeper into the network. Due to activation functions like ReLU and various pruning techniques, often more than 80% of the values in these maps are zeros.
Standard GPU libraries, such as NVIDIA’s cuDNN, generally treat these feature maps as dense matrices. This approach leads to wasted cycles as the GPU performs multiplications and additions on zero values. While sparse libraries like cuSPARSE exist, the overhead of data conversion and non-contiguous memory access often makes them slower than dense methods for CNN workloads. This paper introduces a sparse-aware strategy optimized specifically for GPU architectures to bridge this performance gap.
Methodology: ECR and PECR Formats
To eliminate redundant computation and minimize memory bottlenecks, we propose a three-pronged strategy:
- ECR (Extended and Compressed Row) Format: Traditional convolution often relies on the
im2coloperation to transform the operation into a matrix multiplication. This process creates a massive, redundant matrix. The ECR format skips the explicit creation of this matrix by transforming the feature map into a storage format that retains only non-zero values. By performing data extension, compression, and computation in a single pass of global memory, ECR significantly reduces memory traffic. - PECR (Pooling-pack Extended and Compressed Row) Format: In many architectures, a convolution layer is immediately followed by a pooling layer. PECR "fuses" these operations into a single GPU kernel. By calculating pooling results directly from the sparse convolution output within shared memory, the system avoids the latency of sending intermediate data back to global memory.
- OCPA (Optional Convolution and Pooling Algorithm): This high-level strategy dynamically selects the optimal format (ECR or PECR) for each layer based on the presence of a subsequent pooling operation.
Sparsity in Deep Convolutional Networks
The effectiveness of our approach is rooted in the inherent sparsity of deep CNNs. As shown in Figure 2, the sparsity of feature maps in architectures like VGG-16 and VGG-19 increases dramatically with network depth. In the initial layers, sparsity may be as low as 30-40%, but it quickly climbs to over 80% in the final convolutional stages. Our algorithm is designed to exploit this trend, becoming increasingly efficient as the network gets deeper.
Experimental Results
The proposed OCPA method was evaluated against industry benchmarks including NVIDIA’s cuDNN (FAST configuration) and cuSPARSE across several architectures:
- Overall Model Speedups:
- DenseNet-121: 2.74x faster than cuDNN.
- ResNet-50: 2.23x faster than cuDNN.
- VGG-19: 1.97x faster than cuDNN (overall), with specific convolution operations reaching up to 3.5x and fused operations reaching 4.3x speedup.
- RegNetX-16GF: 1.58x faster than cuDNN.
- Single Layer Performance: In high-sparsity layers, such as those found in GoogLeNet and LeNet, the ECR method achieved up to a 3.99x speedup over cuSPARSE and a 3.6x speedup over cuDNN.
- Computational Efficiency: The algorithm successfully reduced the number of additions by 71% and multiplications by 63% in representative convolution blocks.
Conclusion
By leveraging the inherent sparsity of deep neural networks and fusing sequential operations, we have demonstrated a significant path forward for CNN optimization on GPUs. The "one-pass" advantage of the ECR and PECR formats eliminates the traditional memory overhead associated with sparse computations. While challenges remain regarding batch size sensitivity and format conversion overhead, these methods provide a robust framework for accelerating deep learning inference and training on modern hardware.
Summary updated