Repository: pytorch
Issue: Segmentation Fault in `torch.nn.Conv1d` starting from torch 2.2.0
Labels: needs reproduction,module: binaries,module: cuda,triaged

### 🐛 Describe the bug

Starting from torch version 2.2.0, I get a segmentation fault on a forward pass using `Conv1d`. The problem is not there with 2.1.2. Minimal script to reproduce: 
```python
import torch
import faulthandler

faulthandler.enable()

device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
block = torch.nn.Conv1d(
    in_channels=256,
    out_channels=256,
    kernel_size=5,
    stride=1,
    padding=2,
    dilation=1,
    groups=1,
    bias=True,
    padding_mode="zeros",
    device=device,
    dtype=torch.float32,
)

# input shape: (batch, in_channels, length)
input = torch.randn((1, 256, 16), device=device, dtype=torch.float32)
output = block(input)
print("Output shape:", output.shape)
```

The output I get:
```bash
Fatal Python error: Segmentation fault

Current thread 0x00007f336c2ad740 (most recent call first):
  File "/home/chisari/miniconda3/envs/diffusion_env/lib/python3.10/site-packages/torch/nn/modules/conv.py", line 306 in _conv_forward
  File "/home/chisari/miniconda3/envs/diffusion_env/lib/python3.10/site-packages/torch/nn/modules/conv.py", line 310 in forward
  File "/home/chisari/miniconda3/envs/diffusion_env/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1520 in _call_impl
  File "/home/chisari/miniconda3/envs/diffusion_env/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1511 in _wrapped_call_impl
  File "/home/chisari/git/PhD/foundation_grasp/sandbox/debug_th.py", line 24 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

```bash
Collecting environment information...
PyTorch version: 2.2.0+cu121
Is debug build: False
CUDA used to build PyTorch: 12.1
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: version 3.27.1
Libc version: glibc-2.35

Python version: 3.10.13 (main, Sep 11 2023, 13:44:35) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.15.0-97-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: 12.1.105
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: NVIDIA GeForce RTX 4060 Ti
Nvidia driver version: 535.161.07
cuDNN version: Probably one of the following:
/usr/local/cuda-12.1/targets/x86_64-linux/lib/libcudnn.so.8.8.1
/usr/local/cuda-12.1/targets/x86_64-linux/lib/libcudnn_adv_infer.so.8.8.1
/usr/local/cuda-12.1/targets/x86_64-linux/lib/libcudnn_adv_train.so.8.8.1
/usr/local/cuda-12.1/targets/x86_64-linux/lib/libcudnn_cnn_infer.so.8.8.1
/usr/local/cuda-12.1/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8.8.1
/usr/local/cuda-12.1/targets/x86_64-linux/lib/libcudnn_ops_infer.so.8.8.1
/usr/local/cuda-12.1/targets/x86_64-linux/lib/libcudnn_ops_train.so.8.8.1
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:                      48 bits physical, 48 bits virtual
Byte Order:                         Little Endian
CPU(s):                             24
On-line CPU(s) list:                0-23
Vendor ID:                          AuthenticAMD
Model name:                         AMD Ryzen 9 PRO 7945 12-Core Processor
CPU family:                         25
Model:                              97
Thread(s) per core:                 2
Core(s) per socket:                 12
Socket(s):                          1
Stepping:                           2
Frequency boost:                    enabled
CPU max MHz:                        5481.3472
CPU min MHz:                        3000.0000
BogoMIPS:                           7386.31
Flags:                              fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local avx512_bf16 clzero irperf xsaveerptr rdpru wbnoinvd cppc arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq rdpid overflow_recov succor smca fsrm flush_l1d
Virtualization:                     AMD-V
L1d cache:                          384 KiB (12 instances)
L1i cache:                          384 KiB (12 instances)
L2 cache:                           12 MiB (12 instances)
L3 cache:                           64 MiB (2 instances)
NUMA node(s):                       1
NUMA node0 CPU(s):                  0-23
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: Mitigation; safe RET
Vulnerability Spec store bypass:    Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:           Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:           Mitigation; Retpolines, IBPB conditional, IBRS_FW, STIBP always-on, RSB filling, PBRSB-eIBRS Not affected
Vulnerability Srbds:                Not affected
Vulnerability Tsx async abort:      Not affected

Versions of relevant libraries:
[pip3] numpy==1.26.3
[pip3] torch==2.2.0+cu121
[pip3] torchaudio==2.2.0+cu121
[pip3] torchvision==0.17.0+cu121
[pip3] triton==2.2.0
[conda] numpy                     1.26.3                   pypi_0    pypi
[conda] torch                     2.2.0+cu121              pypi_0    pypi
[conda] torchaudio                2.2.0+cu121              pypi_0    pypi
[conda] torchvision               0.17.0+cu121             pypi_0    pypi
[conda] triton                    2.2.0                    pypi_0    pypi
```


cc @seemethere @malfet @osalpekar @atalman @ptrblck @albanD @mruberry @jbschlosser @walterddr @mikaylagawarecki