Skip to content

[Feature] Support specifying CUDA version #430

@DarkSharpness

Description

@DarkSharpness

Related issue: sgl-project/sglang#18108

Root cause: CUDA Driver Version: 470.82.01 (too old), which leads to failure in version detectection in line 148

def _get_cuda_target() -> str:
"""Get the CUDA target architecture flag."""
if "TVM_FFI_CUDA_ARCH_LIST" in os.environ:
arch_list = os.environ["TVM_FFI_CUDA_ARCH_LIST"].split() # e.g., "8.9 9.0a"
flags = []
for arch in arch_list:
if len(arch.split(".")) != 2:
raise ValueError(f"Invalid CUDA architecture: {arch}")
major, minor = arch.split(".")
flags.append(f"-gencode=arch=compute_{major}{minor},code=sm_{major}{minor}")
return " ".join(flags)
else:
try:
status = subprocess.run(
args=["nvidia-smi", "--query-gpu=compute_cap", "--format=csv,noheader"],
capture_output=True,
check=True,
)
compute_cap = status.stdout.decode("utf-8").strip().split("\n")[0]
major, minor = compute_cap.split(".")
return f"-gencode=arch=compute_{major}{minor},code=sm_{major}{minor}"
except Exception:
# fallback to a reasonable default
return "-gencode=arch=compute_70,code=sm_70"

I wonder if users can manually specify the cuda major/minor version when building jit modules.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions