Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,8 @@ def remove_rpath(path: Path) -> None:

class CMakeExtension(Extension):
def __init__(self, name: str, cmake_lists_dir: str = ".", **kwa) -> None:
super().__init__(name, sources=[], py_limited_api=not is_freethreaded(), **kwa)
kwa.setdefault("py_limited_api", not is_freethreaded())
super().__init__(name, sources=[], **kwa)
self.cmake_lists_dir = os.path.abspath(cmake_lists_dir)


Expand Down Expand Up @@ -1247,11 +1248,18 @@ def _read_requirements(filename: str) -> list[str]:
if _is_cuda():
if _cuda_arch_contains(7, 0):
ext_modules.append(CMakeExtension(name="vllm._sm70_sampler_C"))
ext_modules.append(CMakeExtension(name="vllm._sm70_exact_reduce_C"))
ext_modules.append(CMakeExtension(name="vllm._h3_w8a16_C"))
ext_modules.append(CMakeExtension(name="vllm._h3_flashinfer_C"))
ext_modules.append(CMakeExtension(name="vllm._h3_flashattn_C"))
ext_modules.append(CMakeExtension(name="vllm._sm70_sparse_attention_C"))
# These five are pybind11 modules, which cannot be built against the
# limited API, so CMake defines them WITH_SOABI but without USE_SABI
# and they carry the full SOABI suffix. Declared limited-API, an
# in-place (editable) build copies an .abi3.so that was never built.
for soabi_module in (
"vllm._sm70_exact_reduce_C",
"vllm._h3_w8a16_C",
"vllm._h3_flashinfer_C",
"vllm._h3_flashattn_C",
"vllm._sm70_sparse_attention_C",
):
ext_modules.append(CMakeExtension(name=soabi_module, py_limited_api=False))
build_sm70_fa2 = _cuda_arch_contains(7, 0) and not _cuda_arch_at_least(8, 0)
if _cuda_arch_at_least(8, 0) or build_sm70_fa2:
ext_modules.append(CMakeExtension(name="vllm.vllm_flash_attn._vllm_fa2_C"))
Expand Down
Loading