Skip to content

Commit 96732fe

Browse files
authored
Merge branch 'main' into optimized-36539
2 parents eeecbb5 + 2c17d33 commit 96732fe

303 files changed

Lines changed: 9054 additions & 2365 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.buildkite/ci_config_rocm.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ run_all_patterns:
88
- "docker/docker-bake-rocm.hcl"
99
- ".buildkite/hardware_tests/amd.yaml"
1010
- ".buildkite/scripts/ci-bake-rocm.sh"
11+
- ".buildkite/scripts/rocm/"
1112
- ".buildkite/scripts/hardware_ci/run-amd-test.py"
1213
- ".buildkite/scripts/hardware_ci/run-amd-test.sh"
1314
- "CMakeLists.txt"

.buildkite/hardware_tests/amd.yaml

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,45 @@
11
group: Hardware - AMD Build
2+
3+
# ROCm image flow:
4+
# 1. Refresh the long-lived ROCm base image only when Dockerfile.rocm_base changes.
5+
# 2. Build ci_base from either the stable base or the freshly refreshed base.
6+
# 3. Build the per-commit ROCm CI image and smoke-test it before GPU jobs run.
27
steps:
8+
- label: "AMD: :docker: refresh ROCm base"
9+
key: refresh-rocm-base-amd
10+
depends_on: []
11+
device: amd_cpu
12+
no_plugin: true
13+
commands:
14+
- bash .buildkite/scripts/rocm/refresh-base-image.sh
15+
env:
16+
DOCKER_BUILDKIT: "1"
17+
BUILDKIT_PROGRESS: "tty"
18+
TERM: "xterm-256color"
19+
retry:
20+
automatic:
21+
- exit_status: -1 # Agent was lost
22+
limit: 1
23+
- exit_status: -10 # Agent was lost
24+
limit: 1
25+
326
# Ensure ci_base is up-to-date before building the test image.
427
# Compares a content hash of ci_base-affecting files against the remote
528
# image label. If hashes match the build is skipped (< 30 s); if they
629
# differ ci_base is rebuilt and pushed automatically.
730
- label: "AMD: :docker: ensure ci_base"
831
key: ensure-ci-base-amd
932
soft_fail: false
10-
depends_on: []
33+
depends_on:
34+
- refresh-rocm-base-amd
1135
device: amd_cpu
1236
no_plugin: true
1337
commands:
14-
- bash .buildkite/scripts/ci-bake-rocm.sh ci-base-rocm-ci-with-deps
38+
- bash .buildkite/scripts/rocm/build-ci-base.sh
1539
env:
1640
DOCKER_BUILDKIT: "1"
41+
BUILDKIT_PROGRESS: "tty"
42+
TERM: "xterm-256color"
1743
VLLM_BAKE_FILE: "docker/docker-bake-rocm.hcl"
1844
PYTORCH_ROCM_ARCH: "gfx90a;gfx942;gfx950"
1945
REMOTE_VLLM: "1"
@@ -33,35 +59,12 @@ steps:
3359
device: amd_cpu
3460
no_plugin: true
3561
commands:
36-
- |
37-
if [[ "${ROCM_CI_ARTIFACT_ONLY:-0}" == "1" ]]; then
38-
echo "ROCM_CI_ARTIFACT_ONLY=1; building ROCm wheel artifact only"
39-
IMAGE_TAG="" bash .buildkite/scripts/ci-bake-rocm.sh test-rocm-ci-with-artifacts
40-
else
41-
bash .buildkite/scripts/ci-bake-rocm.sh test-rocm-ci-with-wheel
42-
fi
43-
- |
44-
docker run --rm --network=none --entrypoint /bin/bash "rocm/vllm-ci:${BUILDKITE_COMMIT}" -ec '
45-
if [ ! -d /vllm-workspace ]; then echo Missing directory: /vllm-workspace >&2; exit 1; fi
46-
if [ ! -d /vllm-workspace/tests ]; then echo Missing directory: /vllm-workspace/tests >&2; exit 1; fi
47-
if [ ! -d /vllm-workspace/src/vllm ]; then echo Missing directory: /vllm-workspace/src/vllm >&2; exit 1; fi
48-
if [ ! -x /vllm-workspace/src/vllm/vllm-rs ]; then echo Missing executable: /vllm-workspace/src/vllm/vllm-rs >&2; exit 1; fi
49-
command -v python3
50-
command -v uv
51-
command -v pytest
52-
if ! command -v amd-smi >/dev/null 2>&1 && ! command -v rocminfo >/dev/null 2>&1; then
53-
echo No ROCm CLI found in image >&2
54-
exit 1
55-
fi
56-
python3 - <<PY
57-
import torch, vllm
58-
print(torch.__version__)
59-
print(vllm.__version__)
60-
PY
61-
echo AMD image smoke OK
62-
'
62+
- bash .buildkite/scripts/rocm/build-test-image.sh
63+
- bash .buildkite/scripts/rocm/smoke-test-image.sh
6364
env:
6465
DOCKER_BUILDKIT: "1"
66+
BUILDKIT_PROGRESS: "tty"
67+
TERM: "xterm-256color"
6568
VLLM_BAKE_FILE: "docker/docker-bake-rocm.hcl"
6669
PYTORCH_ROCM_ARCH: "gfx90a;gfx942;gfx950"
6770
IMAGE_TAG: "rocm/vllm-ci:$BUILDKITE_COMMIT"

