[CI/Build][CPU] Fix flaky rust downloads, broken prune flag, and triton-cpu cache coupling (#56247)
Signed-off-by: jiang1.li <jiang1.li@intel.com>
This commit is contained in:
+60
-49
@@ -105,6 +105,60 @@ ENV UV_HTTP_TIMEOUT=500
|
||||
ENV UV_INDEX_STRATEGY="unsafe-best-match"
|
||||
ENV UV_LINK_MODE="copy"
|
||||
|
||||
ENV TARGETARCH=${TARGETARCH}
|
||||
|
||||
######################### TRITON-CPU BUILD IMAGE #########################
|
||||
# Branches off base-common directly (before requirements/cpu.txt is installed
|
||||
# below) so a torch/etc. version bump doesn't invalidate this stage's cache --
|
||||
# it builds triton-cpu in an isolated `uv build` environment and never touches
|
||||
# these packages.
|
||||
FROM base-common AS vllm-triton-cpu-build
|
||||
|
||||
# Support for cross-compilation with x86 ISA including AVX2 and AVX512: docker build --build-arg VLLM_CPU_X86="true" ...
|
||||
# Re-declared here because this stage is `FROM base-common` (not `vllm-build`),
|
||||
# so it does not inherit the ARG/ENV defined there. Without it, the guard
|
||||
# below would see an empty value and build triton-cpu on non-x86 targets
|
||||
# (e.g. arm64).
|
||||
ARG VLLM_CPU_X86=0
|
||||
|
||||
ARG USE_SCCACHE
|
||||
ARG SCCACHE_ENDPOINT
|
||||
ARG SCCACHE_LOCAL_ONLY=0
|
||||
|
||||
WORKDIR /vllm-workspace
|
||||
|
||||
RUN mkdir dist
|
||||
|
||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||
--mount=type=cache,target=/root/.cache/ccache \
|
||||
--mount=type=cache,target=/root/.cache/sccache-local,sharing=locked \
|
||||
--mount=type=cache,target=/vllm-workspace/.deps,sharing=locked \
|
||||
--mount=type=cache,target=/root/.triton \
|
||||
--mount=type=secret,id=aws-credentials,target=/root/.aws/credentials,required=false \
|
||||
set -ex; \
|
||||
if [ "$TARGETARCH" = "amd64" ] || [ "$VLLM_CPU_X86" != "0" ]; then \
|
||||
git clone --recurse-submodules --shallow-submodules --filter=blob:none "https://github.com/triton-lang/triton-cpu.git"; \
|
||||
cd triton-cpu; \
|
||||
git checkout "270e696d"; \
|
||||
if [ "$USE_SCCACHE" = "1" ]; then \
|
||||
if [ "$SCCACHE_LOCAL_ONLY" = "1" ]; then \
|
||||
unset SCCACHE_BUCKET SCCACHE_REGION; \
|
||||
export SCCACHE_DIR=/root/.cache/sccache-local SCCACHE_CACHE_SIZE=20G; \
|
||||
elif [ -n "${SCCACHE_ENDPOINT}" ]; then \
|
||||
export SCCACHE_ENDPOINT="${SCCACHE_ENDPOINT}"; \
|
||||
fi; \
|
||||
export TRITON_APPEND_CMAKE_ARGS="-DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache"; \
|
||||
sccache --show-stats; \
|
||||
fi; \
|
||||
uv build --wheel --out-dir=../dist; \
|
||||
if [ "$USE_SCCACHE" = "1" ]; then sccache --show-stats; fi; \
|
||||
cd ..; \
|
||||
rm -rf triton-cpu; \
|
||||
fi
|
||||
|
||||
######################### COMMON BASE IMAGE + PYTHON DEPS #########################
|
||||
FROM base-common AS base-common-pydeps
|
||||
|
||||
# PyTorch provides its own indexes for standard and nightly builds.
|
||||
# PYTORCH_NIGHTLY=1 builds the CPU image against torch nightly (parity with the
|
||||
# GPU torch-nightly lane); default 0 keeps the pinned release CPU build.
|
||||
@@ -133,15 +187,13 @@ RUN --mount=type=cache,target=/root/.cache/uv \
|
||||
uv pip install -r requirements/cpu.txt --torch-backend cpu; \
|
||||
fi
|
||||
|
||||
ENV TARGETARCH=${TARGETARCH}
|
||||
|
||||
######################### x86_64 BASE IMAGE #########################
|
||||
FROM base-common AS base-amd64
|
||||
FROM base-common-pydeps AS base-amd64
|
||||
|
||||
ENV LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4:/opt/venv/lib/libiomp5.so"
|
||||
|
||||
######################### arm64 BASE IMAGE #########################
|
||||
FROM base-common AS base-arm64
|
||||
FROM base-common-pydeps AS base-arm64
|
||||
|
||||
ENV LD_PRELOAD="/usr/lib/aarch64-linux-gnu/libtcmalloc_minimal.so.4"
|
||||
|
||||
@@ -210,6 +262,10 @@ RUN --mount=type=cache,target=/root/.cargo/registry,sharing=locked \
|
||||
SETUPTOOLS_SCM_PRETEND_VERSION="0.0.0+docker.cache" bash build_rust.sh && \
|
||||
if [ "$USE_SCCACHE" = "1" ]; then sccache --show-stats; fi
|
||||
|
||||
# build_rust.sh installed rustup here via rustup.rs; put it on PATH so the
|
||||
# child stage below finds it on disk instead of re-downloading it.
|
||||
ENV PATH="/root/.cargo/bin:${PATH}"
|
||||
|
||||
# Relink with the exact Git-derived package version.
|
||||
FROM rust-build-cache AS rust-build
|
||||
|
||||
@@ -308,51 +364,6 @@ RUN --mount=type=cache,target=/root/.cache/uv \
|
||||
VLLM_TARGET_DEVICE=cpu python3 setup.py bdist_wheel --dist-dir=dist --py-limited-api=cp38 && \
|
||||
if [ "$USE_SCCACHE" = "1" ]; then sccache --show-stats; fi
|
||||
|
||||
######################### TRITON-CPU BUILD IMAGE #########################
|
||||
FROM base-arch AS vllm-triton-cpu-build
|
||||
|
||||
# Support for cross-compilation with x86 ISA including AVX2 and AVX512: docker build --build-arg VLLM_CPU_X86="true" ...
|
||||
# Re-declared here because this stage is `FROM base-arch` (not `vllm-build`),
|
||||
# so it does not inherit the ARG/ENV defined there. Without it, the guard
|
||||
# below would see an empty value and build triton-cpu on non-x86 targets
|
||||
# (e.g. arm64).
|
||||
ARG VLLM_CPU_X86=0
|
||||
|
||||
ARG USE_SCCACHE
|
||||
ARG SCCACHE_ENDPOINT
|
||||
ARG SCCACHE_LOCAL_ONLY=0
|
||||
|
||||
WORKDIR /vllm-workspace
|
||||
|
||||
RUN mkdir dist
|
||||
|
||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||
--mount=type=cache,target=/root/.cache/ccache \
|
||||
--mount=type=cache,target=/root/.cache/sccache-local,sharing=locked \
|
||||
--mount=type=cache,target=/vllm-workspace/.deps,sharing=locked \
|
||||
--mount=type=cache,target=/root/.triton \
|
||||
--mount=type=secret,id=aws-credentials,target=/root/.aws/credentials,required=false \
|
||||
set -ex; \
|
||||
if [ "$TARGETARCH" = "amd64" ] || [ "$VLLM_CPU_X86" != "0" ]; then \
|
||||
git clone --recurse-submodules --shallow-submodules --filter=blob:none "https://github.com/triton-lang/triton-cpu.git"; \
|
||||
cd triton-cpu; \
|
||||
git checkout "270e696d"; \
|
||||
if [ "$USE_SCCACHE" = "1" ]; then \
|
||||
if [ "$SCCACHE_LOCAL_ONLY" = "1" ]; then \
|
||||
unset SCCACHE_BUCKET SCCACHE_REGION; \
|
||||
export SCCACHE_DIR=/root/.cache/sccache-local SCCACHE_CACHE_SIZE=20G; \
|
||||
elif [ -n "${SCCACHE_ENDPOINT}" ]; then \
|
||||
export SCCACHE_ENDPOINT="${SCCACHE_ENDPOINT}"; \
|
||||
fi; \
|
||||
export TRITON_APPEND_CMAKE_ARGS="-DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache"; \
|
||||
sccache --show-stats; \
|
||||
fi; \
|
||||
uv build --wheel --out-dir=../dist; \
|
||||
if [ "$USE_SCCACHE" = "1" ]; then sccache --show-stats; fi; \
|
||||
cd ..; \
|
||||
rm -rf triton-cpu; \
|
||||
fi
|
||||
|
||||
######################### TEST DEPS #########################
|
||||
FROM base-arch AS vllm-test-deps
|
||||
|
||||
|
||||
Reference in New Issue
Block a user