From a11d8ac66002f08300271f69a5936f3d216dcfeb Mon Sep 17 00:00:00 2001 From: Shengqi Chen Date: Wed, 3 Dec 2025 10:42:00 +0800 Subject: [PATCH 1/5] ci: use merge-base commit to download wheels in docker image build and python-only build test Signed-off-by: Shengqi Chen --- docker/Dockerfile | 3 +++ setup.py | 19 +++++++++++-------- tests/standalone_tests/python_only_compile.sh | 6 +++++- vllm/envs.py | 6 ------ 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 006481b23cb9..4f691c681346 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -193,6 +193,7 @@ ARG SCCACHE_S3_NO_CREDENTIALS=0 # Flag to control whether to use pre-built vLLM wheels ARG VLLM_USE_PRECOMPILED="" +ARG VLLM_MERGE_BASE_COMMIT="" ARG VLLM_MAIN_CUDA_VERSION="" # if USE_SCCACHE is set, use sccache to speed up compilation @@ -211,6 +212,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \ && export SCCACHE_IDLE_TIMEOUT=0 \ && export CMAKE_BUILD_TYPE=Release \ && export VLLM_USE_PRECOMPILED="${VLLM_USE_PRECOMPILED}" \ + && export VLLM_PRECOMPILED_WHEEL_COMMIT="${VLLM_MERGE_BASE_COMMIT}" \ && export VLLM_MAIN_CUDA_VERSION="${VLLM_MAIN_CUDA_VERSION}" \ && export VLLM_DOCKER_BUILD_CONTEXT=1 \ && sccache --show-stats \ @@ -229,6 +231,7 @@ RUN --mount=type=cache,target=/root/.cache/ccache \ rm -rf .deps && \ mkdir -p .deps && \ export VLLM_USE_PRECOMPILED="${VLLM_USE_PRECOMPILED}" && \ + export VLLM_PRECOMPILED_WHEEL_COMMIT="${VLLM_MERGE_BASE_COMMIT}" && \ export VLLM_DOCKER_BUILD_CONTEXT=1 && \ python3 setup.py bdist_wheel --dist-dir=dist --py-limited-api=cp38; \ fi diff --git a/setup.py b/setup.py index 5b7d12bb373e..b7dd210cc645 100644 --- a/setup.py +++ b/setup.py @@ -346,10 +346,13 @@ def determine_wheel_url() -> tuple[str, str | None]: The order of preference is: 1. user-specified wheel location (can be either local or remote, via VLLM_PRECOMPILED_WHEEL_LOCATION) - 2. user-specified variant from nightly repo (current main commit via - VLLM_PRECOMPILED_WHEEL_VARIANT) + 2. user-specified variant (VLLM_PRECOMPILED_WHEEL_VARIANT) from nightly repo 3. the variant corresponding to VLLM_MAIN_CUDA_VERSION from nightly repo - 4. the default variant from nightly repo (current main commit) + 4. the default variant from nightly repo + + If downloading from the nightly repo, the commit can be specified via + VLLM_PRECOMPILED_WHEEL_COMMIT; otherwise, the head commit in the main branch + is used. """ wheel_location = os.getenv("VLLM_PRECOMPILED_WHEEL_LOCATION", None) if wheel_location is not None: @@ -364,8 +367,11 @@ def determine_wheel_url() -> tuple[str, str | None]: variant = os.getenv("VLLM_PRECOMPILED_WHEEL_VARIANT", main_variant) commit = os.getenv( "VLLM_PRECOMPILED_WHEEL_COMMIT", - precompiled_wheel_utils.get_base_commit_in_main_branch(), - ) + "" + ).lower() + if not commit or len(commit) != 40: + print(f"VLLM_PRECOMPILED_WHEEL_COMMIT not valid: {commit}, fetching base commit") + commit = precompiled_wheel_utils.get_base_commit_in_main_branch() print(f"Using precompiled wheel commit {commit} with variant {variant}") try_default = False wheels, repo_url, download_filename = None, None, None @@ -494,9 +500,6 @@ def extract_precompiled_and_patch_package( @staticmethod def get_base_commit_in_main_branch() -> str: - # Force to use the nightly wheel. This is mainly used for CI testing. - if envs.VLLM_TEST_USE_PRECOMPILED_NIGHTLY_WHEEL: - return "nightly" try: # Get the latest commit hash of the upstream main branch. diff --git a/tests/standalone_tests/python_only_compile.sh b/tests/standalone_tests/python_only_compile.sh index 7cc5ef659649..f78e4785636b 100644 --- a/tests/standalone_tests/python_only_compile.sh +++ b/tests/standalone_tests/python_only_compile.sh @@ -5,6 +5,10 @@ set -e set -x +merge_base_commit=$(git merge-base HEAD origin/main) +echo "Current merge base commit with main: $merge_base_commit" +git show --oneline -s $merge_base_commit + cd /vllm-workspace/ # uninstall vllm @@ -18,7 +22,7 @@ apt autoremove -y echo 'import os; os.system("touch /tmp/changed.file")' >> vllm/__init__.py -VLLM_TEST_USE_PRECOMPILED_NIGHTLY_WHEEL=1 VLLM_USE_PRECOMPILED=1 pip3 install -vvv -e . +VLLM_PRECOMPILED_WHEEL_COMMIT=$(merge_base_commit) VLLM_USE_PRECOMPILED=1 pip3 install -vvv -e . # Run the script python3 -c 'import vllm' diff --git a/vllm/envs.py b/vllm/envs.py index 8b954fa14f28..d325da411093 100755 --- a/vllm/envs.py +++ b/vllm/envs.py @@ -79,7 +79,6 @@ NVCC_THREADS: str | None = None VLLM_USE_PRECOMPILED: bool = False VLLM_DOCKER_BUILD_CONTEXT: bool = False - VLLM_TEST_USE_PRECOMPILED_NIGHTLY_WHEEL: bool = False VLLM_KEEP_ALIVE_ON_ENGINE_DEATH: bool = False CMAKE_BUILD_TYPE: Literal["Debug", "Release", "RelWithDebInfo"] | None = None VERBOSE: bool = False @@ -468,11 +467,6 @@ def get_vllm_port() -> int | None: .strip() .lower() in ("1", "true"), - # Whether to force using nightly wheel in python build. - # This is used for testing the nightly wheel in python build. - "VLLM_TEST_USE_PRECOMPILED_NIGHTLY_WHEEL": lambda: bool( - int(os.getenv("VLLM_TEST_USE_PRECOMPILED_NIGHTLY_WHEEL", "0")) - ), # CMake build type # If not set, defaults to "Debug" or "RelWithDebInfo" # Available options: "Debug", "Release", "RelWithDebInfo" From 755d8536f73aa5ffa6e229ab762ac409f01641a4 Mon Sep 17 00:00:00 2001 From: Shengqi Chen Date: Wed, 3 Dec 2025 10:42:27 +0800 Subject: [PATCH 2/5] ci: remove outdated script files Signed-off-by: Shengqi Chen --- .buildkite/generate_index.py | 46 ------------------------------------ 1 file changed, 46 deletions(-) delete mode 100644 .buildkite/generate_index.py diff --git a/.buildkite/generate_index.py b/.buildkite/generate_index.py deleted file mode 100644 index bbed80ebe847..000000000000 --- a/.buildkite/generate_index.py +++ /dev/null @@ -1,46 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 -# SPDX-FileCopyrightText: Copyright contributors to the vLLM project - -import argparse -import os - -template = """ - - -

