cuda runtime_error ai_generated true

RuntimeError: NVRTC compilation failed

ID: cuda/nvrtc-compilation-error

Also available as: JSON · Markdown
78%Fix Rate
82%Confidence
3Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
12 active

Root Cause

CUDA JIT (runtime compilation) failed. Custom CUDA extensions or torch.compile emitted invalid PTX/CUDA code.

generic

Workarounds

  1. 85% success Check CUDA_HOME points to the correct toolkit version
    echo $CUDA_HOME && nvcc --version  # must match PyTorch's CUDA version
  2. 82% success Clear JIT cache and retry
    rm -rf ~/.cache/torch_extensions/ && python -c 'import torch; torch.utils.cpp_extension.load(...)'
  3. 80% success For custom extensions, ensure NVCC flags match the GPU architecture
    TORCH_CUDA_ARCH_LIST='8.0;8.9' python setup.py install

Dead Ends

Common approaches that don't work:

  1. Reinstall CUDA toolkit 80% fail

    NVRTC is a runtime compiler issue, not an installation issue; the generated code is invalid

  2. Downgrade GPU driver 75% fail

    NVRTC compiles for the installed toolkit version, not the driver version