A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 15, 21:00 UTC
[Build] Make sure local main branch is synced when VLLM_USE_PRECOMPILED=1 (#13921)
Signed-off-by: Cody Yu <hao.yu.cody@gmail.com>
Cody Yu committed
Mar 3, 2025 at 00:43 UTC
f35f8e2242db224a92a14e084d502eec67d56da9
3 files changed
+35
-3
setup.py
+27
-1
@@ -2,6 +2,7 @@
2
3
import ctypes
4
import importlib.util
5
+import json
6
import logging
7
import os
8
import re
@@ -269,9 +270,32 @@ class repackage_wheel(build_ext):
270
"""Extracts libraries and other files from an existing wheel."""
271
272
def get_base_commit_in_main_branch(self) -> str:
272
- import subprocess
273
+ # Force to use the nightly wheel. This is mainly used for CI testing.
274
+ if envs.VLLM_TEST_USE_PRECOMPILED_NIGHTLY_WHEEL:
275
+ return "nightly"
276
277
try:
278
+ # Get the latest commit hash of the upstream main branch.
279
+ resp_json = subprocess.check_output([
280
+ "curl", "-s",
281
+ "https://api.github.com/repos/vllm-project/vllm/commits/main"
282
+ ]).decode("utf-8")
283
+ upstream_main_commit = json.loads(resp_json)["sha"]
284
+
285
+ # Check if the local main branch is up-to-date. This is to ensure
286
+ # the base commit we found is the most recent commit on the main
287
+ # branch.
288
+ local_main_commit = subprocess.check_output(
289
+ ["git", "rev-parse", "main"]).decode("utf-8").strip()
290
+ if local_main_commit != upstream_main_commit:
291
+ raise ValueError(
292
+ f"Local main branch ({local_main_commit}) is not "
293
+ "up-to-date with upstream main branch "
294
+ f"({upstream_main_commit}). Please pull the latest "
295
+ "changes from upstream main branch first.")
296
+
297
+ # Then get the commit hash of the current branch that is the same as
298
+ # the upstream main commit.
299
current_branch = subprocess.check_output(
300
["git", "branch", "--show-current"]).decode("utf-8").strip()
301
@@ -279,6 +303,8 @@ class repackage_wheel(build_ext):
303
["git", "merge-base", "main",
304
current_branch]).decode("utf-8").strip()
305
return base_commit
306
+ except ValueError as err:
307
+ raise ValueError(err) from None
308
except Exception as err:
309
logger.warning(
310
"Failed to get the base commit in the main branch. "
tests/standalone_tests/python_only_compile.sh
+1
-1
@@ -18,7 +18,7 @@ apt autoremove -y
18
19
echo 'import os; os.system("touch /tmp/changed.file")' >> vllm/__init__.py
20
21
-VLLM_USE_PRECOMPILED=1 pip3 install -vvv -e .
21
+VLLM_TEST_USE_PRECOMPILED_NIGHTLY_WHEEL=1 VLLM_USE_PRECOMPILED=1 pip3 install -vvv -e .
22
23
# Run the script
24
python3 -c 'import vllm'
vllm/envs.py
+7
-1
@@ -60,12 +60,12 @@ if TYPE_CHECKING:
60
MAX_JOBS: Optional[str] = None
61
NVCC_THREADS: Optional[str] = None
62
VLLM_USE_PRECOMPILED: bool = False
63
+ VLLM_TEST_USE_PRECOMPILED_NIGHTLY_WHEEL: bool = False
64
VLLM_NO_DEPRECATION_WARNING: bool = False
65
VLLM_KEEP_ALIVE_ON_ENGINE_DEATH: bool = False
66
CMAKE_BUILD_TYPE: Optional[str] = None
67
VERBOSE: bool = False
68
VLLM_ALLOW_LONG_MAX_MODEL_LEN: bool = False
68
- VLLM_TEST_FORCE_FP8_MARLIN: bool = False
69
VLLM_RPC_TIMEOUT: int = 10000 # ms
70
VLLM_PLUGINS: Optional[list[str]] = None
71
VLLM_TORCH_PROFILER_DIR: Optional[str] = None
@@ -148,6 +148,12 @@ environment_variables: dict[str, Callable[[], Any]] = {
148
lambda: bool(os.environ.get("VLLM_USE_PRECOMPILED")) or bool(
149
os.environ.get("VLLM_PRECOMPILED_WHEEL_LOCATION")),
150
151
+ # Whether to force using nightly wheel in python build.
152
+ # This is used for testing the nightly wheel in python build.
153
+ "VLLM_TEST_USE_PRECOMPILED_NIGHTLY_WHEEL":
154
+ lambda: bool(int(os.getenv("VLLM_TEST_USE_PRECOMPILED_NIGHTLY_WHEEL", "0"))
155
+ ),
156
+
157
# CMake build type
158
# If not set, defaults to "Debug" or "RelWithDebInfo"
159
# Available options: "Debug", "Release", "RelWithDebInfo"