Links for vLLM

- {x86_wheel}
- {arm_wheel}
- - -""" - -parser = argparse.ArgumentParser() -parser.add_argument("--wheel", help="The wheel path.", required=True) -args = parser.parse_args() - -filename = os.path.basename(args.wheel) - -with open("index.html", "w") as f: - print(f"Generated index.html for {args.wheel}") - # sync the abi tag with .buildkite/scripts/upload-wheels.sh - if "x86_64" in filename: - x86_wheel = filename - arm_wheel = filename.replace("x86_64", "aarch64").replace( - "manylinux1", "manylinux2014" - ) - elif "aarch64" in filename: - x86_wheel = filename.replace("aarch64", "x86_64").replace( - "manylinux2014", "manylinux1" - ) - arm_wheel = filename - else: - raise ValueError(f"Unsupported wheel: {filename}") - # cloudfront requires escaping the '+' character - f.write( - template.format( - x86_wheel=x86_wheel, - x86_wheel_html_escaped=x86_wheel.replace("+", "%2B"), - arm_wheel=arm_wheel, - arm_wheel_html_escaped=arm_wheel.replace("+", "%2B"), - ) - ) From 6d4beaef221fe8f0551e77808cd5a3d64542ba1d Mon Sep 17 00:00:00 2001 From: Shengqi Chen Date: Wed, 3 Dec 2025 11:05:57 +0800 Subject: [PATCH 3/5] chore: run ruff format Signed-off-by: Shengqi Chen --- setup.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index b7dd210cc645..9fa4a40b5409 100644 --- a/setup.py +++ b/setup.py @@ -365,12 +365,11 @@ def determine_wheel_url() -> tuple[str, str | None]: # try to fetch the wheel metadata from the nightly wheel repo main_variant = "cu" + envs.VLLM_MAIN_CUDA_VERSION.replace(".", "") variant = os.getenv("VLLM_PRECOMPILED_WHEEL_VARIANT", main_variant) - commit = os.getenv( - "VLLM_PRECOMPILED_WHEEL_COMMIT", - "" - ).lower() + commit = os.getenv("VLLM_PRECOMPILED_WHEEL_COMMIT", "").lower() if not commit or len(commit) != 40: - print(f"VLLM_PRECOMPILED_WHEEL_COMMIT not valid: {commit}, fetching base commit") + print( + f"VLLM_PRECOMPILED_WHEEL_COMMIT not valid: {commit}, fetching base commit" + ) commit = precompiled_wheel_utils.get_base_commit_in_main_branch() print(f"Using precompiled wheel commit {commit} with variant {variant}") try_default = False @@ -500,7 +499,6 @@ def extract_precompiled_and_patch_package( @staticmethod def get_base_commit_in_main_branch() -> str: - try: # Get the latest commit hash of the upstream main branch. resp_json = subprocess.check_output( From 94a9e40aa917178cd7e4020f76cf84ed70043e61 Mon Sep 17 00:00:00 2001 From: Shengqi Chen Date: Wed, 3 Dec 2025 11:07:31 +0800 Subject: [PATCH 4/5] fix: apply comments from gemini code Signed-off-by: Shengqi Chen --- tests/standalone_tests/python_only_compile.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/standalone_tests/python_only_compile.sh b/tests/standalone_tests/python_only_compile.sh index f78e4785636b..d29b9afcc6fb 100644 --- a/tests/standalone_tests/python_only_compile.sh +++ b/tests/standalone_tests/python_only_compile.sh @@ -22,7 +22,7 @@ apt autoremove -y echo 'import os; os.system("touch /tmp/changed.file")' >> vllm/__init__.py -VLLM_PRECOMPILED_WHEEL_COMMIT=$(merge_base_commit) VLLM_USE_PRECOMPILED=1 pip3 install -vvv -e . +VLLM_PRECOMPILED_WHEEL_COMMIT=$merge_base_commit VLLM_USE_PRECOMPILED=1 pip3 install -vvv -e . # Run the script python3 -c 'import vllm' From f8d5a83b2f7958b0c2403aa9f6506e62c8b2e857 Mon Sep 17 00:00:00 2001 From: Shengqi Chen Date: Wed, 3 Dec 2025 11:12:05 +0800 Subject: [PATCH 5/5] chore: add more comments in setup.py Signed-off-by: Shengqi Chen --- setup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 9fa4a40b5409..db1558fd8ae7 100644 --- a/setup.py +++ b/setup.py @@ -368,7 +368,8 @@ def determine_wheel_url() -> tuple[str, str | None]: commit = os.getenv("VLLM_PRECOMPILED_WHEEL_COMMIT", "").lower() if not commit or len(commit) != 40: print( - f"VLLM_PRECOMPILED_WHEEL_COMMIT not valid: {commit}, fetching base commit" + f"VLLM_PRECOMPILED_WHEEL_COMMIT not valid: {commit}" + ", trying to fetch base commit in main branch" ) commit = precompiled_wheel_utils.get_base_commit_in_main_branch() print(f"Using precompiled wheel commit {commit} with variant {variant}") @@ -509,6 +510,7 @@ def get_base_commit_in_main_branch() -> str: ] ).decode("utf-8") upstream_main_commit = json.loads(resp_json)["sha"] + print(f"Upstream main branch latest commit: {upstream_main_commit}") # In Docker build context, .git may be immutable or missing. if envs.VLLM_DOCKER_BUILD_CONTEXT: