From c34995b598f771e343424fdd21eec6dd60ac8f83 Mon Sep 17 00:00:00 2001 From: ZailiWang Date: Thu, 18 Sep 2025 18:16:26 +0800 Subject: [PATCH 1/2] Fix sgl_kernel import failure on devices other than CUDA --- docs/platforms/cpu_server.md | 2 +- sgl-kernel/python/sgl_kernel/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/platforms/cpu_server.md b/docs/platforms/cpu_server.md index 9e9e407ce422..90cee15a25c5 100644 --- a/docs/platforms/cpu_server.md +++ b/docs/platforms/cpu_server.md @@ -63,7 +63,7 @@ is required to enable SGLang service with CPU engine. conda create -n sgl-cpu python=3.12 -y conda activate sgl-cpu -# Optional: Set PyTorch CPU as primary pip install channel to avoid installing CUDA version +# Set PyTorch CPU as primary pip install channel to avoid installing CUDA version pip config set global.index-url https://download.pytorch.org/whl/cpu pip config set global.extra-index-url https://pypi.org/simple diff --git a/sgl-kernel/python/sgl_kernel/__init__.py b/sgl-kernel/python/sgl_kernel/__init__.py index 81456dbbe349..37ba4e3a9375 100644 --- a/sgl-kernel/python/sgl_kernel/__init__.py +++ b/sgl-kernel/python/sgl_kernel/__init__.py @@ -23,7 +23,7 @@ def _find_cuda_home(): return cuda_home -if torch.version.hip is None: +if torch.version.cuda is not None: cuda_home = Path(_find_cuda_home()) if (cuda_home / "lib").is_dir(): From 3b2d5a43d41a378d3b4ebbded6ce61fff15bda90 Mon Sep 17 00:00:00 2001 From: Zaili Wang <109502517+ZailiWang@users.noreply.github.com> Date: Thu, 18 Sep 2025 18:21:53 +0800 Subject: [PATCH 2/2] gemini suggestion Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- docs/platforms/cpu_server.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/cpu_server.md b/docs/platforms/cpu_server.md index 90cee15a25c5..7e14b7a0754a 100644 --- a/docs/platforms/cpu_server.md +++ b/docs/platforms/cpu_server.md @@ -63,7 +63,7 @@ is required to enable SGLang service with CPU engine. conda create -n sgl-cpu python=3.12 -y conda activate sgl-cpu -# Set PyTorch CPU as primary pip install channel to avoid installing CUDA version +# Set PyTorch CPU as primary pip install channel to avoid installing the larger CUDA-enabled version and prevent potential runtime issues. pip config set global.index-url https://download.pytorch.org/whl/cpu pip config set global.extra-index-url https://pypi.org/simple