Summary
The spinloop C extension declared in CMakeLists.txt uses USE_SABI 3.11, which sets Py_LIMITED_API=0x030b0000 on the C/CXX compile flags. Py_buffer and PyBuffer_Release were only promoted to the stable ABI in Python 3.11; on Python 3.10 the build fails with error: 'Py_buffer' was not declared in this scope.
Repro
Build the ds4-sm120-preview-dev branch (SHA c79225692) against Python 3.10:
cd ~/src/vllm # cloned from jasl/vllm@ds4-sm120-preview-dev
python --version
# Python 3.10.12
TORCH_CUDA_ARCH_LIST=12.0a MAX_JOBS=32 \
pip install --no-build-isolation -v --no-deps .
First object file to compile is csrc/spinloop.cpp, and it fails:
[1/366] Building CXX object CMakeFiles/spinloop.dir/csrc/spinloop.cpp.o
FAILED: CMakeFiles/spinloop.dir/csrc/spinloop.cpp.o
/usr/bin/c++ -DPy_LIMITED_API=0x030b0000 ...
-isystem /usr/include/python3.10 ...
/.../csrc/spinloop.cpp:58:3: error: 'Py_buffer' was not declared in this scope; did you mean 'setbuffer'?
58 | Py_buffer buffer;
/.../csrc/spinloop.cpp:70:37: error: 'buffer' was not declared in this scope
/.../csrc/spinloop.cpp:76:5: error: 'PyBuffer_Release' was not declared in this scope
[...]
Why this matters
Brev g7e.24xlarge (a popular RTX PRO 6000 Blackwell SKU) ships Ubuntu 22.04 with default Python 3.10. AWS DLAMI Ubuntu 22.04 ships 3.10. Many "fresh box" environments are stuck on Py 3.10 unless the user goes out of their way to install 3.11. The current ds4-sm120-preview-dev branch can't be built on those boxes without intervention.
Workaround
sed -i '/USE_SABI 3\.11/d' ~/src/vllm/CMakeLists.txt
This builds the spinloop extension against Python 3.10's full API (no Py_LIMITED_API flag), which works. The extension still functions correctly — the stable ABI is a forward-compatibility nicety, not a correctness requirement.
We document this workaround in our RTX 6000 Pro recipe: canada-quant/dsv4-flash-w4a16-fp8-mtp/RECIPE_RTX6000PRO.md §1.
Proposed fix (one of)
Option A — drop USE_SABI 3.11 for the spinloop target if Python 3.10 is detected by CMake's Python_FOUND / Python_VERSION checks:
if(Python_VERSION VERSION_GREATER_EQUAL "3.11")
set(_SPINLOOP_SABI USE_SABI 3.11)
else()
set(_SPINLOOP_SABI "")
endif()
define_extension_target(
spinloop
DESTINATION vllm
LANGUAGE CXX
SOURCES ${VLLM_SPINLOOP_EXT_SRC}
COMPILE_FLAGS ${SPINLOOP_COMPILE_FLAGS}
${_SPINLOOP_SABI}
WITH_SOABI
)
Option B — document the Python 3.11+ requirement in the README's build prerequisites and have CMake error early with a clear message:
if(Python_VERSION VERSION_LESS "3.11")
message(FATAL_ERROR
"Building the spinloop extension with USE_SABI 3.11 requires Python ≥ 3.11. "
"Either upgrade Python or remove the USE_SABI 3.11 directive from "
"CMakeLists.txt around the spinloop target.")
endif()
Either is fine. Option A is more user-friendly; option B trades convenience for explicitness.
Notes
- Likely a clean drop-in for jasl's branches that derive from this same CMake structure.
- May or may not affect upstream
vllm-project/vllm depending on whether spinloop has landed there yet; if so, same patch applies.
- The repro is from
canada-quant/dsv4-flash-w4a16-fp8-mtp building against your ds4-sm120-preview-dev branch — full recipe + bench numbers there if useful context.
Summary
The
spinloopC extension declared inCMakeLists.txtusesUSE_SABI 3.11, which setsPy_LIMITED_API=0x030b0000on the C/CXX compile flags.Py_bufferandPyBuffer_Releasewere only promoted to the stable ABI in Python 3.11; on Python 3.10 the build fails witherror: 'Py_buffer' was not declared in this scope.Repro
Build the
ds4-sm120-preview-devbranch (SHAc79225692) against Python 3.10:First object file to compile is
csrc/spinloop.cpp, and it fails:Why this matters
Brev
g7e.24xlarge(a popular RTX PRO 6000 Blackwell SKU) ships Ubuntu 22.04 with default Python 3.10. AWS DLAMI Ubuntu 22.04 ships 3.10. Many "fresh box" environments are stuck on Py 3.10 unless the user goes out of their way to install 3.11. The currentds4-sm120-preview-devbranch can't be built on those boxes without intervention.Workaround
This builds the
spinloopextension against Python 3.10's full API (noPy_LIMITED_APIflag), which works. The extension still functions correctly — the stable ABI is a forward-compatibility nicety, not a correctness requirement.We document this workaround in our RTX 6000 Pro recipe:
canada-quant/dsv4-flash-w4a16-fp8-mtp/RECIPE_RTX6000PRO.md§1.Proposed fix (one of)
Option A — drop
USE_SABI 3.11for the spinloop target if Python 3.10 is detected by CMake'sPython_FOUND/Python_VERSIONchecks:Option B — document the Python 3.11+ requirement in the README's build prerequisites and have CMake error early with a clear message:
Either is fine. Option A is more user-friendly; option B trades convenience for explicitness.
Notes
vllm-project/vllmdepending on whether spinloop has landed there yet; if so, same patch applies.canada-quant/dsv4-flash-w4a16-fp8-mtpbuilding against yourds4-sm120-preview-devbranch — full recipe + bench numbers there if useful context.