build: parametrize CUDA version for wheels and docker
- Add cu128/cu130 build matrix to release workflow - Parametrize Dockerfile and docker-compose with CUDA_TAG build arg - Allow csrc/ and setup.py in docker context via .dockerignore - Add nvcc/torch CUDA version mismatch preflight warning in setup.py - Add cuda_toolkit_version() helper in csrc/build.py - Use at::IntArrayRef explicitly to fix ATen overload ambiguity - Guard kernels with CUDART_VERSION >= 11020 check - Remove invalid [tool.pip] section from pyproject.toml
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import os
|
||||
import sys
|
||||
import warnings
|
||||
from pathlib import Path
|
||||
|
||||
from setuptools import setup
|
||||
@@ -32,7 +33,24 @@ if _should_build():
|
||||
import torch
|
||||
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
|
||||
|
||||
from csrc.build import REGISTRY
|
||||
from csrc.build import REGISTRY, cuda_toolkit_version
|
||||
|
||||
# Preflight: warn if nvcc major version != torch's bundled CUDA major version.
|
||||
# A mismatch (e.g. nvcc 13.0 + cu128 torch) causes cryptic ABI/header errors.
|
||||
nvcc_ver = cuda_toolkit_version()
|
||||
torch_cuda = torch.version.cuda
|
||||
if nvcc_ver is not None and torch_cuda is not None:
|
||||
torch_major = int(torch_cuda.split(".")[0])
|
||||
if nvcc_ver[0] != torch_major:
|
||||
warnings.warn(
|
||||
f"CUDA version mismatch: nvcc is {nvcc_ver[0]}.{nvcc_ver[1]} "
|
||||
f"but torch was built with CUDA {torch_cuda}. "
|
||||
f"This may cause compilation errors. "
|
||||
f"Install a matching torch wheel: "
|
||||
f"pip install torch --index-url "
|
||||
f"https://download.pytorch.org/whl/cu{nvcc_ver[0]}{nvcc_ver[1]}",
|
||||
stacklevel=2,
|
||||
)
|
||||
|
||||
_torch_lib = torch.utils.cpp_extension.library_paths()[0]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user