.buildkite/scripts/ci-bake-rocm.sh

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ set -euo pipefail
1515

1616
DEFAULT_REPO_SLUG="vllm-project/vllm"
1717
DEFAULT_CI_HCL_SOURCE="docker/ci-rocm.hcl"
18-
DEFAULT_CI_BASE_CONTENT_FILES="requirements/common.txt requirements/rocm.txt requirements/test/rocm.txt docker/Dockerfile.rocm_base docker/ci-rocm.hcl docker/docker-bake-rocm.hcl tools/install_torchcodec_rocm.sh tests/vllm_test_utils .buildkite/scripts/ci-bake-rocm.sh"
18+
DEFAULT_CI_BASE_CONTENT_FILES="requirements/common.txt requirements/rocm.txt requirements/test/rocm.txt docker/Dockerfile.rocm_base docker/ci-rocm.hcl docker/docker-bake-rocm.hcl tools/install_torchcodec_rocm.sh tests/vllm_test_utils .buildkite/scripts/ci-bake-rocm.sh .buildkite/scripts/rocm/build-ci-base.sh"
1919
DEFAULT_CI_BASE_DOCKERFILE="docker/Dockerfile.rocm"
2020
DEFAULT_CI_BASE_DOCKERFILE_STAGES="base build_rixl build_rocshmem build_deepep mori_base ci_base"
2121
DEFAULT_CI_BASE_METADATA_VERSION="1"
@@ -393,6 +393,16 @@ should_upload_wheel_artifacts() {
393393
|| "${TARGET}" == *"artifact"* ]]
394394
}
395395

396+
set_buildkite_metadata() {
397+
local key="$1"
398+
local value="$2"
399+
400+
[[ -n "${value}" ]] || return 0
401+
if command -v buildkite-agent >/dev/null 2>&1; then
402+
buildkite-agent meta-data set "${key}" "${value}" || true
403+
fi
404+
}
405+
396406
get_remote_image_label() {
397407
local image_ref="$1"
398408
local label_key="$2"
@@ -733,6 +743,8 @@ configure_ci_base_image_refs() {
733743

734744
if is_ci_base_target; then
735745
IMAGE_TAG="${primary_tag}"
746+
CI_BASE_IMAGE="${primary_tag}"
747+
export CI_BASE_IMAGE
736748
export IMAGE_TAG
737749

738750
echo "ci_base primary image tag: ${CI_BASE_IMAGE_TAG}"
@@ -750,6 +762,10 @@ configure_ci_base_image_refs() {
750762
echo "ci_base stable alias will not be pushed for this build"
751763
echo "Set NIGHTLY=1 on ${CI_BASE_STABLE_BRANCH:-main} to refresh ${stable_tag}"
752764
fi
765+
set_buildkite_metadata "rocm-ci-base-image" "${CI_BASE_IMAGE_TAG}"
766+
set_buildkite_metadata "rocm-ci-base-image-content" "${content_tag}"
767+
set_buildkite_metadata "rocm-ci-base-image-commit" "${CI_BASE_IMAGE_TAG_COMMIT:-}"
768+
set_buildkite_metadata "rocm-ci-base-image-stable" "${CI_BASE_IMAGE_TAG_STABLE:-}"
753769
return 0
754770
fi
755771

@@ -1779,7 +1795,10 @@ seed_dependency_caches_if_needed() {
17791795

17801796
echo "--- :docker: Seeding ${target}"
17811797
echo "Expected cache ref: ${cache_ref}"
1782-
docker buildx bake "${BAKE_FILES[@]}" --progress plain "${target}"
1798+
docker buildx bake \
1799+
"${BAKE_FILES[@]}" \
1800+
--progress "${BUILDKIT_PROGRESS:-plain}" \
1801+
"${target}"
17831802
verify_dependency_cache_ref "${cache_ref}"
17841803
done
17851804
}
@@ -1807,7 +1826,10 @@ run_bake() {
18071826
local build_rc=0
18081827

18091828
echo "--- :docker: Building ${TARGET}"
1810-
docker buildx bake "${BAKE_FILES[@]}" --progress plain "${BAKE_TARGETS[@]}" || build_rc=$?
1829+
docker buildx bake \
1830+
"${BAKE_FILES[@]}" \
1831+
--progress "${BUILDKIT_PROGRESS:-plain}" \
1832+
"${BAKE_TARGETS[@]}" || build_rc=$?
18111833

18121834
if [[ ${build_rc} -eq 0 ]]; then
18131835
echo "--- :white_check_mark: Build complete"

.buildkite/scripts/hardware_ci/run-amd-test.sh

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,17 @@
2828
###############################################################################
2929
set -o pipefail
3030

31+
: "${BUILDKIT_PROGRESS:=plain}"
32+
: "${TERM:=xterm-256color}"
33+
: "${FORCE_COLOR:=1}"
34+
: "${CLICOLOR_FORCE:=1}"
35+
: "${PY_COLORS:=1}"
36+
: "${ROCM_DOCKER_TTY:=1}"
37+
if [[ " ${PYTEST_ADDOPTS:-} " != *" --color"* ]]; then
38+
PYTEST_ADDOPTS="${PYTEST_ADDOPTS:+${PYTEST_ADDOPTS} }--color=yes"
39+
fi
40+
export BUILDKIT_PROGRESS TERM FORCE_COLOR CLICOLOR_FORCE PY_COLORS PYTEST_ADDOPTS ROCM_DOCKER_TTY
41+
3142
# Export Python path for commands that run directly on the host. Containerized
3243
# tests set this to /vllm-workspace below so spawned Python processes do not
3344
# depend on their current working directory.
@@ -149,6 +160,7 @@ EOF
149160
echo "--- Building local ROCm test image"
150161
docker build \
151162
--pull=false \
163+
--progress "${BUILDKIT_PROGRESS}" \
152164
--build-arg "BASE_IMAGE=${base_image}" \
153165
-t "${artifact_image}" \
154166
"${context_dir}" || return 1
@@ -535,6 +547,13 @@ if is_multi_node "$commands"; then
535547
else
536548
echo "--- Single-node job"
537549
echo "Render devices: $BUILDKITE_AGENT_META_DATA_RENDER_DEVICES"
550+
docker_run_terminal_args=(-i)
551+
if [[ "${ROCM_DOCKER_TTY}" == "1" ]]; then
552+
docker_run_terminal_args+=(-t)
553+
echo "Docker interactive stdin: enabled; TTY allocation: enabled"
554+
else
555+
echo "Docker interactive stdin: enabled; TTY allocation: disabled"
556+
fi
538557

539558
ulimit_core_hard=$(ulimit -H -c)
540559
if [[ "$ulimit_core_hard" == "unlimited" ]]; then
@@ -551,7 +570,7 @@ else
551570
fi
552571

553572
docker run \
554-
-t -i \
573+
"${docker_run_terminal_args[@]}" \
555574
--device /dev/kfd $BUILDKITE_AGENT_META_DATA_RENDER_DEVICES \
556575
$RDMA_FLAGS \
557576
--network=host \
@@ -566,6 +585,11 @@ else
566585
-e AWS_SECRET_ACCESS_KEY \
567586
-e BUILDKITE_PARALLEL_JOB \
568587
-e BUILDKITE_PARALLEL_JOB_COUNT \
588+
-e TERM \
589+
-e FORCE_COLOR \
590+
-e CLICOLOR_FORCE \
591+
-e PY_COLORS \
592+
-e PYTEST_ADDOPTS \
569593
-v "${HF_CACHE}:${HF_MOUNT}" \
570594
-e "HF_HOME=${HF_MOUNT}" \
571595
-e "PYTHONPATH=${MYPYTHONPATH}" \
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
# Build the ROCm ci_base image, optionally from a freshly rebuilt ROCm base.
3+
4+
set -euo pipefail
5+
6+
metadata_get() {
7+
local key="$1"
8+
if command -v buildkite-agent >/dev/null 2>&1; then
9+
buildkite-agent meta-data get "${key}" 2>/dev/null || true
10+
fi
11+
}
12+
13+
main() {
14+
local base_refreshed=""
15+
16+
base_refreshed="$(metadata_get rocm-base-refresh)"
17+
if [[ "${base_refreshed}" == "1" ]]; then
18+
export BASE_IMAGE
19+
export CI_BASE_PUSH_STABLE_TAG
20+
21+
BASE_IMAGE="$(metadata_get rocm-base-image)"
22+
CI_BASE_PUSH_STABLE_TAG="$(metadata_get rocm-base-push-stable-tag)"
23+
CI_BASE_PUSH_STABLE_TAG="${CI_BASE_PUSH_STABLE_TAG:-0}"
24+
25+
echo "Using refreshed ROCm base image for ci_base: ${BASE_IMAGE}"
26+
echo "Push stable ci_base tag: ${CI_BASE_PUSH_STABLE_TAG}"
27+
fi
28+
29+
bash .buildkite/scripts/ci-bake-rocm.sh ci-base-rocm-ci-with-deps
30+
}
31+
32+
main "$@"
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/usr/bin/env bash
2+
# Build the ROCm CI test image or wheel artifact.
3+
#
4+
# When Dockerfile.rocm_base changes, always build the full image so downstream
5+
# ROCm tests can validate the freshly rebuilt base -> ci_base -> ci image chain.
6+
7+
set -euo pipefail
8+
9+
metadata_get() {
10+
local key="$1"
11+
if command -v buildkite-agent >/dev/null 2>&1; then
12+
buildkite-agent meta-data get "${key}" 2>/dev/null || true
13+
fi
14+
}
15+
16+
use_refreshed_base_if_present() {
17+
local base_refreshed=""
18+
19+
base_refreshed="$(metadata_get rocm-base-refresh)"
20+
if [[ "${base_refreshed}" != "1" ]]; then
21+
return 1
22+
fi
23+
24+
export BASE_IMAGE
25+
export CI_BASE_IMAGE
26+
export IMAGE_TAG_LATEST
27+
28+
BASE_IMAGE="$(metadata_get rocm-base-image)"
29+
CI_BASE_IMAGE="$(metadata_get rocm-ci-base-image)"
30+
IMAGE_TAG_LATEST="$(metadata_get rocm-ci-image-descriptive)"
31+
32+
echo "Using refreshed ROCm base image for test image: ${BASE_IMAGE}"
33+
echo "Using refreshed ROCm ci_base image for test image: ${CI_BASE_IMAGE}"
34+
if [[ -n "${IMAGE_TAG_LATEST}" ]]; then
35+
echo "Also tagging full ROCm CI image as: ${IMAGE_TAG_LATEST}"
36+
fi
37+
38+
return 0
39+
}
40+
41+
main() {
42+
local base_refreshed=0
43+
44+
if use_refreshed_base_if_present; then
45+
base_refreshed=1
46+
fi
47+
48+
if [[ "${ROCM_CI_ARTIFACT_ONLY:-0}" == "1" && "${base_refreshed}" != "1" ]]; then
49+
echo "ROCM_CI_ARTIFACT_ONLY=1; building ROCm wheel artifact only"
50+
IMAGE_TAG="" bash .buildkite/scripts/ci-bake-rocm.sh test-rocm-ci-with-artifacts
51+
return
52+
fi
53+
54+
bash .buildkite/scripts/ci-bake-rocm.sh test-rocm-ci-with-wheel
55+
}
56+
57+
main "$@"

0 commit comments

Comments
 (0)