diff --git a/.buildkite/hardware_tests/cpu.yaml b/.buildkite/hardware_tests/cpu.yaml index ba8fd497c39..931f4daec08 100644 --- a/.buildkite/hardware_tests/cpu.yaml +++ b/.buildkite/hardware_tests/cpu.yaml @@ -22,6 +22,21 @@ steps: pytest -x -v -s tests/kernels/test_onednn.py pytest -x -v -s tests/kernels/test_awq_int4_to_int8.py" +- label: AMD-CPU-Kernel Tests + depends_on: [] + soft_fail: false + device: amd_zen_cpu + no_plugin: true + source_file_dependencies: + - vllm/model_executor/layers/utils.py + - vllm/platforms/zen_cpu.py + - vllm/platforms/__init__.py + - tests/model_executor/test_cpu_unquantized_gemm_dispatch.py + commands: + - | + bash .buildkite/scripts/hardware_ci/run-amd-cpu-test.sh 20m " + pytest -x -v -s tests/model_executor/test_cpu_unquantized_gemm_dispatch.py" + - label: CPU-Compatibility Tests depends_on: [] device: intel_cpu @@ -35,6 +50,23 @@ steps: bash .buildkite/scripts/hardware_ci/run-cpu-test.sh 20m " bash .buildkite/scripts/hardware_ci/run-cpu-compatibility-test.sh" +- label: AMD-CPU-Compatibility Tests + depends_on: [] + soft_fail: false + device: amd_zen_cpu + no_plugin: true + source_file_dependencies: + - setup.py + - vllm/platforms/cpu.py + - vllm/platforms/zen_cpu.py + - vllm/platforms/interface.py + - vllm/platforms/__init__.py + - tests/test_zen_cpu_platform_detection.py + commands: + - | + bash .buildkite/scripts/hardware_ci/run-amd-cpu-test.sh 20m " + pytest -x -v -s tests/test_zen_cpu_platform_detection.py" + - label: CPU-Language Generation and Pooling Model Tests depends_on: [] device: intel_cpu @@ -50,6 +82,27 @@ steps: pytest -x -v -s tests/models/language/generation -m cpu_model pytest -x -v -s tests/models/language/pooling -m cpu_model" +- label: AMD-CPU-Language Generation and Pooling Model Tests + depends_on: [] + soft_fail: false + device: amd_zen_cpu + no_plugin: true + source_file_dependencies: + - vllm/model_executor/layers/utils.py + - vllm/platforms/zen_cpu.py + - vllm/platforms/__init__.py + - setup.py + - vllm/platforms/cpu.py + - vllm/platforms/interface.py + - vllm/v1/worker/cpu_model_runner.py + - tests/models/language/generation/ + - tests/models/language/pooling/ + commands: + - | + bash .buildkite/scripts/hardware_ci/run-amd-cpu-test.sh 30m " + pytest -x -v -s tests/models/language/generation -m cpu_model + pytest -x -v -s tests/models/language/pooling -m cpu_model" + - label: CPU-Quantization Model Tests depends_on: [] device: intel_cpu @@ -98,6 +151,26 @@ steps: bash .buildkite/scripts/hardware_ci/run-cpu-test.sh 10m " bash .buildkite/scripts/hardware_ci/run-cpu-distributed-smoke-test.sh dp_tp" +- label: AMD-CPU-Distributed Tests + depends_on: [] + soft_fail: false + device: amd_zen_cpu + no_plugin: true + source_file_dependencies: + - csrc/cpu/shm.cpp + - vllm/v1/worker/cpu_worker.py + - vllm/v1/worker/gpu_worker.py + - vllm/v1/worker/cpu_model_runner.py + - vllm/v1/worker/gpu_model_runner.py + - vllm/platforms/cpu.py + - vllm/platforms/zen_cpu.py + - vllm/distributed/parallel_state.py + - vllm/distributed/device_communicators/cpu_communicator.py + commands: + - | + bash .buildkite/scripts/hardware_ci/run-amd-cpu-test.sh 10m " + bash .buildkite/scripts/hardware_ci/run-cpu-distributed-smoke-test.sh" + - label: CPU-Multi-Modal Model Tests %N depends_on: [] device: intel_cpu diff --git a/.buildkite/image_build/image_build.yaml b/.buildkite/image_build/image_build.yaml index 42eaed7ddaa..a1ba5173628 100644 --- a/.buildkite/image_build/image_build.yaml +++ b/.buildkite/image_build/image_build.yaml @@ -27,6 +27,21 @@ steps: - exit_status: -10 # Agent was lost limit: 2 + - label: ":docker: Build AMD CPU image" + soft_fail: true + key: image-build-amd-cpu + depends_on: [] + commands: + - .buildkite/image_build/image_build_amd_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: [] diff --git a/.buildkite/image_build/image_build_amd_cpu.sh b/.buildkite/image_build/image_build_amd_cpu.sh new file mode 100644 index 00000000000..ee9cdec163b --- /dev/null +++ b/.buildkite/image_build/image_build_amd_cpu.sh @@ -0,0 +1,34 @@ +#!/bin/bash +set -e + +if [[ $# -lt 3 ]]; then + echo "Usage: $0 " + exit 1 +fi + +REGISTRY=$1 +REPO=$2 +BUILDKITE_COMMIT=$3 + +# authenticate with AWS ECR +aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin "$REGISTRY" + +# skip build if image already exists +if [[ -z $(docker manifest inspect "$REGISTRY"/"$REPO":"$BUILDKITE_COMMIT"-amd-cpu) ]]; then + echo "Image not found, proceeding with build..." +else + echo "Image found" + exit 0 +fi + +# build +docker build --file docker/Dockerfile.cpu \ + --build-arg max_jobs=16 \ + --build-arg buildkite_commit="$BUILDKITE_COMMIT" \ + --build-arg VLLM_CPU_X86=true \ + --tag "$REGISTRY"/"$REPO":"$BUILDKITE_COMMIT"-amd-cpu \ + --target vllm-zen-test \ + --progress plain . + +# push +docker push "$REGISTRY"/"$REPO":"$BUILDKITE_COMMIT"-amd-cpu diff --git a/.buildkite/scripts/hardware_ci/run-amd-cpu-test.sh b/.buildkite/scripts/hardware_ci/run-amd-cpu-test.sh new file mode 100644 index 00000000000..1047fe611e8 --- /dev/null +++ b/.buildkite/scripts/hardware_ci/run-amd-cpu-test.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# This script build the CPU docker image and run the offline inference inside the container. +# It serves a sanity check for compilation and basic model usage. +set -euox pipefail + +# allow to bind to different cores +CORE_RANGE=${CORE_RANGE:-48-95} +NUMA_NODE=${NUMA_NODE:-1} +IMAGE_NAME="cpu-test-$NUMA_NODE" +TIMEOUT_VAL=$1 +TEST_COMMAND=$2 + +# building the docker image +echo "--- :docker: Building Docker image" +docker build --progress plain --tag "$IMAGE_NAME" --target vllm-zen-test -f docker/Dockerfile.cpu . + +# Run the image, setting --shm-size=4g for tensor parallel. +docker run --rm --cpuset-cpus="$CORE_RANGE" --cpuset-mems="$NUMA_NODE" -v ~/.cache/huggingface:/root/.cache/huggingface --privileged=true -e HF_TOKEN -e VLLM_CPU_KVCACHE_SPACE=16 -e VLLM_CPU_CI_ENV=1 -e VLLM_CPU_SIM_MULTI_NUMA=1 --shm-size=4g "$IMAGE_NAME" \ + timeout "$TIMEOUT_VAL" bash -c "set -euox pipefail; echo \"--- Print packages\"; pip list; echo \"--- Running tests\"; ${TEST_COMMAND}" diff --git a/docker/Dockerfile.cpu b/docker/Dockerfile.cpu index d15ced8e011..04553a71710 100644 --- a/docker/Dockerfile.cpu +++ b/docker/Dockerfile.cpu @@ -250,3 +250,22 @@ RUN --mount=type=cache,target=/root/.cache/uv \ uv pip install "vllm[zen]" ENTRYPOINT ["vllm", "serve"] + +######################### ZEN CPU TEST IMAGE ######################### +FROM vllm-openai-zen AS vllm-zen-test + +COPY --from=vllm-test-deps /vllm-workspace/requirements/cpu-test.txt requirements/test.txt + +RUN --mount=type=cache,target=/root/.cache/uv \ + uv pip install -r requirements/test.txt + +ADD ./tests/ ./tests/ +ADD ./examples/ ./examples/ +ADD ./benchmarks/ ./benchmarks/ +ADD ./vllm/collect_env.py . +ADD ./.buildkite/ ./.buildkite/ + +RUN --mount=type=cache,target=/root/.cache/uv \ + uv pip install -e tests/vllm_test_utils + +ENTRYPOINT [] diff --git a/tests/models/language/generation/test_common.py b/tests/models/language/generation/test_common.py index 6e5f1e32843..dbec7dc13cc 100644 --- a/tests/models/language/generation/test_common.py +++ b/tests/models/language/generation/test_common.py @@ -42,6 +42,11 @@ AITER_MODEL_LIST = [ pytest.mark.core_model, pytest.mark.slow_test, pytest.mark.cpu_model, + pytest.mark.skipif( + current_platform.is_zen_cpu(), + reason="bloom-560m ALiBi is currently not supported on\ + AMD Zen CPUs due to lack of support for float16 compute.", + ), ], ), pytest.param( diff --git a/tests/models/language/pooling/test_reward.py b/tests/models/language/pooling/test_reward.py index 22e0539a989..4fd002af5d4 100644 --- a/tests/models/language/pooling/test_reward.py +++ b/tests/models/language/pooling/test_reward.py @@ -88,7 +88,15 @@ def load_reward_outputs(filename: "StrPath") -> list[list[float]]: [ pytest.param( "Qwen/Qwen2.5-Math-PRM-7B", - marks=[pytest.mark.core_model, pytest.mark.cpu_model], + marks=[ + pytest.mark.core_model, + pytest.mark.cpu_model, + pytest.mark.skipif( + current_platform.is_zen_cpu(), + reason="Qwen2.5-Math-PRM-7B is currently not supported on\ + AMD Zen CPUs due to lack of support for float16 compute.", + ) + ], ), ], ) @@ -131,7 +139,15 @@ def test_prm_models( [ pytest.param( "Qwen/Qwen2.5-Math-PRM-7B", - marks=[pytest.mark.core_model, pytest.mark.cpu_model], + marks=[ + pytest.mark.core_model, + pytest.mark.cpu_model, + pytest.mark.skipif( + current_platform.is_zen_cpu(), + reason="Qwen2.5-Math-PRM-7B is currently not supported on\ + AMD Zen CPUs due to lack of support for float16 compute.", + ) + ], ), ], )