fix scheduler for non-cuda devices and disable piecewise cuda graph f… (#19992)
Co-authored-by: Kangyan-Zhou <zky314343421@gmail.com>
This commit is contained in:
6
.github/workflows/pr-test-xpu.yml
vendored
6
.github/workflows/pr-test-xpu.yml
vendored
@@ -114,15 +114,13 @@ jobs:
|
||||
docker exec "$cid" /home/sdp/miniforge3/envs/py3.10/bin/python3 -m pip install pytest expecttest ray huggingface_hub
|
||||
docker exec "$cid" /home/sdp/miniforge3/envs/py3.10/bin/python3 -m pip uninstall -y flashinfer-python
|
||||
docker exec "$cid" /bin/bash -c '/home/sdp/miniforge3/envs/py3.10/bin/hf auth login --token ${HF_TOKEN} '
|
||||
docker exec -u root "$cid" /bin/bash -c "ln -sf /home/sdp/miniforge3/envs/py3.10/bin/python3 /usr/bin/python3"
|
||||
|
||||
|
||||
- name: Run E2E Bfloat16 tests
|
||||
timeout-minutes: 20
|
||||
run: |
|
||||
cid="${{ steps.start_container.outputs.container_id }}"
|
||||
docker exec -w /home/sdp/sglang/ "$cid" \
|
||||
bash -c "LD_LIBRARY_PATH=/home/sdp/miniforge3/envs/py3.10/lib:$LD_LIBRARY_PATH && cd ./test/srt && python3 run_suite.py --suite per-commit-xpu"
|
||||
|
||||
docker exec "$cid" bash -c "source /home/sdp/miniforge3/bin/activate && conda activate py3.10 && cd /home/sdp/sglang/test/srt && python3 run_suite.py --suite per-commit-xpu"
|
||||
- name: Cleanup container
|
||||
if: always()
|
||||
run: |
|
||||
|
||||
@@ -59,6 +59,7 @@ from sglang.srt.utils.common import (
|
||||
is_sm100_supported,
|
||||
is_sm120_supported,
|
||||
is_triton_kernels_available,
|
||||
is_xpu,
|
||||
json_list_type,
|
||||
nullable_str,
|
||||
parse_connector_type,
|
||||
@@ -1067,8 +1068,8 @@ class ServerArgs:
|
||||
# 5. Pipeline parallelism
|
||||
if self.pp_size > 1:
|
||||
self.disable_piecewise_cuda_graph = True
|
||||
# 6. Non-CUDA hardware (AMD, NPU, CPU, MPS, MUSA, etc.)
|
||||
if is_hip() or is_npu() or is_cpu() or is_mps() or is_musa():
|
||||
# 6. Non-CUDA hardware (AMD, NPU, CPU, etc.)
|
||||
if is_hip() or is_npu() or is_cpu() or is_mps() or is_musa() or is_xpu():
|
||||
self.disable_piecewise_cuda_graph = True
|
||||
# 7. MoE A2A backend
|
||||
if self.moe_a2a_backend != "none":
|
||||
|
||||
@@ -75,7 +75,7 @@ suite_xeon = {
|
||||
suite_xpu = {
|
||||
"per-commit-xpu": [
|
||||
TestFile("xpu/test_deepseek_ocr.py"),
|
||||
TestFile("xpu/test_internvl.py"),
|
||||
# TestFile("xpu/test_internvl.py"),
|
||||
TestFile("xpu/test_intel_xpu_backend.py"),
|
||||
],
|
||||
}
|
||||
|
||||
@@ -1,147 +0,0 @@
|
||||
"""
|
||||
XPU tests for InternVL models (InternVL2.5-2B, InternVL3.5-2B).
|
||||
|
||||
Uses the same structure as test_vision_openai_server_a.py: OpenAI /v1 chat API
|
||||
and ImageOpenAITestMixin. An XPU-specific base injects --device xpu and
|
||||
--attention-backend intel_xpu.
|
||||
|
||||
Usage (pick module path to match your cwd):
|
||||
|
||||
From test/srt/xpu:
|
||||
python3 -m unittest test_internvl.TestInternVL25Server.test_single_image_chat_completion
|
||||
python3 -m unittest test_internvl
|
||||
|
||||
From test/srt:
|
||||
python3 -m unittest xpu.test_internvl.TestInternVL25Server.test_single_image_chat_completion
|
||||
python3 -m unittest xpu.test_internvl
|
||||
|
||||
From repo root:
|
||||
python3 -m unittest test.srt.xpu.test_internvl.TestInternVL25Server.test_single_image_chat_completion
|
||||
python3 -m unittest test.srt.xpu.test_internvl
|
||||
"""
|
||||
|
||||
import os
|
||||
import unittest
|
||||
|
||||
from sglang.test.vlm_utils import (
|
||||
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
|
||||
DEFAULT_URL_FOR_TEST,
|
||||
ImageOpenAITestMixin,
|
||||
TestOpenAIMLLMServerBase,
|
||||
kill_process_tree,
|
||||
popen_launch_server,
|
||||
)
|
||||
|
||||
# XPU args injected into server launch for all InternVL XPU tests
|
||||
XPU_ARGS = [
|
||||
"--device",
|
||||
"xpu",
|
||||
"--attention-backend",
|
||||
"intel_xpu",
|
||||
]
|
||||
|
||||
|
||||
# Longer launch timeout for InternVL3.5 (can be slow to start on XPU)
|
||||
INTERNVL35_LAUNCH_TIMEOUT = 900
|
||||
|
||||
|
||||
class InternVLXPUServerBase(TestOpenAIMLLMServerBase):
|
||||
"""Base for InternVL tests on XPU. Injects XPU args and sets SGLANG_USE_SGL_XPU."""
|
||||
|
||||
use_sgl_xpu = True # subclasses override for Triton backend
|
||||
launch_timeout = None # subclasses can set to override (seconds)
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.base_url = DEFAULT_URL_FOR_TEST
|
||||
cls.api_key = "sk-123456"
|
||||
|
||||
os.environ["SGLANG_USE_SGL_XPU"] = "1" if cls.use_sgl_xpu else "0"
|
||||
|
||||
other_args = list(XPU_ARGS) + list(cls.extra_args)
|
||||
if cls.trust_remote_code:
|
||||
other_args.extend(cls.fixed_args)
|
||||
else:
|
||||
other_args.extend(
|
||||
arg for arg in cls.fixed_args if arg != "--trust-remote-code"
|
||||
)
|
||||
|
||||
timeout = (
|
||||
cls.launch_timeout
|
||||
if cls.launch_timeout is not None
|
||||
else DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH
|
||||
)
|
||||
cls.process = popen_launch_server(
|
||||
cls.model,
|
||||
cls.base_url,
|
||||
timeout=timeout,
|
||||
api_key=cls.api_key,
|
||||
other_args=other_args,
|
||||
)
|
||||
cls.base_url += "/v1"
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
kill_process_tree(cls.process.pid)
|
||||
|
||||
|
||||
class TestInternVL25Server(ImageOpenAITestMixin, InternVLXPUServerBase):
|
||||
"""InternVL2.5-2B on XPU with SGL XPU backend."""
|
||||
|
||||
model = "OpenGVLab/InternVL2_5-2B"
|
||||
use_sgl_xpu = True
|
||||
extra_args = [
|
||||
"--cuda-graph-max-bs=4",
|
||||
]
|
||||
|
||||
def test_video_images_chat_completion(self):
|
||||
# Video test uses 10 frames and exceeds max_prefill_tokens (23124 > 16384).
|
||||
pass
|
||||
|
||||
|
||||
class TestInternVL25TritonServer(ImageOpenAITestMixin, InternVLXPUServerBase):
|
||||
"""InternVL2.5-2B on XPU with Triton (non-SGL) backend."""
|
||||
|
||||
model = "OpenGVLab/InternVL2_5-2B"
|
||||
use_sgl_xpu = False
|
||||
extra_args = [
|
||||
"--cuda-graph-max-bs=4",
|
||||
]
|
||||
|
||||
def test_video_images_chat_completion(self):
|
||||
# Video test exceeds max_prefill_tokens on XPU with default limits.
|
||||
pass
|
||||
|
||||
|
||||
class TestInternVL35_2BServer(ImageOpenAITestMixin, InternVLXPUServerBase):
|
||||
"""InternVL3.5-2B on XPU with SGL XPU backend."""
|
||||
|
||||
model = "OpenGVLab/InternVL3_5-2B"
|
||||
use_sgl_xpu = True
|
||||
launch_timeout = INTERNVL35_LAUNCH_TIMEOUT
|
||||
extra_args = [
|
||||
"--cuda-graph-max-bs=4",
|
||||
]
|
||||
|
||||
def test_video_images_chat_completion(self):
|
||||
# Video test exceeds max_prefill_tokens (23202 > 14588) on InternVL3.5.
|
||||
pass
|
||||
|
||||
|
||||
class TestInternVL35_2BTritonServer(ImageOpenAITestMixin, InternVLXPUServerBase):
|
||||
"""InternVL3.5-2B on XPU with Triton (non-SGL) backend."""
|
||||
|
||||
model = "OpenGVLab/InternVL3_5-2B"
|
||||
use_sgl_xpu = False
|
||||
launch_timeout = INTERNVL35_LAUNCH_TIMEOUT
|
||||
extra_args = [
|
||||
"--cuda-graph-max-bs=4",
|
||||
]
|
||||
|
||||
def test_video_images_chat_completion(self):
|
||||
# Video test exceeds max_prefill_tokens on InternVL3.5.
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user