pytorch / pytorch/pytorch

Performance regression of depthwise Conv1d with fp16/fp32 AMP from 2.7.1 -> 2.8.0 and the issue remains in 2.9.1

Open
#170,138 13 comments 0 reactions 0 assignees View on GitHub
module: convolution module: cuda module: performance needs reproduction triaged
Dominant language
Python
Stars
103k
Forks
29.5k
PR merge metrics
PR metrics pending

Description

### 🐛 Describe the bug

Define a grouped Conv1d. Wrap with amp autocast.

```python
import torch.nn as nn
d_model = 768
kernel_size = 31
conv = nn.Conv1d(
in_channels=d_model,
out_channels=d_model,
groups=d_model,
kernel_size=kernel_size,
padding=kernel_size // 2,
)
```

- FP16/FP32 + depthwise conv (groups == channels): slow
- FP16/FP32 + fully-connected conv (groups == 1): fast
- BF16/FP32 + depthwise conv (groups == channels): fast

### Versions

I tested through 2.6.0 to 2.9.1, the issue occurs for all (and include) 2.8.0+

```python
print("Torch Ver:", torch.__version__)
print("Torch CUDA Ver:", torch.version.cuda)
print("CUDNN Ver:", torch.backends.cudnn.version())
print("Allow TF32:", torch.backends.cuda.matmul.allow_tf32)
print(f"My GPU Arch: {torch.cuda.get_device_capability()}")
print(f"Supported Arches in this Wheel: {torch.cuda.get_arch_list()}")
```

```
Torch Ver: 2.8.0+cu126
Torch CUDA Ver: 12.6
CUDNN Ver: 91002
Allow TF32: False
My GPU Arch: (9, 0)
Supported Arches in this Wheel: ['sm_50', 'sm_60', 'sm_70', 'sm_75', 'sm_80', 'sm_86', 'sm_90']
```

cc @jerryzh168 @ptrblck @msaroufim @eqy @tinglvv @nWEIdia

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.