[Mini-vLLM] SM86-only cut: models, backends, Rust, tests

- Keep only Qwen3.5, Qwen3.5-MTP and Qwen4Exp model paths; trim the model registry to 41 entries
- Delete idle attention backends (MLA, FlashInfer, ROCm-only, quant backends) and dead GDN CuTeDSL kernels
- Remove inc/quark quant loaders; keep compressed-tensors and Marlin
- Drop the Rust frontend, pooling entrypoints, and idle test suites
- Rebuild kernels for sm_80;sm_86 and strip the extensions
- Verified: full import sweep clean (optional deps only) and a dummy-load Qwen3.5 engine run on RTX 3090 via the Triton GDN path

Co-authored-by: Hinata <hinata@idihore.id>
Signed-off-by: MOVZX <movzx@yahoo.com>
This commit is contained in:
2026-10-18 19:19:56 +07:00
co-authored by Hinata
parent c5ab42bc0f
commit e61dcb9143
2728 changed files with 159 additions and 950401 deletions
+5 -105
View File
@@ -18,7 +18,6 @@ import torch
from packaging.version import Version, parse
from setuptools import Extension, setup
from setuptools.command.build_ext import build_ext
from setuptools_rust.build import build_rust
from setuptools_scm import get_version
from torch.utils.cpp_extension import CUDA_HOME, ROCM_HOME
@@ -46,50 +45,13 @@ def load_module_from_path(module_name, path):
ROOT_DIR = Path(__file__).parent
logger = logging.getLogger(__name__)
PRECOMPILED_RUST_FRONTEND_PATH = ROOT_DIR / "vllm" / "vllm-rs"
# setuptools-rust installs PyO3 artifacts as `<module>.<ext-suffix>`, where the
# suffix ends with `.so` on Linux and macOS alike (e.g. `_rust_foo.abi3.so`).
PRECOMPILED_RUST_EXTENSION_MEMBER_REGEX = re.compile(r"vllm/_rust_[^/]*\.so$")
# cannot import envs directly because it depends on vllm,
# which is not installed yet
envs = load_module_from_path("envs", os.path.join(ROOT_DIR, "vllm", "envs.py"))
rust_build = load_module_from_path(
"rust_build", os.path.join(ROOT_DIR, "tools", "build_rust.py")
)
VLLM_TARGET_DEVICE = envs.VLLM_TARGET_DEVICE
USE_PRECOMPILED_EXTENSIONS = envs.VLLM_USE_PRECOMPILED
# VLLM_USE_PRECOMPILED implies precompiled rust frontend too.
USE_PRECOMPILED_RUST_FRONTEND = (
envs.VLLM_USE_PRECOMPILED or envs.VLLM_USE_PRECOMPILED_RUST
)
def should_require_rust_frontend() -> bool:
value = os.getenv("VLLM_REQUIRE_RUST_FRONTEND", "")
return value.lower() not in ("", "0", "false", "no")
def get_precompiled_rust_extension_paths() -> list[Path]:
return sorted((ROOT_DIR / "vllm").glob("_rust_*.so"))
def get_missing_precompiled_rust_extension_modules() -> list[str]:
present = {
path.name.split(".", 1)[0] for path in get_precompiled_rust_extension_paths()
}
return [
module_name
for module_name in rust_build.rust_py_extension_module_names()
if module_name not in present
]
def has_precompiled_rust_extensions() -> bool:
if not rust_build.rust_py_extension_module_names():
return False
return not get_missing_precompiled_rust_extension_modules()
def is_metadata_only_build() -> bool:
@@ -486,36 +448,6 @@ class precompiled_build_ext(build_ext):
return
class precompiled_build_rust(build_rust):
"""Skips local Rust builds when all precompiled Rust artifacts are present."""
def run(self) -> None:
missing = []
if not PRECOMPILED_RUST_FRONTEND_PATH.exists():
missing.append(str(PRECOMPILED_RUST_FRONTEND_PATH))
missing_rust_extensions = get_missing_precompiled_rust_extension_modules()
if missing_rust_extensions:
missing.extend(
str(ROOT_DIR / "vllm" / f"{module_name}*.so")
for module_name in missing_rust_extensions
)
if not missing:
logger.info(
"Skipping local Rust build: using precompiled %s and %s",
PRECOMPILED_RUST_FRONTEND_PATH,
get_precompiled_rust_extension_paths(),
)
return
logger.warning(
"Precompiled wheel did not provide all Rust artifacts (%s); "
"falling back to local Rust build.",
", ".join(missing),
)
super().run()
class precompiled_wheel_utils:
"""Extracts libraries and other files from an existing wheel."""
@@ -910,7 +842,7 @@ class precompiled_wheel_utils:
"vllm/_custom_ops.py",
)
# Changes here are usually harmless for an older wheel.
WHEEL_WARNING_PATHS = ("rust", "setup.py")
WHEEL_WARNING_PATHS = ("setup.py",)
@staticmethod
def find_published_wheel_commit(
@@ -970,7 +902,7 @@ class precompiled_wheel_utils:
if warning:
logger.warning(
"Precompiled wheel %s predates changes to:\n%s\n"
"The Rust frontend and packaged files may be stale.",
"The packaged files may be stale.",
commit,
warning,
)
@@ -1088,7 +1020,6 @@ class precompiled_wheel_utils:
download_filename: str | None,
*,
extract_extensions: bool,
extract_rust_frontend: bool,
) -> dict:
import tempfile
import zipfile
@@ -1133,8 +1064,6 @@ class precompiled_wheel_utils:
"vllm/_rocm_C.abi3.so",
}
)
if extract_rust_frontend:
exact_members.add("vllm/vllm-rs")
flash_attn_regex = re.compile(
r"vllm/vllm_flash_attn/(?:[^/.][^/]*/)*(?!\.)[^/]*\.py"
@@ -1160,14 +1089,6 @@ class precompiled_wheel_utils:
if member.filename in exact_members:
file_members.append(member)
continue
if (
extract_rust_frontend
and PRECOMPILED_RUST_EXTENSION_MEMBER_REGEX.match(
member.filename
)
):
file_members.append(member)
continue
if not extract_extensions:
continue
@@ -1656,24 +1577,16 @@ def add_vllm_package_data(filename: str) -> None:
# PEP 517 invokes setup.py for metadata before invoking the actual build.
if USE_PRECOMPILED_RUST_FRONTEND and not is_metadata_only_build():
if USE_PRECOMPILED_EXTENSIONS and not is_metadata_only_build():
wheel_url, download_filename = precompiled_wheel_utils.determine_wheel_url()
patch = precompiled_wheel_utils.extract_precompiled_and_patch_package(
wheel_url,
download_filename,
extract_extensions=USE_PRECOMPILED_EXTENSIONS,
extract_rust_frontend=True,
)
for pkg, files in patch.items():
package_data.setdefault(pkg, []).extend(files)
# If the rust frontend binary is already present in the source tree (e.g.,
# pre-built in a separate Docker build stage), ship it as-is.
if PRECOMPILED_RUST_FRONTEND_PATH.exists():
add_vllm_package_data("vllm-rs")
for rust_extension_path in get_precompiled_rust_extension_paths():
add_vllm_package_data(rust_extension_path.name)
if _no_device():
ext_modules = []
@@ -1685,29 +1598,16 @@ else:
if USE_PRECOMPILED_EXTENSIONS
else cmake_build_ext,
}
if (
USE_PRECOMPILED_RUST_FRONTEND
or PRECOMPILED_RUST_FRONTEND_PATH.exists()
or has_precompiled_rust_extensions()
):
cmdclass["build_rust"] = precompiled_build_rust
# Resolve the Python version first because get_vllm_version() may set
# SETUPTOOLS_SCM_PRETEND_VERSION, which the Rust version should inherit.
# SETUPTOOLS_SCM_PRETEND_VERSION.
vllm_version = get_vllm_version()
rust_build.prepare_build_environment()
# Rust artifacts, built via setuptools-rust and installed into the package
# directory alongside the Python modules.
rust_extensions = rust_build.rust_extensions(
optional=not should_require_rust_frontend()
)
setup(
# static metadata should rather go in pyproject.toml
version=vllm_version,
ext_modules=ext_modules,
rust_extensions=rust_extensions,
install_requires=get_requirements(),
extras_require={
# AMD Zen CPU optimizations via zentorch