From 568874fec2e6070684ee1a0547fe720dcf7322b9 Mon Sep 17 00:00:00 2001 From: Divakar Verma <137818590+divakar-amd@users.noreply.github.com> Date: Tue, 23 Jun 2026 11:44:43 -0400 Subject: [PATCH] [ROCm][CI] pass merge-base to container for python-only wheel metadata (#45869) Signed-off-by: Divakar Verma Co-authored-by: Andreas Karatzas --- .../scripts/hardware_ci/run-amd-test.sh | 33 +++++++++++++++++ .buildkite/test_areas/misc.yaml | 10 +++++ tests/standalone_tests/python_only_compile.sh | 37 +++++++++++++++++-- 3 files changed, 76 insertions(+), 4 deletions(-) diff --git a/.buildkite/scripts/hardware_ci/run-amd-test.sh b/.buildkite/scripts/hardware_ci/run-amd-test.sh index 5c994e25d0..4a2a55f407 100755 --- a/.buildkite/scripts/hardware_ci/run-amd-test.sh +++ b/.buildkite/scripts/hardware_ci/run-amd-test.sh @@ -367,6 +367,20 @@ remove_docker_container() { } trap remove_docker_container EXIT +# python_only_compile.sh runs `python setup.py develop` and needs the full repo tree +# under /vllm-workspace (Dockerfile.rocm test stage: mkdir src && mv vllm). +# The ROCm wheel artifact tarball only ships a thin tree (tests, etc.), so +# artifact images cannot satisfy that test — use the full rocm/vllm-ci image. +_cmd_probe="${VLLM_TEST_COMMANDS:-}" +if [[ -z "${_cmd_probe}" ]]; then + _cmd_probe="$*" +fi +if [[ "${VLLM_CI_USE_ARTIFACTS:-0}" == "1" && "${_cmd_probe}" == *python_only_compile.sh* ]]; then + echo "INFO: disabling VLLM_CI_USE_ARTIFACTS for python_only_compile (requires full /vllm-workspace tree)" + export VLLM_CI_USE_ARTIFACTS=0 +fi +unset -v _cmd_probe + if ! prepare_artifact_image; then echo "Using full ROCm CI image: ${image_name}" docker pull "${image_name}" || exit 1 @@ -426,6 +440,24 @@ fi echo "Final commands: $commands" +# The ROCm test image often ships /vllm-workspace without .git (artifact tarball unpack). +# tests/standalone_tests/python_only_compile.sh uses merge-base(HEAD, origin/main) for +# wheels.vllm.ai; compute on the agent (full git checkout) and pass into the container. +vllm_standalone_merge_base="" +checkout="${BUILDKITE_BUILD_CHECKOUT_PATH:-}" +if [[ -z "${checkout}" || ! -d "${checkout}" ]]; then + checkout="." +fi +if git -C "${checkout}" rev-parse --is-inside-work-tree >/dev/null 2>&1; then + vllm_standalone_merge_base="$( + git -C "${checkout}" merge-base HEAD origin/main 2>/dev/null || true + )" +fi +if [[ -z "${vllm_standalone_merge_base}" ]]; then + vllm_standalone_merge_base="${BUILDKITE_COMMIT:-}" +fi +echo "INFO: passing VLLM_STANDALONE_MERGE_BASE into container: ${vllm_standalone_merge_base}" + MYPYTHONPATH="/vllm-workspace" container_job_id="${BUILDKITE_JOB_ID:-${BUILDKITE_PARALLEL_JOB:-0}}" @@ -525,6 +557,7 @@ else -e "VLLM_CACHE_ROOT=${CONTAINER_CACHE_ROOT}/vllm" \ -e "XDG_CACHE_HOME=${CONTAINER_CACHE_ROOT}/xdg" \ -e "PYTORCH_ROCM_ARCH=" \ + -e "VLLM_STANDALONE_MERGE_BASE=${vllm_standalone_merge_base}" \ --name "${container_name}" \ "${image_name}" \ /bin/bash -c "${CONTAINER_PREFLIGHT} && ${commands}" diff --git a/.buildkite/test_areas/misc.yaml b/.buildkite/test_areas/misc.yaml index 5c98006049..ca86639135 100644 --- a/.buildkite/test_areas/misc.yaml +++ b/.buildkite/test_areas/misc.yaml @@ -262,6 +262,16 @@ steps: - setup.py commands: - bash standalone_tests/python_only_compile.sh + mirror: + amd: + device: mi325_1 + timeout_in_minutes: 20 + depends_on: + - image-build-amd + source_file_dependencies: + - tests/standalone_tests/python_only_compile.sh + - setup.py + - vllm/platforms/rocm.py - label: Async Engine, Inputs, Utils, Worker device: h200_35gb diff --git a/tests/standalone_tests/python_only_compile.sh b/tests/standalone_tests/python_only_compile.sh index c189549d7d..ea9d2441ca 100644 --- a/tests/standalone_tests/python_only_compile.sh +++ b/tests/standalone_tests/python_only_compile.sh @@ -4,9 +4,26 @@ set -e -merge_base_commit=$(git merge-base HEAD origin/main) +# ROCm CI runs this script inside `run-amd-test.sh` where /vllm-workspace often has no .git +# (wheel artifact layout). The wrapper passes VLLM_STANDALONE_MERGE_BASE from the agent checkout. +merge_base_commit="" +if [[ -n "${VLLM_STANDALONE_MERGE_BASE:-}" ]]; then + merge_base_commit="${VLLM_STANDALONE_MERGE_BASE}" +elif merge_base_commit="$(git -C /vllm-workspace merge-base HEAD origin/main 2>/dev/null)"; then + : +elif merge_base_commit="$(git merge-base HEAD origin/main 2>/dev/null)"; then + : +else + echo "ERROR: need a git checkout or VLLM_STANDALONE_MERGE_BASE to resolve wheels.vllm.ai commit." >&2 + exit 1 +fi + echo "INFO: current merge base commit with main: $merge_base_commit" -git show --oneline -s "$merge_base_commit" +if git show --oneline -s "$merge_base_commit" 2>/dev/null; then + : +else + echo "INFO: git show unavailable in this environment; using SHA above for precompiled metadata." +fi # test whether the metadata.json url is valid, retry each 3 minutes up to 5 times # this avoids cumbersome error messages & manual retries in case the precompiled wheel @@ -59,7 +76,12 @@ cd /vllm-workspace/ # uninstall vllm pip3 uninstall -y vllm # restore the original files -mv src/vllm ./vllm +if [[ -d src/vllm ]]; then + mv src/vllm ./vllm +elif [[ ! -d vllm ]]; then + echo "ERROR: expected vllm package at /vllm-workspace/src/vllm or /vllm-workspace/vllm" >&2 + exit 1 +fi # remove all compilers apt remove --purge build-essential -y @@ -67,7 +89,14 @@ 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 . +# ROCm CI uses setuptools develop for editable installs (see Dockerfile.rocm and run-amd-test.sh). +_vllm_target_lower="$(printf '%s' "${VLLM_TARGET_DEVICE:-}" | tr '[:upper:]' '[:lower:]')" +if [[ "${_vllm_target_lower}" == "rocm" ]]; then + VLLM_PRECOMPILED_WHEEL_COMMIT=$merge_base_commit VLLM_USE_PRECOMPILED=1 python3 setup.py develop +else + VLLM_PRECOMPILED_WHEEL_COMMIT=$merge_base_commit VLLM_USE_PRECOMPILED=1 pip3 install -vvv -e . +fi +unset -v _vllm_target_lower # Run the script python3 -c 'import vllm'