A high-throughput and memory-efficient inference and serving engine for LLMs
[Build] Skip spinloop extension on Python < 3.11 (#44783)
Signed-off-by: Jasen2201 <yajizhan@amd.com>
jasen committed
Jun 11, 2026 at 19:23 UTC
ef67071b21866fd15fa7601674ff75f5185ff277
2 files changed
+17
-13
CMakeLists.txt
+15
-12
@@ -114,20 +114,23 @@ endif()
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
+# Skip the target entirely on Python < 3.11 so the build doesn't break.
118
#
118
-set(VLLM_SPINLOOP_EXT_SRC "csrc/spinloop.cpp")
119
-set(SPINLOOP_COMPILE_FLAGS "")
120
-if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64")
121
- list(APPEND SPINLOOP_COMPILE_FLAGS "-mmwaitx")
119
+if(Python_VERSION VERSION_GREATER_EQUAL "3.11")
120
+ set(VLLM_SPINLOOP_EXT_SRC "csrc/spinloop.cpp")
121
+ set(SPINLOOP_COMPILE_FLAGS "")
122
+ if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64")
123
+ list(APPEND SPINLOOP_COMPILE_FLAGS "-mmwaitx")
124
+ endif()
125
+ define_extension_target(
126
+ spinloop
127
+ DESTINATION vllm
128
+ LANGUAGE CXX
129
+ SOURCES ${VLLM_SPINLOOP_EXT_SRC}
130
+ COMPILE_FLAGS ${SPINLOOP_COMPILE_FLAGS}
131
+ USE_SABI 3.11
132
+ WITH_SOABI)
133
endif()
123
-define_extension_target(
124
- spinloop
125
- DESTINATION vllm
126
- LANGUAGE CXX
127
- SOURCES ${VLLM_SPINLOOP_EXT_SRC}
128
- COMPILE_FLAGS ${SPINLOOP_COMPILE_FLAGS}
129
- USE_SABI 3.11
130
- WITH_SOABI)
134
135
#
136
# Forward the non-CUDA device extensions to external CMake scripts.
setup.py
+2
-1
@@ -1086,7 +1086,8 @@ if _is_cuda() or _is_hip():
1086
# copying the relevant .py files from the source repository.
1087
ext_modules.append(CMakeExtension(name="vllm.triton_kernels", optional=True))
1088
1089
-ext_modules.append(CMakeExtension(name="vllm.spinloop"))
1089
+if sys.version_info >= (3, 11):
1090
+ ext_modules.append(CMakeExtension(name="vllm.spinloop"))
1091
1092
if _is_hip():
1093
ext_modules.append(CMakeExtension(name="vllm._rocm_C"))