Compare commits

...
1 Commits
Author SHA1 Message Date
Chinmay KulkarniandCursor 3a7e5f7dcf [ZenCPU] Minimal zen image build on x86 premerge queue
Add the zen CPU docker image build (docker/Dockerfile.zen +
image_build_zen_cpu.sh) and an image-build-zen-cpu step pinned to the
small_cpu_queue_premerge queue, with no source_file_dependencies so it
always runs, to confirm the zen image builds on the generic x86 build
queue. Also drop the stale vllm-openai-zen reference from
docker/Dockerfile.cpu.

Image-build only: the zen5 hardware test and its runner are intentionally
excluded from this confirmation PR.

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Chinmay Kulkarni <Chinmay.Kulkarni@amd.com>
2026-07-20 09:17:52 -06:00
4 changed files with 171 additions and 17 deletions
+23
View File
@@ -81,6 +81,29 @@ steps:
- exit_status: -10 # Agent was lost
limit: 2
- label: ":docker: Build Zen CPU image"
key: image-build-zen-cpu
# Minimal confirmation build: run the zen image build on the generic x86
# premerge queue to verify it succeeds. Reuses the shared `-cpu` image as its
# base, so it must run after the CPU image build.
#
# No source_file_dependencies: this step always runs for this validation PR
# so the build is exercised regardless of which files changed.
depends_on:
- image-build-cpu
agents:
queue: small_cpu_queue_premerge
commands:
- .buildkite/image_build/image_build_zen_cpu.sh $REGISTRY $REPO $BUILDKITE_COMMIT
env:
DOCKER_BUILDKIT: "1"
retry:
automatic:
- exit_status: -1 # Agent was lost
limit: 2
- exit_status: -10 # Agent was lost
limit: 2
- label: ":docker: Build HPU image"
soft_fail: true
depends_on: []
+51
View File
@@ -0,0 +1,51 @@
#!/bin/bash
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
#
# Build the AMD Zen CPU image (vLLM + zentorch) as a two-step layered build:
# 1. a CPU base image (vLLM installed) built from docker/Dockerfile.cpu
# 2. docker/Dockerfile.zen --target vllm-zen-test -> zen image on top
#
# The image is (re)built from source every time, mirroring
# .buildkite/scripts/hardware_ci/run-cpu-test.sh. It is not pushed to a registry.
#
# See docker/Dockerfile.zen for the build workflow this mirrors.
set -e
if [[ $# -lt 3 ]]; then
echo "Usage: $0 <registry> <repo> <commit>"
exit 1
fi
REGISTRY=$1
REPO=$2
BUILDKITE_COMMIT=$3
# Local image tags (not pushed).
BASE_IMAGE="$REGISTRY/$REPO:$BUILDKITE_COMMIT-cpu-base-for-zen"
IMAGE="$REGISTRY/$REPO:$BUILDKITE_COMMIT-zen-cpu"
# ZENTORCH_VERSION is optional; when unset the Dockerfile falls back to
# installing zentorch via `vllm[zen]`.
ZENTORCH_VERSION=${ZENTORCH_VERSION:-}
# Step 1: build the CPU base image that Dockerfile.zen layers on.
echo "--- :docker: Building CPU base image"
docker build --file docker/Dockerfile.cpu \
--platform linux/amd64 \
--build-arg max_jobs=16 \
--build-arg buildkite_commit="$BUILDKITE_COMMIT" \
--build-arg VLLM_CPU_X86=true \
--tag "$BASE_IMAGE" \
--target vllm-openai \
--progress plain .
# Step 2: build the zen test image on top of the CPU base.
echo "--- :docker: Building Zen test image"
docker build --file docker/Dockerfile.zen \
--platform linux/amd64 \
--build-arg BASE_IMAGE="$BASE_IMAGE" \
${ZENTORCH_VERSION:+--build-arg ZENTORCH_VERSION="$ZENTORCH_VERSION"} \
--tag "$IMAGE" \
--target vllm-zen-test \
--progress plain .
-17
View File
@@ -9,7 +9,6 @@
#
# Build targets:
# vllm-openai (default): used for serving deployment
# vllm-openai-zen: vLLM from source + zentorch from PyPI via vllm[zen]
# vllm-test: used for CI tests
# vllm-dev: used for development
#
@@ -305,19 +304,3 @@ LABEL ai.vllm.build.python-version="${PYTHON_VERSION:-3.12}"
COPY examples examples
ENTRYPOINT ["vllm", "serve"]
######################### ZEN CPU PYPI IMAGE #########################
FROM vllm-openai AS vllm-openai-zen
ARG TARGETARCH
RUN if [ "$TARGETARCH" != "amd64" ]; then \
echo "ERROR: vllm-openai-amd only supports --platform=linux/amd64"; \
exit 1; \
fi
RUN --mount=type=cache,target=/root/.cache/uv \
uv pip install "vllm[zen]"
ENTRYPOINT ["vllm", "serve"]
+97
View File
@@ -0,0 +1,97 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# This Dockerfile builds AMD Zen CPU images for vLLM with zentorch.
# It layers on top of the CPU image produced by docker/Dockerfile.cpu.
#
# Supported platforms:
# - linux/amd64 (Zen2 and newer; Zen5 is the canonical CI target)
#
# Build targets:
# vllm-openai-zen (default): vLLM + zentorch for serving
# vllm-zen-test : vllm-openai-zen + test deps for CI
#
# Build workflow (see .buildkite/image_build/image_build_zen_cpu.sh):
# 1. Obtain a CPU base image that already has vLLM installed. In CI this is the
# shared `<repo>:<commit>-cpu` image (docker/Dockerfile.cpu --target
# vllm-test); either the vllm-test or vllm-openai target works as the base
# since both install vLLM into the same venv this stage extends.
# 2. docker build -f docker/Dockerfile.zen --build-arg BASE_IMAGE=<base>:<tag> \
# --target vllm-zen-test -t <out>:<tag> .
ARG BASE_IMAGE
ARG PYTHON_VERSION=3.12
ARG ZENTORCH_VERSION
######################### ZEN OPENAI IMAGE #########################
FROM ${BASE_IMAGE} AS vllm-openai-zen
ARG TARGETARCH
ARG ZENTORCH_VERSION
RUN if [ "${TARGETARCH}" != "amd64" ]; then \
echo "ERROR: Dockerfile.zen requires --platform=linux/amd64"; \
exit 1; \
fi
WORKDIR /vllm-workspace
RUN --mount=type=cache,target=/root/.cache/uv \
if [ -n "${ZENTORCH_VERSION}" ]; then \
uv pip install "zentorch==${ZENTORCH_VERSION}"; \
else \
uv pip install "vllm[zen]"; \
fi
LABEL org.opencontainers.image.title="vLLM Zen CPU"
LABEL org.opencontainers.image.description="vLLM with zentorch for AMD Zen CPUs"
LABEL org.opencontainers.image.vendor="vLLM Project"
LABEL org.opencontainers.image.source="https://github.com/vllm-project/vllm"
LABEL ai.vllm.build.target-arch="${TARGETARCH}"
LABEL ai.vllm.build.python-version="${PYTHON_VERSION}"
LABEL ai.vllm.build.zentorch-version="${ZENTORCH_VERSION:-unpinned}"
ENTRYPOINT ["vllm", "serve"]
######################### ZEN TEST IMAGE #########################
FROM vllm-openai-zen AS vllm-zen-test
WORKDIR /vllm-workspace
COPY requirements/test/cuda.in requirements/test/zen.in
RUN sed -i '/mamba_ssm/d' requirements/test/zen.in && \
sed -i 's/^torch==.*/torch==2.11.0/g' requirements/test/zen.in && \
sed -i 's/torchaudio.*/torchaudio/g' requirements/test/zen.in && \
sed -i 's/torchvision.*/torchvision/g' requirements/test/zen.in && \
# zentorch parity: keep sentence-transformers pinned where vllm-test-deps did.
sed -i 's/^sentence-transformers.*/sentence-transformers==5.3.0/g' requirements/test/zen.in && \
uv pip compile requirements/test/zen.in \
-o requirements/test/zen.txt \
--index-strategy unsafe-best-match --torch-backend cpu
RUN --mount=type=cache,target=/root/.cache/uv \
uv pip install -r requirements/test/zen.txt
# Reassert zentorch's torch in case test-deps moved it.
RUN --mount=type=cache,target=/root/.cache/uv \
if [ -n "${ZENTORCH_VERSION}" ]; then \
uv pip install --force-reinstall --no-deps "zentorch==${ZENTORCH_VERSION}"; \
else \
uv pip install --force-reinstall --no-deps "vllm[zen]"; \
fi
ADD ./tests/ ./tests/
ADD ./examples/ ./examples/
ADD ./benchmarks/ ./benchmarks/
ADD ./vllm/collect_env.py .
ADD ./docker/ ./docker/
ADD ./.buildkite/ ./.buildkite/
RUN --mount=type=cache,target=/root/.cache/uv \
uv pip install -e tests/vllm_test_utils
ENV HF_XET_HIGH_PERFORMANCE=1
ENV HF_HUB_DOWNLOAD_TIMEOUT=60
ENTRYPOINT []