Repository: pytorch
Issue: Segmentation fault (core dumped) when using pytorch Conv layers
Labels: needs reproduction,module: crash,module: cudnn,triaged

### 🐛 Describe the bug

The codes below runs normally on the CPU, but there is a segmentation fault in running line `print(net(x).shape)`. Additionally, I tested a simple model without convolutional layers, and it runs fine on the GPU as well.
```python 
import torch
import torch.nn as nn
import faulthandler

faulthandler.enable()

model = nn.Sequential(
    nn.Conv2d(1,32,3,1,1),
    nn.BatchNorm2d(32),
    nn.ReLU(),

    nn.Conv2d(32,64,3,1,1),
    nn.BatchNorm2d(64),
    nn.Sigmoid())

device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
x = torch.randn((1,1,64,64)).to(device)
net = model.to(device)
print(net(x).shape)

```
The output I get:
```
Fatal Python error: Segmentation fault

Current thread 0x000078ba3e1a6740 (most recent call first):
  File "/home/admin123/anaconda3/envs/pytorch2.3/lib/python3.11/site-packages/torch/nn/modules/conv.py", line 456 in _conv_forward
  File "/home/admin123/anaconda3/envs/pytorch2.3/lib/python3.11/site-packages/torch/nn/modules/conv.py", line 460 in forward
  File "/home/admin123/anaconda3/envs/pytorch2.3/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1541 in _call_impl
  File "/home/admin123/anaconda3/envs/pytorch2.3/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1532 in _wrapped_call_impl
  File "/home/admin123/anaconda3/envs/pytorch2.3/lib/python3.11/site-packages/torch/nn/modules/container.py", line 217 in forward
  File "/home/admin123/anaconda3/envs/pytorch2.3/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1541 in _call_impl
  File "/home/admin123/anaconda3/envs/pytorch2.3/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1532 in _wrapped_call_impl
  File "/home/admin123/pytorch_learning/./test.py", line 19 in <module>

Extension modules: numpy.core._multiarray_umath, numpy.core._multiarray_tests, numpy.linalg._umath_linalg, numpy.fft._pocketfft_internal, numpy.random._common, numpy.random.bit_generator, numpy.random._bounded_integers, numpy.random._mt19937, numpy.random.mtrand, numpy.random._philox, numpy.random._pcg64, numpy.random._sfc64, numpy.random._generator, torch._C, torch._C._fft, torch._C._linalg, torch._C._nested, torch._C._nn, torch._C._sparse, torch._C._special (total: 20)
Segmentation fault (core dumped)
```

### Versions

PyTorch version: 2.3.0+cu118
Is debug build: False
CUDA used to build PyTorch: 11.8
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.4 LTS (x86_64)
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.35

Python version: 3.11.9 (main, Apr 19 2024, 16:48:06) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-6.5.0-35-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: 11.8.89
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: NVIDIA RTX A5000
Nvidia driver version: 535.171.04
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture:                       x86_64
CPU op-mode(s):                     32-bit, 64-bit
Address sizes:                      46 bits physical, 48 bits virtual
Byte Order:                         Little Endian
CPU(s):                             32
On-line CPU(s) list:                0-31
Vendor ID:                          GenuineIntel
Model name:                         13th Gen Intel(R) Core(TM) i9-13900K
CPU family:                         6
Model:                              183
Thread(s) per core:                 2
Core(s) per socket:                 24
Socket(s):                          1
Stepping:                           1
CPU max MHz:                        5800.0000
CPU min MHz:                        800.0000
BogoMIPS:                           5990.40

Virtualization:                     VT-x
L1d cache:                          896 KiB (24 instances)
L1i cache:                          1.3 MiB (24 instances)
L2 cache:                           32 MiB (12 instances)
L3 cache:                           36 MiB (1 instance)
NUMA node(s):                       1
NUMA node0 CPU(s):                  0-31
Vulnerability Gather data sampling: Not affected
Vulnerability Itlb multihit:        Not affected
Vulnerability L1tf:                 Not affected
Vulnerability Mds:                  Not affected
Vulnerability Meltdown:             Not affected
Vulnerability Mmio stale data:      Not affected
Vulnerability Retbleed:             Not affected
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass:    Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:           Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:           Mitigation; Enhanced / Automatic IBRS; IBPB conditional; RSB filling; PBRSB-eIBRS SW sequence; BHI BHI_DIS_S
Vulnerability Srbds:                Not affected
Vulnerability Tsx async abort:      Not affected

Versions of relevant libraries:
[pip3] numpy==1.26.4
[pip3] torch==2.3.0+cu118
[pip3] triton==2.3.0
[conda] numpy                     1.26.4                   pypi_0    pypi
[conda] torch                     2.3.0+cu118              pypi_0    pypi
[conda] triton                    2.3.0                    pypi_0    pypi

cc @csarofeen @ptrblck @xwang233