@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 0a5cbf633e
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 2, 01:00 UTC

Handle spinloop ext load failure gracefully (#43659)

Signed-off-by: Patrick Schlangen <pschlan@amd.com> Co-authored-by: Shengqi Chen <harry-chen@outlook.com>

pschlan-amd committed Jun 3, 2026 at 18:09 UTC 0a5cbf633e1f0e8cfbcc9888598a358ecbdecb2f
2 files changed +15 -6
CMakeLists.txt
+2
@@ -112,6 +112,8 @@ endif()
112 #
113 # spinloop extension (pure CXX; must stay above the non-CUDA device branch so
114 # CPU builds define the target before the early return)
115 +# This extension requires SABI 3.11 since it relies on Py_buffer support. Loading
116 +# failure is handled gracefully on vLLM side for lower Python versions.
117 #
118 set(VLLM_SPINLOOP_EXT_SRC "csrc/spinloop.cpp")
119 set(SPINLOOP_COMPILE_FLAGS "")
vllm/distributed/device_communicators/shm_broadcast.py
+13 -6
@@ -38,9 +38,19 @@ from vllm.utils.network_utils import (
38 is_valid_ipv6_address,
39 )
40
41 +logger = init_logger(__name__)
42 +
43 +
44 +SPINLOOP_EXT_ENABLED = False
45 if envs.VLLM_USE_SPINLOOP_EXT:
42 - from vllm.spinloop import spinloop
46 + try:
47 + from vllm.spinloop import spinloop
48
49 + SPINLOOP_EXT_ENABLED = True
50 + except ImportError:
51 + logger.warning(
52 + "spinloop extension could not be loaded, disabling VLLM_USE_SPINLOOP_EXT!"
53 + )
54 SPINLOOP_TIMEOUT_SECONDS = 0.1
55
56 if TYPE_CHECKING:
@@ -82,9 +92,6 @@ def to_bytes_big(value: int, size: int) -> bytes:
92 return value.to_bytes(size, byteorder="big")
93
94
85 -logger = init_logger(__name__)
86 -
87 -
95 LONG_WAIT_TIME_LOG_MSG = (
96 "No available shared memory broadcast block found "
97 "in %d seconds. This typically happens "
@@ -552,7 +559,7 @@ class MessageQueue:
559 written_flag = metadata_buffer[0]
560 return not (written_flag and read_count != self.buffer.n_reader)
561
555 - if envs.VLLM_USE_SPINLOOP_EXT and not check():
562 + if SPINLOOP_EXT_ENABLED and not check():
563 spinloop(metadata_buffer, check, timeout=SPINLOOP_TIMEOUT_SECONDS)
564
565 if not check():
@@ -673,7 +680,7 @@ class MessageQueue:
680 written_flag = metadata_buffer[0]
681 return not (not written_flag or read_flag)
682
676 - if envs.VLLM_USE_SPINLOOP_EXT and not check():
683 + if SPINLOOP_EXT_ENABLED and not check():
684 spinloop(
685 metadata_buffer[0 : self.local_reader_rank + 1],
686 check,