[XPU] enable XPU GRAPH by default (#51600)

Signed-off-by: zhenwei-intel <zhenwei.liu@intel.com>

liuzhenwei committed Sep 24, 2026 at 19:17 UTC dcfc17e0b1cb4a4bb4eeca9a75c82b82d776f25e
7 files changed +38 -29
.buildkite/intel_jobs/engine_intel.yaml
+1 -1
@@ -63,7 +63,7 @@ steps:
63 bash .buildkite/scripts/hardware_ci/run-intel-test.sh
64 'cd tests &&
65 pytest -v -s v1/engine --ignore v1/engine/test_preprocess_error_handling.py &&
66 - VLLM_XPU_ENABLE_XPU_GRAPH=1 pytest -v -s test_config.py'
66 + pytest -v -s test_config.py'
67
68 - label: V1 e2e (2 GPUs)
69 key: v1-e2e-2-gpus
.buildkite/intel_jobs/test-intel.yaml
+12 -8
@@ -18,7 +18,7 @@ steps:
18 key: xpu-example-test
19 depends_on:
20 - image-build-xpu
21 - timeout_in_minutes: 50
21 + timeout_in_minutes: 70
22 device: intel_gpu
23 agent_tags:
24 label: production
@@ -47,7 +47,7 @@ steps:
47 python3 examples/basic/offline_inference/generate.py --model ibm-research/PowerMoE-3b --block-size 64 --enforce-eager -tp 2 --enable-expert-parallel &&
48 python3 examples/basic/offline_inference/generate.py --model superjob/Qwen3-4B-Instruct-2507-GPTQ-Int4 --max-model-len 8192 &&
49 VLLM_XPU_FUSED_MOE_USE_REF=1 python3 examples/basic/offline_inference/generate.py --model Qwen/Qwen3-30B-A3B-Instruct-2507-FP8 --enforce-eager -tp 2 --max-model-len 8192 &&
50 - python3 examples/basic/offline_inference/generate.py --model INCModel/Qwen3-30B-A3B-Instruct-2507-MXFP4-LLMC --enforce-eager -tp 2 --max-model-len 8192
50 + python3 examples/basic/offline_inference/generate.py --model INCModel/Qwen3-30B-A3B-Instruct-2507-MXFP4-LLMC -tp 2 --max-model-len 8192
51 '
52 - label: "XPU W8A8 FP8 Linear Examples"
53 key: xpu-w8a8-fp8-linear-examples
@@ -196,16 +196,20 @@ steps:
196 VLLM_TEST_DEVICE: "xpu"
197 source_file_dependencies:
198 - vllm/compilation/
199 + - vllm/config/compilation.py
200 - vllm/platforms/xpu.py
201 + - vllm/v1/cudagraph_dispatcher.py
202 + - vllm/v1/worker/encoder_cudagraph.py
203 + - vllm/v1/worker/encoder_cudagraph_defs.py
204 - vllm/v1/worker/xpu_model_runner.py
205 - vllm/v1/worker/xpu_worker.py
206 + - tests/v1/cudagraph
207 - .buildkite/intel_jobs/test-intel.yaml
208 commands:
209 - >-
210 bash .buildkite/scripts/hardware_ci/run-intel-test.sh
206 - 'export VLLM_XPU_ENABLE_XPU_GRAPH=1 &&
207 - python3 examples/basic/offline_inference/generate.py --model Qwen/Qwen3-0.6B &&
208 - python3 examples/basic/offline_inference/generate.py --model Qwen/Qwen3-0.6B --kv-cache-dtype fp8 &&
209 - python3 examples/basic/offline_inference/generate.py --model INCModel/Qwen3-30B-A3B-Instruct-2507-MXFP4-CT-AutoRound --max-model-len 4096'
210 - # Temporarily disabled (multi-GPU/MXFP8 not yet supported with XPU Graph):
211 - # python3 examples/basic/offline_inference/generate.py --model INCModel/Qwen3-30B-A3B-Instruct-2507-MXFP8-CT-AutoRound -tp 2 --max-model-len 4096
211 + 'cd tests &&
212 + pytest -v -s v1/cudagraph/test_cudagraph_dispatch.py &&
213 + pytest -v -s v1/cudagraph/test_cudagraph_mode.py &&
214 + pytest -v -s v1/cudagraph/test_breakable_cudagraph.py &&
215 + pytest -v -s v1/cudagraph/test_encoder_cudagraph.py'
.buildkite/scripts/hardware_ci/run-intel-ci-test.sh
-2
@@ -65,8 +65,6 @@ case "${test_suite}" in
65 pytest -v -s quantization/test_compressed_tensors.py::test_compressed_tensors_fp8
66 ;;
67 graph)
68 - export VLLM_XPU_ENABLE_XPU_GRAPH=1
69 -
68 python3 examples/basic/offline_inference/generate.py --model Qwen/Qwen3-0.6B
69 python3 examples/basic/offline_inference/generate.py --model Qwen/Qwen3-0.6B --kv-cache-dtype fp8
70 python3 examples/basic/offline_inference/generate.py --model INCModel/Qwen3-30B-A3B-Instruct-2507-MXFP4-CT-AutoRound --max-model-len 4096
tests/quantization/test_auto_round.py
+16 -1
@@ -146,6 +146,21 @@ MODEL_RUNNER_KWARGS: dict[str, dict[str, Any]] = {
146 },
147 }
148
149 +# These checkpoints fail during XPU graph capture, so run them eagerly there.
150 +XPU_EAGER_ONLY_MODELS = {
151 + "OPEA/Qwen2.5-0.5B-Instruct-int4-sym-inc",
152 + "Intel/Qwen2-0.5B-Instruct-int4-sym-AutoRound",
153 + "Intel/Qwen3-8B-w2g64-for-ut",
154 + "INCModel/Qwen3-30B-A3B-12L-W4A16-test",
155 +}
156 +
157 +
158 +def _runner_kwargs(model: str) -> dict[str, Any]:
159 + kwargs = dict(MODEL_RUNNER_KWARGS.get(model, {}))
160 + if current_platform.is_xpu() and model in XPU_EAGER_ONLY_MODELS:
161 + kwargs["enforce_eager"] = True
162 + return kwargs
163 +
164
165 @pytest.mark.skipif(
166 not (
@@ -157,7 +172,7 @@ MODEL_RUNNER_KWARGS: dict[str, dict[str, Any]] = {
172 )
173 @pytest.mark.parametrize("model", MODELS + QWEN3_AUTOROUND_MODELS)
174 def test_auto_round_model(vllm_runner, model):
160 - with vllm_runner(model, **MODEL_RUNNER_KWARGS.get(model, {})) as llm:
175 + with vllm_runner(model, **_runner_kwargs(model)) as llm:
176 output = llm.generate_greedy(["The capital of France is"], max_tokens=8)
177
178 assert output
vllm/envs.py
-5
@@ -317,7 +317,6 @@ if TYPE_CHECKING:
317 VLLM_ELASTIC_EP_SCALE_UP_LAUNCH: bool = False
318 VLLM_ELASTIC_EP_DRAIN_REQUESTS: bool = False
319 VLLM_MEMORY_PROFILER_ESTIMATE_CUDAGRAPHS: bool = True
320 - VLLM_XPU_ENABLE_XPU_GRAPH: bool = False
320 VLLM_XPU_FORCE_N_CONTIG_WEIGHT: bool = False
321 VLLM_XPU_USE_SAMPLER_KERNEL: bool = True
322 VLLM_XPU_INC_WNA16_BACKEND: Literal["auto", "ark", "w4a16", "w4a8"] = "auto"
@@ -2139,10 +2138,6 @@ environment_variables: dict[str, Callable[[], Any]] = {
2138 "VLLM_MEMORY_PROFILER_ESTIMATE_CUDAGRAPHS": lambda: bool(
2139 int(os.getenv("VLLM_MEMORY_PROFILER_ESTIMATE_CUDAGRAPHS", "1"))
2140 ),
2142 - # Whether enable XPU graph on Intel GPU
2143 - "VLLM_XPU_ENABLE_XPU_GRAPH": lambda: bool(
2144 - int(os.getenv("VLLM_XPU_ENABLE_XPU_GRAPH", "0"))
2145 - ),
2141 # Force N-contiguous weight layout for all XPU unquantized linears.
2142 "VLLM_XPU_FORCE_N_CONTIG_WEIGHT": lambda: bool(
2143 int(os.getenv("VLLM_XPU_FORCE_N_CONTIG_WEIGHT", "0"))
vllm/platforms/xpu.py
+7 -8
@@ -336,16 +336,15 @@ class XPUPlatform(Platform):
336 "XPU Graph is not supported in the current PyTorch version, "
337 "disabling cudagraph_mode."
338 )
339 - elif not envs.VLLM_XPU_ENABLE_XPU_GRAPH:
339 +
340 + if (
341 + vllm_config.model_config is not None
342 + and vllm_config.model_config.enable_sleep_mode
343 + and compilation_config.cudagraph_mode != CUDAGraphMode.NONE
344 + ):
345 compilation_config.cudagraph_mode = CUDAGraphMode.NONE
346 logger.warning_once(
342 - "XPU Graph is disabled by environment variable, "
343 - "please set VLLM_XPU_ENABLE_XPU_GRAPH=1 to enable it."
344 - )
345 - else:
346 - logger.warning_once(
347 - "XPU Graph support is experimental and currently only supports "
348 - "single-GPU execution."
347 + "XPU Graph is not compatible with sleep mode, disabling cudagraph_mode."
348 )
349
350 # Disable fusion passes not yet supported on XPU.
vllm/v1/worker/gpu_worker.py
+2 -4
@@ -616,12 +616,10 @@ class Worker(WorkerBase):
616 # torch.accelerator.get_memory_info (reliable on ROCm, as used by
617 # the AMD-CI mem tests), and graph_pool_handle resolves to the same
618 # torch.cuda handle the live capture path already uses on ROCm.
619 - # XPU stays excluded (see #39977).
619 cudagraph_memory_estimate = 0
620 if (
622 - current_platform.is_cuda_alike()
623 - and self.vllm_config.compilation_config.cudagraph_mode != CUDAGraphMode.NONE
624 - ):
621 + current_platform.is_cuda_alike() or current_platform.is_xpu()
622 + ) and self.vllm_config.compilation_config.cudagraph_mode != CUDAGraphMode.NONE:
623 cudagraph_memory_estimate = self.model_runner.profile_cudagraph_memory()
624
625 # Respect the opt-in flag as originally designed.