diff --git a/.buildkite/release-pipeline.yaml b/.buildkite/release-pipeline.yaml index 4c7186e247..7b9cac7b52 100644 --- a/.buildkite/release-pipeline.yaml +++ b/.buildkite/release-pipeline.yaml @@ -164,7 +164,21 @@ steps: env: DOCKER_BUILDKIT: "1" - - label: "Publish XPU Triton shim index" + - label: "Build wheel - x86_64 - XPU" + depends_on: ~ + id: build-wheel-x86-xpu + agents: + queue: cpu_queue_release + commands: + - "DOCKER_BUILDKIT=1 docker build --build-arg max_jobs=16 --build-arg GIT_REPO_CHECK=1 --tag vllm-ci:build-image --target vllm-build --progress plain -f docker/Dockerfile.xpu ." + - "mkdir artifacts" + - "docker run --rm -v $(pwd)/artifacts:/artifacts_host vllm-ci:build-image bash -c 'cp -r dist /artifacts_host && chmod -R a+rw /artifacts_host'" + - "bash .buildkite/scripts/upload-nightly-wheels.sh" + - 'bash .buildkite/scripts/annotate-build-artifact.sh "$$BUILDKITE_LABEL" "s3://vllm-wheels/$$BUILDKITE_COMMIT/$(cd artifacts/dist && echo *.whl)" release-wheels' + env: + DOCKER_BUILDKIT: "1" + + - label: "Publish and stage XPU Triton shim" key: publish-xpu-triton-shim depends_on: ~ agents: diff --git a/.buildkite/scripts/generate-and-upload-nightly-index.sh b/.buildkite/scripts/generate-and-upload-nightly-index.sh index 1fa75994c0..ee13f31688 100755 --- a/.buildkite/scripts/generate-and-upload-nightly-index.sh +++ b/.buildkite/scripts/generate-and-upload-nightly-index.sh @@ -53,11 +53,10 @@ if [[ "${UPDATE_NIGHTLY_INDEX:-1}" == "1" && \ aws s3 cp --recursive "$INDICES_OUTPUT_DIR/" "s3://$BUCKET/nightly/" fi -# detect version from any wheel in the commit directory -# download the first wheel we find to extract version metadata -first_wheel_key=$($PYTHON -c "import json; obj=json.load(open('$obj_json')); print(next((c['Key'] for c in obj.get('Contents', []) if c['Key'].endswith('.whl')), ''))") +# detect version from a vLLM wheel in the commit directory +first_wheel_key=$($PYTHON -c "import json; obj=json.load(open('$obj_json')); print(next((c['Key'] for c in obj.get('Contents', []) if c['Key'].rsplit('/', 1)[-1].startswith('vllm-') and c['Key'].endswith('.whl')), ''))") if [[ -z "$first_wheel_key" ]]; then - echo "Error: No wheels found in $S3_COMMIT_PREFIX" + echo "Error: No vLLM wheel found in $S3_COMMIT_PREFIX" exit 1 fi first_wheel=$(basename "$first_wheel_key") diff --git a/.buildkite/scripts/generate-nightly-index.py b/.buildkite/scripts/generate-nightly-index.py index 9397825bdd..67adf9c92b 100644 --- a/.buildkite/scripts/generate-nightly-index.py +++ b/.buildkite/scripts/generate-nightly-index.py @@ -91,9 +91,9 @@ def parse_from_filename(file: str) -> WheelFileInfo: else: if "+" in version: version_part, suffix = version.split("+", 1) - # Only treat known patterns as variants (rocmXXX, cuXXX, cpu) + # Only treat known patterns as variants (rocmXXX, cuXXX, cpu, xpu) # Git hashes and other suffixes are NOT variants - if suffix.startswith(("rocm", "cu", "cpu")): + if suffix.startswith(("rocm", "cu", "cpu", "xpu")): variant = suffix version = version_part # Otherwise keep the full version string (variant stays None) @@ -429,7 +429,11 @@ if __name__ == "__main__": if PY_VERSION_RE.match(version): # upload-wheels.sh ensures no "dev" is in args.version wheel_files = list( - filter(lambda x: version in x and "dev" not in x, wheel_files) + filter( + lambda x: (version in x and "dev" not in x) + or (x.startswith("triton-") and "+xpu-" in x), + wheel_files, + ) ) print(f"Non-nightly version detected, wheel files used: {wheel_files}") else: diff --git a/.buildkite/scripts/xpu/publish-triton-shim.sh b/.buildkite/scripts/xpu/publish-triton-shim.sh index d85a95a5b4..099b8d9749 100644 --- a/.buildkite/scripts/xpu/publish-triton-shim.sh +++ b/.buildkite/scripts/xpu/publish-triton-shim.sh @@ -11,12 +11,17 @@ readonly WHEEL_SHA256="3c822f73e9870512f59a6ecf5dc305a4bcab11fa623f9ce91011f6043 readonly WHEEL_FILENAME="${WHEEL_URL##*/}" readonly ENCODED_WHEEL_FILENAME="${WHEEL_FILENAME/+/%2B}" readonly S3_PREFIX="s3://${BUCKET}/${PREFIX}/" +readonly COMMIT="${BUILDKITE_COMMIT:-}" readonly DRY_RUN="${DRY_RUN:-0}" if [[ "$DRY_RUN" != "0" && "$DRY_RUN" != "1" ]]; then echo "DRY_RUN must be 0 or 1" >&2 exit 2 fi +if [[ "$DRY_RUN" == "0" && ! "$COMMIT" =~ ^[0-9a-f]{40}$ ]]; then + echo "BUILDKITE_COMMIT must be a full lowercase commit hash" >&2 + exit 2 +fi cd "$(dirname "${BASH_SOURCE[0]}")/../../.." @@ -70,9 +75,9 @@ sed 's/import regex as re/import re/' \ # shellcheck disable=SC2086 $PYTHON "$index_generator" \ --version "$PREFIX" \ - --wheel-dir "$PREFIX" \ + --wheel-dir "$work_dir/$PREFIX" \ --current-objects "$objects_path" \ - --output-dir "$index_output_dir" \ + --output-dir "$work_dir" \ --comment "XPU Triton shim" grep -Fq 'href="triton/"' "$index_output_dir/index.html" @@ -87,4 +92,7 @@ if [[ "$DRY_RUN" == "1" ]]; then else aws s3 cp --recursive "$index_output_dir/" "$S3_PREFIX" echo "Published XPU Triton shim index to https://wheels.vllm.ai/$PREFIX/" -fi \ No newline at end of file + aws s3 cp "$S3_PREFIX$WHEEL_FILENAME" \ + "s3://$BUCKET/$COMMIT/$WHEEL_FILENAME" + echo "Staged XPU Triton shim for https://wheels.vllm.ai/$COMMIT/xpu/" +fi diff --git a/docker/Dockerfile.xpu b/docker/Dockerfile.xpu index 1b847d2167..31efca6241 100644 --- a/docker/Dockerfile.xpu +++ b/docker/Dockerfile.xpu @@ -129,6 +129,35 @@ CMD ["/bin/bash"] ######################### UCX + NIXL BUILD STAGE ######################### # Build UCX and NIXL in a dedicated stage so compiler/autotools layers are # never included in the final runtime image (mirrors ROCm's build_rixl stage). +######################### WHEEL BUILD STAGE ######################### +# Produces a standalone dist/*.whl artifact (used by the release pipeline's +# "Build wheel - XPU" step), independent of the runtime image below. +FROM vllm-base AS vllm-build + +ARG GIT_REPO_CHECK=0 + +RUN --mount=type=cache,target=/root/.cache/uv \ + --mount=type=bind,src=requirements/common.txt,target=/workspace/vllm/requirements/common.txt \ + --mount=type=bind,src=requirements/xpu.txt,target=/workspace/vllm/requirements/xpu.txt \ + uv pip install grpcio-tools protobuf nanobind && \ + uv pip install -r /workspace/vllm/requirements/xpu.txt + +# Keep source-dependent layers near the end so frequent code-only changes +# don't invalidate heavy dependency layers. +COPY . . + +# Drop the pre-built Rust artifacts into the source tree. setup.py detects +# them and ships them as-is, skipping the local Rust build. +COPY --from=rust-build /workspace/vllm/vllm-rs vllm/vllm-rs +COPY --from=rust-build /workspace/vllm/_rust_*.so vllm/ + +RUN --mount=type=bind,source=.git,target=.git \ + if [ "$GIT_REPO_CHECK" != 0 ]; then bash tools/check_repo.sh; fi + +RUN --mount=type=cache,target=/root/.cache/uv \ + --mount=type=bind,source=.git,target=.git \ + VLLM_TARGET_DEVICE=xpu python3 setup.py bdist_wheel --dist-dir=dist --py-limited-api=cp38 + FROM vllm-base AS ucx-nixl-build ARG UCX_VERSION=v1.21.0-rc2 @@ -201,9 +230,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \ --mount=type=bind,src=requirements/test/xpu.txt,target=/workspace/vllm/requirements/test/xpu.txt \ uv pip install grpcio-tools protobuf nanobind && \ uv pip install -r /workspace/vllm/requirements/xpu.txt && \ - uv pip install --no-build-isolation -r /workspace/vllm/requirements/test/xpu.txt && \ - uv pip uninstall triton triton-xpu && \ - uv pip install triton-xpu==3.7.2 + uv pip install --no-build-isolation -r /workspace/vllm/requirements/test/xpu.txt # Keep source-dependent layers near the end so frequent code-only changes # don't invalidate heavy dependency and UCX/NIXL layers. diff --git a/docs/getting_started/installation/gpu.xpu.inc.md b/docs/getting_started/installation/gpu.xpu.inc.md index ef207c8d83..84dc69ca84 100644 --- a/docs/getting_started/installation/gpu.xpu.inc.md +++ b/docs/getting_started/installation/gpu.xpu.inc.md @@ -20,7 +20,26 @@ There is no extra information on creating a new Python environment for this devi --8<-- [end:set-up-using-python] --8<-- [start:pre-built-wheels] -Currently, there are no pre-built XPU wheels. +Pre-built vLLM XPU wheels are published to `wheels.vllm.ai`. Each XPU wheel +index also contains the `triton==3.7.2+xpu` shim described below. PyTorch XPU +packages are served from the PyTorch XPU index, so both index URLs are needed. + +#### Install the latest code + +To install the wheel built from the latest main branch: + +```bash +uv pip install vllm --extra-index-url https://wheels.vllm.ai/nightly/xpu --extra-index-url https://download.pytorch.org/whl/xpu --index-strategy unsafe-best-match +``` + +#### Install specific revisions + +If you want to access the wheels for previous commits (e.g. to bisect the behavior change, performance regression), you can specify the commit hash in the URL: + +```bash +export VLLM_COMMIT=730bd35378bf2a5b56b6d3a45be28b3092d26519 # use full commit hash from the main branch +uv pip install vllm --extra-index-url https://wheels.vllm.ai/${VLLM_COMMIT}/xpu --extra-index-url https://download.pytorch.org/whl/xpu --index-strategy unsafe-best-match +``` --8<-- [end:pre-built-wheels] --8<-- [start:build-wheel-from-source] @@ -36,25 +55,24 @@ pip install --upgrade pip pip install -v -r requirements/xpu.txt ``` -- Then, install the correct Triton package for Intel XPU. - - The default `triton` package (for NVIDIA GPUs) may be installed as a transitive dependency (e.g., via `xgrammar`). For Intel XPU, you must replace it with `triton-xpu`: - - ```bash - pip uninstall -y triton triton-xpu - pip install triton-xpu==3.7.2 --extra-index-url https://download.pytorch.org/whl/xpu - ``` - - !!! note - - `triton` (without suffix) is for NVIDIA GPUs only. On XPU, using it instead of `triton-xpu` can cause correctness or runtime issues. - - For torch 2.13 (the version used in `requirements/xpu.txt`), the matching package is `triton-xpu==3.7.2`. If you use a different version of torch, check the corresponding `triton-xpu` version in [docker/Dockerfile.xpu](https://github.com/vllm-project/vllm/blob/main/docker/Dockerfile.xpu). - -- Finally, build and install vLLM XPU backend: +- Then, install vLLM XPU backend: ```bash VLLM_TARGET_DEVICE=xpu pip install --no-build-isolation -e . -v ``` +!!! note + `requirements/xpu.txt` pins `triton==3.7.2+xpu`, a compatibility shim + hosted on `https://wheels.vllm.ai/xpu` that transparently resolves to + the real Intel XPU implementation (`triton-xpu`). This exists because + some transitive dependencies (e.g. `xgrammar`) unconditionally + require a distribution literally named `triton`, which otherwise + resolves to the NVIDIA-only PyPI `triton` package on XPU and can + cause correctness or runtime issues. No manual uninstall/reinstall of + `triton`/`triton-xpu` is needed; both `pip install` and `uv pip + install --index-strategy unsafe-best-match` resolve the correct + package automatically. + --8<-- [end:build-wheel-from-source] --8<-- [start:pre-built-images]