[Paper Review] The Indirect Convolution Algorithm
The Indirect Convolution algorithm replaces the memory-intensive im2col transformation in GEMM-based convolution with an indirection buffer of pointers to input tensor rows, enabling GEMM-like performance without data reshuffling. It reduces memory overhead by eliminating im2col storage and outperforms GEMM-based methods by up to 62% on non-1x1 convolutions, while incurring only minor overhead on 1x1 stride-1 convolutions.
Deep learning frameworks commonly implement convolution operators with GEMM-based algorithms. In these algorithms, convolution is implemented on top of matrix-matrix multiplication (GEMM) functions, provided by highly optimized BLAS libraries. Convolutions with 1x1 kernels can be directly represented as a GEMM call, but convolutions with larger kernels require a special memory layout transformation - im2col or im2row - to fit into GEMM interface. The Indirect Convolution algorithm provides the efficiency of the GEMM primitive without the overhead of im2col transformation. In contrast to GEMM-based algorithms, the Indirect Convolution does not reshuffle the data to fit into the GEMM primitive but introduces an indirection buffer - a buffer of pointers to the start of each row of image pixels. This broadens the application of our modified GEMM function to convolutions with arbitrary kernel size, padding, stride, and dilation. The Indirect Convolution algorithm reduces memory overhead proportionally to the number of input channels and outperforms the GEMM-based algorithm by up to 62% on convolution parameters which involve im2col transformations in GEMM-based algorithms. This, however, comes at cost of minor performance reduction on 1x1 stride-1 convolutions.
Motivation & Objective
- To address the high memory and bandwidth cost of im2col transformations in GEMM-based convolution implementations.
- To enable efficient, universal convolution computation across diverse kernel sizes, padding, stride, and dilation without costly data reorganization.
- To provide a GEMM-compatible primitive that maintains high performance while reducing memory footprint.
- To explore a new algorithmic approach that preserves the universality of GEMM-based methods while eliminating im2col overhead.
Proposed method
- Introduces an indirection buffer containing pointers to the start of each output pixel's corresponding input patch in the input tensor.
- Replaces the standard GEMM operation with a modified GEMM primitive that uses the indirection buffer to access input data, avoiding im2col memory layout transformation.
- Maintains compatibility with highly optimized BLAS libraries by leveraging standard GEMM kernels with indirect addressing.
- Uses a compute-bound GEMM primitive that scales well with multiple cores, unlike im2col which is memory-bandwidth limited.
- Designs the algorithm to be agnostic to kernel size, padding, stride, and dilation, enabling broad applicability.
- Employs a hybrid strategy: switching between traditional GEMM and Indirect GEMM based on convolution parameters to optimize overall performance.
Experimental results
Research questions
- RQ1Can a GEMM-based convolution algorithm be designed to eliminate the im2col transformation without sacrificing performance or generality?
- RQ2How does the performance of an indirection-based GEMM primitive compare to traditional GEMM and im2col-based GEMM across diverse convolution hyperparameters?
- RQ3What is the memory and computational overhead of maintaining an indirection buffer compared to the im2col buffer?
- RQ4Does the Indirect Convolution algorithm scale better than GEMM-based methods in multi-threaded environments due to its compute-bound nature?
- RQ5Can the algorithm achieve significant speedups on convolutions that currently require im2col transformation, especially for larger kernels?
Key findings
- The Indirect Convolution algorithm reduces memory overhead proportionally to the number of input channels by eliminating the im2col transformation.
- It outperforms GEMM-based convolution by up to 62% on convolutions that require im2col transformation, particularly for larger kernels.
- Convolutions with larger than 1x1 kernels see performance improvements in the 2.7–23.3% range due to reduced memory bandwidth pressure.
- 1x1 stride-2 convolutions, which also require im2col, see smaller improvements of 0.5–8.0%, as they benefit less from cache locality.
- 1x1 stride-1 convolutions, which do not require im2col, experience a minor performance regression of 0.3–1.9% due to added indirection complexity.
- The algorithm's performance advantage increases with system arithmetic intensity, suggesting growing benefit with future hardware generations.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.