@@ -261,6 +261,8 @@ validate_native_workspace() {
261261}
262262
263263prepare_native_workspace () {
264+ local test_commands=" ${1:- } "
265+
264266 if [[ " ${VLLM_CI_USE_ARTIFACTS:- 0} " != " 1" ]]; then
265267 echo " Native CI requires VLLM_CI_USE_ARTIFACTS=1"
266268 return 1
@@ -281,6 +283,8 @@ prepare_native_workspace() {
281283 local recorded_base=" "
282284 local recorded_commit=" "
283285 local recorded_wheel=" "
286+ local checkout=" "
287+ local checkout_commit=" "
284288 local workspace_dir=" ${VLLM_CI_WORKSPACE:-/ vllm-workspace} "
285289 local wheel_dir=" "
286290 local attempt=0
@@ -400,6 +404,53 @@ prepare_native_workspace() {
400404 return 1
401405 fi
402406
407+ # The ROCm artifact intentionally contains only the installed wheel and the
408+ # test workspace. The Python-only compilation job also needs setup.py and the
409+ # vllm source tree, so overlay the matching Buildkite checkout for that job.
410+ if [[ " ${test_commands} " == * python_only_compile.sh* ]]; then
411+ checkout=" ${BUILDKITE_BUILD_CHECKOUT_PATH:- } "
412+ if [[ -z " ${checkout} " || ! -d " ${checkout} " ]]; then
413+ echo " Python-only native CI requires BUILDKITE_BUILD_CHECKOUT_PATH" >&2
414+ return 1
415+ fi
416+ if ! git -c " safe.directory=${checkout} " -C " ${checkout} " \
417+ rev-parse --is-inside-work-tree > /dev/null 2>&1 ; then
418+ echo " Buildkite checkout is not a Git worktree: ${checkout} " >&2
419+ return 1
420+ fi
421+ checkout_commit=$(
422+ git -c " safe.directory=${checkout} " -C " ${checkout} " rev-parse HEAD
423+ ) || return 1
424+ if [[ " ${checkout_commit} " != " ${recorded_commit} " ]]; then
425+ echo " Buildkite checkout ${checkout_commit} does not match ROCm artifact ${recorded_commit} " >&2
426+ return 1
427+ fi
428+
429+ # setup.py normally derives this from .git via setuptools-scm. The native
430+ # source overlay deliberately excludes Git metadata, so preserve the exact
431+ # version from the already installed, artifact-matched wheel.
432+ VLLM_VERSION_OVERRIDE=$(
433+ python3 -c ' import importlib.metadata as m; print(m.version("vllm"))'
434+ ) || return 1
435+ export VLLM_VERSION_OVERRIDE
436+ VLLM_PRECOMPILED_WHEEL_LOCATION=" ${wheels[0]} "
437+ export VLLM_PRECOMPILED_WHEEL_LOCATION
438+ echo " INFO: native Python-only wheel=${VLLM_PRECOMPILED_WHEEL_LOCATION} "
439+
440+ echo " --- Overlaying full source checkout for Python-only compilation"
441+ # Archive the verified commit instead of copying the worktree so dirty or
442+ # untracked agent files cannot contaminate the artifact-matched workspace.
443+ git -c " safe.directory=${checkout} " -C " ${checkout} " \
444+ archive --format=tar " ${recorded_commit} " \
445+ | tar --no-same-owner -C " ${workspace_dir} " -xf - || return 1
446+ for required_source in setup.py pyproject.toml vllm; do
447+ if [[ ! -e " ${workspace_dir} /${required_source} " ]]; then
448+ echo " Full source checkout is missing ${required_source} " >&2
449+ return 1
450+ fi
451+ done
452+ fi
453+
403454 return 0
404455}
405456
@@ -434,6 +485,12 @@ initialize_native_environment() {
434485 TIKTOKEN_RS_CACHE_DIR=" ${HF_HOME} /tiktoken-rs-cache"
435486 : " ${HF_HUB_DOWNLOAD_TIMEOUT:= 300} "
436487 : " ${HF_HUB_ETAG_TIMEOUT:= 60} "
488+ if [[ " ${VLLM_CI_EXPECTED_GPU_COUNT:- 1} " == " 0" ]]; then
489+ # CPU-only native jobs intentionally reuse the ROCm wheel. Make that target
490+ # explicit so platform selection does not depend on wheel metadata.
491+ VLLM_TARGET_DEVICE=cpu
492+ export VLLM_TARGET_DEVICE
493+ fi
437494 export TMPDIR VLLM_RPC_BASE_PATH
438495 export TORCHINDUCTOR_CACHE_DIR TRITON_CACHE_DIR VLLM_CACHE_ROOT XDG_CACHE_HOME
439496 export HF_HOME HF_DATASETS_CACHE HF_HUB_DOWNLOAD_TIMEOUT HF_HUB_ETAG_TIMEOUT
@@ -948,7 +1005,13 @@ if is_native_runtime; then
9481005 echo " Failed to initialize the native test environment"
9491006 exit 1
9501007 fi
951- if ! prepare_native_workspace; then
1008+ if [[ " ${commands} " == * python_only_compile.sh* ]]; then
1009+ # This no-GPU job validates the ROCm precompiled/editable install path,
1010+ # rather than CPU runtime platform selection.
1011+ VLLM_TARGET_DEVICE=rocm
1012+ export VLLM_TARGET_DEVICE
1013+ fi
1014+ if ! prepare_native_workspace " ${commands} " ; then
9521015 echo " Failed to prepare native test workspace"
9531016 exit 1
9541017 fi
0 commit comments