Skip to main content

Overview

CUTLASS provides highly optimized convolution operations for 2D and 3D inputs using the implicit GEMM algorithm. This approach reformulates convolution as a matrix multiplication, leveraging CUTLASS’s GEMM infrastructure for maximum performance.
Implicit GEMM convolution achieves similar performance to cuDNN while providing greater flexibility and customization through C++ templates.

Convolution Types

CUTLASS supports three main convolution operations:

Fprop

Forward propagationOutput = Conv(Activation, Filter)

Dgrad

Activation gradient (backprop)dActivation = Conv(dOutput, Filter)

Wgrad

Filter gradient (weight update)dFilter = Conv(Activation, dOutput)

cutlass::conv::device::ImplicitGemmConvolution

The primary convolution device operator template.

Template Structure

include/cutlass/conv/device/implicit_gemm_convolution.h:52

Key Type Aliases

typename
Element type for activation tensor (input feature maps)For Fprop: input activationsFor Dgrad: output gradientsFor Wgrad: output gradients
typename
Element type for filter tensor (kernel weights)For all modes: filter/kernel weights
typename
Element type for output tensorFor Fprop: output activationsFor Dgrad: input gradientsFor Wgrad: filter gradients
conv::Operator
Convolution operation type:
  • conv::Operator::kFprop - Forward propagation
  • conv::Operator::kDgrad - Activation gradient
  • conv::Operator::kWgrad - Filter gradient
  • conv::Operator::kDeconv - Deconvolution (transposed convolution)

Problem Size (Conv2d)

include/cutlass/conv/conv2d_problem_size.h
int
Batch size (number of images)
int
Input spatial dimensions (Height × Width)
int
Number of input channels
int
Number of output channels (filters)
int
Filter spatial dimensions (Height × Width)
int
Output spatial dimensions (Height × Width)Computed from input size, padding, stride, and dilation
int
Padding applied to top/left (in Fprop)
int
Convolution stride
int
Filter dilation (atrous convolution)
int
default:"1"
Number of groups for grouped convolutionWhen > 1, inputs and outputs are split into groups with independent convolutions

Tensor Layouts

CUTLASS convolution supports multiple tensor layouts:

NHWC (TensorNHWC)

Layout: Channels are the fastest-changing dimension (most contiguous in memory)

NCHW (TensorNCHW)

Layout: Spatial dimensions are contiguous

Filter Layouts

Forward Propagation (Fprop) Example

From examples/16_ampere_tensorop_conv2dfprop/ampere_tensorop_conv2dfprop.cu:

Activation Gradient (Dgrad) Example

Dgrad Kernel

Filter Gradient (Wgrad) Example

Wgrad Kernel

Advanced Features

Grouped Convolution

Grouped Convolution
Grouped convolution is commonly used in architectures like ResNeXt and MobileNet. CUTLASS supports both single-group and multi-group modes.

Depthwise Convolution

Depthwise convolution is a special case where groups = C = K:
Depthwise Separable

Strided Convolution

Strided Convolution

Dilated Convolution

Atrous Convolution

Deconvolution (Transposed Convolution)

Transposed Convolution

3D Convolution

For volumetric data (e.g., video, medical imaging):
Conv3d Problem Size

Memory Access Patterns

Iterator Algorithms

CUTLASS uses different iterator algorithms for different layouts:
enum
Analytically computed predicates (slower, more flexible)
enum
Optimized iterators with precomputed predicates (faster)
enum
Specialized for unit stride and dilation

Operator Verification

Check Implementation
Common reasons for can_implement failure:
  • Output channels K not aligned to required boundary
  • Invalid group count (C or K not divisible by groups)
  • Unsupported stride/dilation combination
  • Tensor size exceeds 2^31 elements

Performance Tuning

Tile Size Selection

For NHWC layout on Ampere/Hopper, use larger threadblock tiles:
  • GemmShape<128, 128, 64> or GemmShape<128, 256, 64>
For NCHW layout or older architectures:
  • GemmShape<128, 128, 32> or GemmShape<64, 64, 32>

Pipeline Stages

Split-K for Small Batches

Split-K Convolution

Example Applications

Image Classification

ResNet, VGG, EfficientNet convolution layers

Object Detection

YOLO, Faster R-CNN feature extractors

Semantic Segmentation

U-Net, DeepLab upsampling and downsampling

Video Processing

3D convolutions for action recognition

Convolution Bias

Add bias and activation in epilogue for fused operations

Batch Normalization

Can be fused into convolution epilogue

Residual Connections

Use epilogue to add skip connections

Gather/Scatter Conv

Sparse or irregular convolution patterns

Comparison with cuDNN

See Also

GEMM API

Convolution builds on GEMM infrastructure

Epilogue Operations

Fuse activations and bias into convolution

Conv Examples

See examples/09_turing_tensorop_conv2dfprop/ and related examples

Performance Guide

Optimize convolution kernels for your workload