fix(sgl-kernel): support CUDA 13 runtime preloading for DGX Spark (#18747)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
b79808bee2
commit
5fc328465a
@@ -166,6 +166,14 @@ def _load_architecture_specific_ops():
|
|||||||
)
|
)
|
||||||
|
|
||||||
# All attempts failed
|
# All attempts failed
|
||||||
|
cuda_version = torch.version.cuda
|
||||||
|
if cuda_version and cuda_version.startswith("13"):
|
||||||
|
install_hint = (
|
||||||
|
"pip install sgl-kernel --index-url https://docs.sglang.ai/whl/cu130/"
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
install_hint = "pip install --upgrade sgl_kernel"
|
||||||
|
|
||||||
error_msg = f"""
|
error_msg = f"""
|
||||||
[sgl_kernel] CRITICAL: Could not load any common_ops library!
|
[sgl_kernel] CRITICAL: Could not load any common_ops library!
|
||||||
|
|
||||||
@@ -177,9 +185,10 @@ Attempted locations:
|
|||||||
GPU Info:
|
GPU Info:
|
||||||
- Compute capability: {compute_capability}
|
- Compute capability: {compute_capability}
|
||||||
- Expected variant: {variant_name}
|
- Expected variant: {variant_name}
|
||||||
|
- CUDA version: {cuda_version}
|
||||||
|
|
||||||
Please ensure sgl_kernel is properly installed with:
|
Please ensure sgl_kernel is properly installed with:
|
||||||
pip install --upgrade sgl_kernel
|
{install_hint}
|
||||||
|
|
||||||
Error details from previous import attempts:
|
Error details from previous import attempts:
|
||||||
{attempt_error_msg}
|
{attempt_error_msg}
|
||||||
@@ -205,7 +214,7 @@ def _find_cuda_home():
|
|||||||
|
|
||||||
|
|
||||||
def _preload_cuda_library():
|
def _preload_cuda_library():
|
||||||
"""Preload the CUDA runtime library to help avoid 'libcudart.so.12 not found' issues."""
|
"""Preload the CUDA runtime library to help avoid 'libcudart.so not found' issues."""
|
||||||
cuda_home = Path(_find_cuda_home())
|
cuda_home = Path(_find_cuda_home())
|
||||||
|
|
||||||
candidate_dirs = [
|
candidate_dirs = [
|
||||||
@@ -217,8 +226,14 @@ def _preload_cuda_library():
|
|||||||
Path("/usr/lib"),
|
Path("/usr/lib"),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Determine CUDA major version to try the matching library first.
|
||||||
|
# On CUDA 13 systems (e.g., DGX Spark), only libcudart.so.13 exists.
|
||||||
|
cuda_major = torch.version.cuda.split(".")[0] if torch.version.cuda else "12"
|
||||||
|
lib_versions = list(dict.fromkeys([cuda_major, "13", "12"]))
|
||||||
|
|
||||||
for base in candidate_dirs:
|
for base in candidate_dirs:
|
||||||
candidate = base / "libcudart.so.12"
|
for lib_version in lib_versions:
|
||||||
|
candidate = base / f"libcudart.so.{lib_version}"
|
||||||
if candidate.exists():
|
if candidate.exists():
|
||||||
try:
|
try:
|
||||||
cuda_runtime_lib = candidate.resolve()
|
cuda_runtime_lib = candidate.resolve()
|
||||||
|
|||||||
Reference in New Issue
Block a user