[CI][XPU] Reject CUDA-IPC weight cache on non-CUDA/ROCm platforms (#56010)
Signed-off-by: mayuyuace <qiming1.zhang@intel.com>
Qiming Zhang committed
Sep 9, 2026 at 23:05 UTC
49632fb3ac8fa92de2b4626bb8f140ffcc4ab8d3
5 files changed
+45
-3
tests/model_executor/model_loader/test_weight_cache.py
+5
@@ -14,7 +14,10 @@ import tempfile
14
import threading
15
import time
16
17
+import pytest
18
+
19
from vllm import SamplingParams
20
+from vllm.platforms import current_platform
21
22
MODEL = "Qwen/Qwen3.5-0.8B"
23
PROMPTS = [
@@ -121,6 +124,8 @@ def test_ipc_cache_cold_start_and_warm_restart(vllm_runner):
124
warm runs disable the disk fallback, so they only pass if the weights
125
really came from the daemon.
126
"""
127
+ if not current_platform.is_cuda_alike():
128
+ pytest.skip("Weight cache IPC sharing requires CUDA or ROCm")
129
llm_kwargs = dict(
130
gpu_memory_utilization=0.3,
131
enforce_eager=True,
vllm/model_executor/model_loader/weight_cache/__init__.py
+4
@@ -5,9 +5,11 @@ from vllm.model_executor.model_loader.weight_cache.ipc_loader import IpcModelLoa
5
from vllm.model_executor.model_loader.weight_cache.protocol import (
6
CacheConfigMismatchError,
7
TensorEntry,
8
+ UnsupportedPlatformForIPCError,
9
UnsupportedQuantForIPCError,
10
WeightCacheKey,
11
WeightCacheUnavailableError,
12
+ check_ipc_platform_support,
13
check_ipc_quant_support,
14
is_ipc_quant_supported,
15
)
@@ -16,9 +18,11 @@ __all__ = [
18
"CacheConfigMismatchError",
19
"IpcModelLoader",
20
"TensorEntry",
21
+ "UnsupportedPlatformForIPCError",
22
"UnsupportedQuantForIPCError",
23
"WeightCacheKey",
24
"WeightCacheUnavailableError",
25
+ "check_ipc_platform_support",
26
"check_ipc_quant_support",
27
"is_ipc_quant_supported",
28
]
vllm/model_executor/model_loader/weight_cache/daemon.py
+7
-3
@@ -43,6 +43,7 @@ from vllm.model_executor.model_loader.weight_cache.protocol import (
43
TensorEntry,
44
WeightCacheKey,
45
WeightCacheUnavailableError,
46
+ check_ipc_platform_support,
47
check_ipc_quant_support,
48
ensure_private_socket_dir,
49
get_physical_device_id,
@@ -205,12 +206,14 @@ class WeightCacheDaemon:
206
self._handle_connection(conn)
207
except (ConnectionError, EOFError):
208
logger.warning("Client disconnected mid-request")
208
- except Exception:
209
- # A single malformed or malicious request must not take
210
- # down the daemon for every other engine on this GPU.
209
+ except Exception as e:
210
+ # Report the error back instead of just closing the
211
+ # socket, but don't let it take the daemon down.
212
logger.exception(
213
"Error handling weight cache client; continuing"
214
)
215
+ with contextlib.suppress(OSError):
216
+ send_msg(conn, {"status": "error", "message": str(e)})
217
finally:
218
server.close()
219
if os.path.exists(socket_path):
@@ -344,6 +347,7 @@ def main() -> None:
347
)
348
# Checked before loading anything: an unsupported quantization method would
349
# otherwise only surface in the engine, after a full load.
350
+ check_ipc_platform_support(where="daemon")
351
check_ipc_quant_support(vllm_config.model_config, where="daemon")
352
parallel_config = vllm_config.parallel_config
353
_reject_unsupported_parallelism(parallel_config)
vllm/model_executor/model_loader/weight_cache/ipc_loader.py
+2
@@ -25,6 +25,7 @@ from vllm.model_executor.model_loader.weight_cache.protocol import (
25
UnsupportedQuantForIPCError,
26
WeightCacheKey,
27
WeightCacheUnavailableError,
28
+ check_ipc_platform_support,
29
check_ipc_quant_support,
30
get_physical_device_id,
31
get_socket_path,
@@ -198,6 +199,7 @@ class IpcModelLoader(BaseModelLoader):
199
200
@staticmethod
201
def _check_supported(vllm_config: VllmConfig, model_config: ModelConfig) -> None:
202
+ check_ipc_platform_support(where="engine")
203
check_ipc_quant_support(model_config, where="engine")
204
cache_dtype = vllm_config.cache_config.cache_dtype
205
if cache_dtype != "auto" and not str(cache_dtype).startswith("fp8"):
vllm/model_executor/model_loader/weight_cache/protocol.py
+27
@@ -26,6 +26,7 @@ import torch
26
27
import vllm.version
28
from vllm.config import ModelConfig
29
+from vllm.platforms import current_platform
30
from vllm.utils.hashing import safe_hash
31
32
SOCKET_NAME_TEMPLATE = "vllm_weight_cache_gpu{gpu_id}.sock"
@@ -54,6 +55,32 @@ class UnsupportedQuantForIPCError(Exception):
55
"""Raised when a quantization method is not verified for IPC weight sharing."""
56
57
58
+class UnsupportedPlatformForIPCError(Exception):
59
+ """Raised when the current platform cannot share CUDA IPC handles."""
60
+
61
+
62
+def check_ipc_platform_support(*, where: str) -> None:
63
+ """Hard-error unless the current platform can share CUDA IPC handles.
64
+
65
+ Only CUDA/ROCm tensors get a real IPC handle from ``TensorEntry``; other
66
+ platforms (e.g. XPU) would silently ship every tensor by value instead.
67
+
68
+ Args:
69
+ where: Short tag ("daemon"/"engine") used in the error message.
70
+
71
+ Raises:
72
+ UnsupportedPlatformForIPCError: If the current platform is not
73
+ CUDA/ROCm.
74
+ """
75
+ if current_platform.is_cuda_alike():
76
+ return
77
+ raise UnsupportedPlatformForIPCError(
78
+ f"[weight_cache:{where}] platform {current_platform.device_name!r} "
79
+ "does not support CUDA IPC weight sharing; only CUDA and ROCm are "
80
+ "supported. Use the default --load-format for this platform."
81
+ )
82
+
83
+
84
# The daemon exports tensor data only, so sharing is correct just for methods
85
# whose post-load effect is either fully captured by that data or rebuilt when
86
# process_weights_after_loading runs under weights_already_processed. Anything