NVCC Segmentation Fault While Building Pytorch


While building pytorch @b8d7a28e1afc12c77f67edaa9f8154ef0bb13f55 with debug enabled and using Clang version 15 as the compilers I encountered a segfault while building some of the cuda code.
build command used for pytorch DEBUG=1 CXX=clang++ CC=clang CUDAHOSTCXX=clang++ python setup.py develop
On investigation it turns out that for debug builds pytorch adds the flags “-g -lineinfo --source-in-ptx” in nvcc command and the issue that seemed to cause the segfault is --source-in-ptx. I tried adding -G option as well and the segfault happens quicker. I removed the --source-in-ptx option for now to get unblocked. I am not sure if this is particular to my system or a general issue and I don’t have another system to test this on.

The build was done in WSL2:
Linux <> #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

NVCC version:
Cuda compilation tools, release 12.1, V12.1.105
Build cuda_12.1.r12.1/compiler.32688072

Ubuntu version:
Distributor ID: Ubuntu
Description: Ubuntu 22.04.2 LTS
Release: 22.04
Codename: jammy

nvidia-smi output:

| NVIDIA-SMI 530.30.02 Driver Version: 531.61 CUDA Version: 12.1 |
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
| 0 NVIDIA GeForce GTX 1060 6GB On | 00000000:08:00.0 On | N/A |
| 0% 54C P0 29W / 120W| 1036MiB / 6144MiB | 0% Default |
| | | N/A |

| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
| No running processes found |

CUDNN version is 8.9.1

CPU: AMD Ryzen 7 2700X Eight-Core Processor

I have allocated my WSL 12GB of RAM