[Refactor] Move auxiliary files out of the repository root (#58572)
Signed-off-by: mgoin <mgoin64@gmail.com>
This commit is contained in:
+19
-19
@@ -207,7 +207,7 @@ ARG PYTORCH_NIGHTLY
|
||||
# Check whether to install torch nightly instead of release for this build
|
||||
COPY requirements/common.txt requirements/common.txt
|
||||
COPY requirements/cuda.txt requirements/cuda.txt
|
||||
COPY use_existing_torch.py use_existing_torch.py
|
||||
COPY tools/use_existing_torch.py tools/use_existing_torch.py
|
||||
COPY pyproject.toml pyproject.toml
|
||||
RUN --mount=type=cache,target=/opt/uv/cache \
|
||||
--mount=type=bind,source=requirements,target=/tmp/vllm-requirements,ro \
|
||||
@@ -229,7 +229,7 @@ RUN --mount=type=cache,target=/opt/uv/cache \
|
||||
fi \
|
||||
&& if [ "${INSTALL_RUBIN_PRERELEASE}" = "true" ]; then \
|
||||
echo "Installing Rubin prerelease requirements..." \
|
||||
&& /opt/venv/bin/python3 use_existing_torch.py --prefix \
|
||||
&& /opt/venv/bin/python3 tools/use_existing_torch.py --prefix \
|
||||
&& uv pip install --python /opt/venv/bin/python3 \
|
||||
--prerelease=allow --index-strategy unsafe-first-match \
|
||||
-r /tmp/vllm-requirements/rubin-prerelease.txt \
|
||||
@@ -243,7 +243,7 @@ RUN --mount=type=cache,target=/opt/uv/cache \
|
||||
&& uv pip install --python /opt/venv/bin/python3 torch torchaudio torchvision --pre \
|
||||
--index-url ${PYTORCH_CUDA_INDEX_BASE_URL}/nightly/cu$(echo $CUDA_VERSION | cut -d. -f1,2 | tr -d '.') \
|
||||
&& echo "Installing other requirements..." \
|
||||
&& /opt/venv/bin/python3 use_existing_torch.py --prefix \
|
||||
&& /opt/venv/bin/python3 tools/use_existing_torch.py --prefix \
|
||||
&& uv pip install --python /opt/venv/bin/python3 -r requirements/cuda.txt \
|
||||
--extra-index-url ${PYTORCH_CUDA_INDEX_BASE_URL}/nightly/cu$(echo $CUDA_VERSION | cut -d. -f1,2 | tr -d '.'); \
|
||||
else \
|
||||
@@ -316,12 +316,12 @@ COPY requirements/build/rust.txt requirements/build/rust.txt
|
||||
RUN --mount=type=cache,target=/opt/uv/cache \
|
||||
uv pip install --python /opt/venv/bin/python3 -r requirements/build/rust.txt
|
||||
|
||||
# Copy only the Rust build inputs; build_rust.sh publishes artifacts needed
|
||||
# Copy only the Rust build inputs; tools/build_rust.sh publishes artifacts needed
|
||||
# by the wheel build stage.
|
||||
COPY rust rust
|
||||
COPY rust-toolchain.toml rust-toolchain.toml
|
||||
COPY tools/build_rust.py tools/build_rust.py
|
||||
COPY build_rust.sh build_rust.sh
|
||||
COPY tools/build_rust.sh tools/build_rust.sh
|
||||
|
||||
# Cap cargo parallelism to avoid exhausting the CI host's open-file limit
|
||||
# (rustc spawns enough concurrent processes to hit RLIMIT_NOFILE otherwise).
|
||||
@@ -341,7 +341,7 @@ RUN --mount=type=cache,target=/root/.cargo/registry,sharing=locked \
|
||||
export RUSTC_WRAPPER=sccache; \
|
||||
sccache --show-stats; \
|
||||
fi \
|
||||
&& SETUPTOOLS_SCM_PRETEND_VERSION="0.0.0+docker.cache" bash build_rust.sh \
|
||||
&& SETUPTOOLS_SCM_PRETEND_VERSION="0.0.0+docker.cache" bash tools/build_rust.sh \
|
||||
&& if [ "$USE_SCCACHE" = "1" ]; then \
|
||||
sccache --show-stats; \
|
||||
fi
|
||||
@@ -352,7 +352,7 @@ FROM rust-build-cache AS rust-build
|
||||
RUN --mount=type=cache,target=/root/.cargo/registry,sharing=locked \
|
||||
--mount=type=cache,target=/root/.cargo/git,sharing=locked \
|
||||
--mount=type=bind,source=.git,target=.git \
|
||||
SETUPTOOLS_SCM_PRETEND_METADATA="{dirty=false}" bash build_rust.sh
|
||||
SETUPTOOLS_SCM_PRETEND_METADATA="{dirty=false}" bash tools/build_rust.sh
|
||||
#################### RUST BUILD IMAGE ####################
|
||||
|
||||
#################### CSRC BUILD IMAGE ####################
|
||||
@@ -368,7 +368,7 @@ ARG PYTORCH_NIGHTLY
|
||||
|
||||
# Install build dependencies
|
||||
COPY requirements/build/cuda.txt requirements/build/cuda.txt
|
||||
COPY use_existing_torch.py use_existing_torch.py
|
||||
COPY tools/use_existing_torch.py tools/use_existing_torch.py
|
||||
COPY --from=base /workspace/torch_lib_versions.txt torch_lib_versions.txt
|
||||
|
||||
# This timeout (in seconds) is necessary when installing some dependencies via uv since it's likely to time out
|
||||
@@ -381,11 +381,11 @@ ENV UV_LINK_MODE=copy
|
||||
RUN --mount=type=cache,target=/opt/uv/cache \
|
||||
if [ "${INSTALL_RUBIN_PRERELEASE}" = "true" ]; then \
|
||||
echo "Installing build requirements with Rubin prerelease PyTorch..." \
|
||||
&& python3 use_existing_torch.py --prefix \
|
||||
&& python3 tools/use_existing_torch.py --prefix \
|
||||
&& uv pip install --python /opt/venv/bin/python3 -r requirements/build/cuda.txt; \
|
||||
elif [ "${PYTORCH_NIGHTLY}" = "1" ]; then \
|
||||
echo "Installing build requirements without torch..." \
|
||||
&& python3 use_existing_torch.py --prefix \
|
||||
&& python3 tools/use_existing_torch.py --prefix \
|
||||
&& uv pip install --python /opt/venv/bin/python3 -r requirements/build/cuda.txt \
|
||||
&& echo "Installing torch nightly..." \
|
||||
&& uv pip install --python /opt/venv/bin/python3 $(cat torch_lib_versions.txt | grep -i "^torch=" | xargs) --pre \
|
||||
@@ -427,7 +427,7 @@ ENV SETUPTOOLS_SCM_PRETEND_VERSION="0.0.0+csrc.build"
|
||||
RUN --mount=type=cache,target=/opt/uv/cache \
|
||||
if [ "${PYTORCH_NIGHTLY}" = "1" ] || \
|
||||
[ "${INSTALL_RUBIN_PRERELEASE}" = "true" ]; then \
|
||||
python3 use_existing_torch.py --prefix; \
|
||||
python3 tools/use_existing_torch.py --prefix; \
|
||||
fi
|
||||
|
||||
# Provision one bare Python per `requires-python` entry; cmake reads
|
||||
@@ -605,7 +605,7 @@ ARG PYTORCH_NIGHTLY
|
||||
|
||||
# Install build dependencies
|
||||
COPY requirements/build/cuda.txt requirements/build/cuda.txt
|
||||
COPY use_existing_torch.py use_existing_torch.py
|
||||
COPY tools/use_existing_torch.py tools/use_existing_torch.py
|
||||
COPY --from=base /workspace/torch_lib_versions.txt torch_lib_versions.txt
|
||||
|
||||
# This timeout (in seconds) is necessary when installing some dependencies via uv since it's likely to time out
|
||||
@@ -618,11 +618,11 @@ ENV UV_LINK_MODE=copy
|
||||
RUN --mount=type=cache,target=/opt/uv/cache \
|
||||
if [ "${INSTALL_RUBIN_PRERELEASE}" = "true" ]; then \
|
||||
echo "Installing build requirements with Rubin prerelease PyTorch..." \
|
||||
&& python3 use_existing_torch.py --prefix \
|
||||
&& python3 tools/use_existing_torch.py --prefix \
|
||||
&& uv pip install --python /opt/venv/bin/python3 -r requirements/build/cuda.txt; \
|
||||
elif [ "${PYTORCH_NIGHTLY}" = "1" ]; then \
|
||||
echo "Installing build requirements without torch..." \
|
||||
&& python3 use_existing_torch.py --prefix \
|
||||
&& python3 tools/use_existing_torch.py --prefix \
|
||||
&& uv pip install --python /opt/venv/bin/python3 -r requirements/build/cuda.txt \
|
||||
&& echo "Installing torch nightly..." \
|
||||
&& uv pip install --python /opt/venv/bin/python3 $(cat torch_lib_versions.txt | grep -i "^torch=" | xargs) --pre \
|
||||
@@ -658,7 +658,7 @@ ENV VLLM_SKIP_PRECOMPILED_VERSION_SUFFIX=1
|
||||
RUN --mount=type=cache,target=/opt/uv/cache \
|
||||
if [ "${PYTORCH_NIGHTLY}" = "1" ] || \
|
||||
[ "${INSTALL_RUBIN_PRERELEASE}" = "true" ]; then \
|
||||
python3 use_existing_torch.py --prefix; \
|
||||
python3 tools/use_existing_torch.py --prefix; \
|
||||
fi \
|
||||
&& if [ "${INSTALL_RUBIN_PRERELEASE}" = "true" ]; then \
|
||||
sed -Ei '/^[[:space:]]*(flashinfer-python|nvidia-cutlass-dsl\[cu13\]|quack-kernels)[[:space:]]*==/Id' \
|
||||
@@ -729,12 +729,12 @@ COPY requirements/lint.txt requirements/lint.txt
|
||||
COPY requirements/test/cuda.in requirements/test/cuda.in
|
||||
COPY requirements/test/cuda.txt requirements/test/cuda.txt
|
||||
COPY requirements/dev.txt requirements/dev.txt
|
||||
COPY use_existing_torch.py use_existing_torch.py
|
||||
COPY tools/use_existing_torch.py tools/use_existing_torch.py
|
||||
COPY --from=base /workspace/torch_lib_versions.txt torch_lib_versions.txt
|
||||
RUN --mount=type=cache,target=/opt/uv/cache \
|
||||
if [ "${PYTORCH_NIGHTLY}" = "1" ]; then \
|
||||
echo "Installing dev requirements plus torch nightly..." \
|
||||
&& python3 use_existing_torch.py --prefix \
|
||||
&& python3 tools/use_existing_torch.py --prefix \
|
||||
&& cat torch_lib_versions.txt >> requirements/test/cuda.in \
|
||||
&& uv pip compile requirements/test/cuda.in -o requirements/test/cuda.txt --index-strategy unsafe-best-match \
|
||||
--extra-index-url ${PYTORCH_CUDA_INDEX_BASE_URL}/nightly/cu$(echo $CUDA_VERSION | cut -d. -f1,2 | tr -d '.') \
|
||||
@@ -1143,14 +1143,14 @@ COPY requirements/lint.txt requirements/lint.txt
|
||||
COPY requirements/test/cuda.in requirements/test/cuda.in
|
||||
COPY requirements/test/cuda.txt requirements/test/cuda.txt
|
||||
COPY requirements/dev.txt requirements/dev.txt
|
||||
COPY use_existing_torch.py use_existing_torch.py
|
||||
COPY tools/use_existing_torch.py tools/use_existing_torch.py
|
||||
COPY --from=base /workspace/torch_lib_versions.txt torch_lib_versions.txt
|
||||
RUN --mount=type=cache,target=/opt/uv/cache \
|
||||
CUDA_MAJOR="${CUDA_VERSION%%.*}"; \
|
||||
if [ "$CUDA_MAJOR" -ge 12 ]; then \
|
||||
if [ "${PYTORCH_NIGHTLY}" = "1" ]; then \
|
||||
echo "Installing dev requirements plus torch nightly..." \
|
||||
&& python3 use_existing_torch.py --prefix \
|
||||
&& python3 tools/use_existing_torch.py --prefix \
|
||||
&& cat torch_lib_versions.txt >> requirements/test/cuda.in \
|
||||
&& uv pip compile requirements/test/cuda.in -o requirements/test/cuda.txt --index-strategy unsafe-best-match \
|
||||
--extra-index-url ${PYTORCH_CUDA_INDEX_BASE_URL}/nightly/cu$(echo $CUDA_VERSION | cut -d. -f1,2 | tr -d '.') \
|
||||
|
||||
+11
-11
@@ -119,10 +119,10 @@ ARG PYTORCH_CPU_INDEX_BASE_URL=https://download.pytorch.org/whl
|
||||
# Copy requirements files for installation
|
||||
COPY requirements/common.txt requirements/common.txt
|
||||
COPY requirements/cpu.txt requirements/cpu.txt
|
||||
COPY use_existing_torch.py use_existing_torch.py
|
||||
COPY tools/use_existing_torch.py tools/use_existing_torch.py
|
||||
|
||||
# For nightly: install torch nightly (CPU) first, strip torch pins from the
|
||||
# requirements via use_existing_torch.py so they can't pull it back to a release
|
||||
# requirements via tools/use_existing_torch.py so they can't pull it back to a release
|
||||
# build, then install the rest from the nightly CPU index (no --torch-backend,
|
||||
# which would force the stable channel). Release path is unchanged.
|
||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||
@@ -131,7 +131,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \
|
||||
echo "Installing torch nightly (CPU)..." \
|
||||
&& uv pip install torch torchaudio torchvision torchcodec --pre \
|
||||
--index-url ${PYTORCH_CPU_INDEX_BASE_URL}/nightly/cpu \
|
||||
&& python3 use_existing_torch.py --prefix \
|
||||
&& python3 tools/use_existing_torch.py --prefix \
|
||||
&& uv pip install -r requirements/cpu.txt \
|
||||
--extra-index-url ${PYTORCH_CPU_INDEX_BASE_URL}/nightly/cpu; \
|
||||
else \
|
||||
@@ -183,12 +183,12 @@ ENV SCCACHE_REGION=${USE_SCCACHE:+${SCCACHE_REGION_NAME}}
|
||||
# Avoid port collision with vllm-build's own sccache daemon.
|
||||
ENV SCCACHE_SERVER_PORT=4227
|
||||
|
||||
# Copy only the Rust build inputs; build_rust.sh publishes artifacts needed
|
||||
# Copy only the Rust build inputs; tools/build_rust.sh publishes artifacts needed
|
||||
# by the wheel build stage.
|
||||
COPY rust rust
|
||||
COPY rust-toolchain.toml rust-toolchain.toml
|
||||
COPY tools/build_rust.py tools/build_rust.py
|
||||
COPY build_rust.sh build_rust.sh
|
||||
COPY tools/build_rust.sh tools/build_rust.sh
|
||||
|
||||
# Cap cargo parallelism to avoid exhausting the CI host's open-file limit
|
||||
# (rustc spawns enough concurrent processes to hit RLIMIT_NOFILE otherwise).
|
||||
@@ -210,10 +210,10 @@ RUN --mount=type=cache,target=/root/.cargo/registry,sharing=locked \
|
||||
fi; \
|
||||
sccache --show-stats; \
|
||||
fi && \
|
||||
SETUPTOOLS_SCM_PRETEND_VERSION="0.0.0+docker.cache" bash build_rust.sh && \
|
||||
SETUPTOOLS_SCM_PRETEND_VERSION="0.0.0+docker.cache" bash tools/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
|
||||
# tools/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}"
|
||||
|
||||
@@ -223,7 +223,7 @@ FROM rust-build-cache AS rust-build
|
||||
RUN --mount=type=cache,target=/root/.cargo/registry,sharing=locked \
|
||||
--mount=type=cache,target=/root/.cargo/git,sharing=locked \
|
||||
--mount=type=bind,source=.git,target=.git \
|
||||
SETUPTOOLS_SCM_PRETEND_METADATA="{dirty=false}" bash build_rust.sh
|
||||
SETUPTOOLS_SCM_PRETEND_METADATA="{dirty=false}" bash tools/build_rust.sh
|
||||
|
||||
######################### SOURCE PREP IMAGE #########################
|
||||
# Shared prep (source, rust artifacts, build deps) for both vllm-build and
|
||||
@@ -262,7 +262,7 @@ COPY requirements/build/cpu.txt requirements/build/cpu.txt
|
||||
|
||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||
if [ "${PYTORCH_NIGHTLY}" = "1" ]; then \
|
||||
python3 /workspace/use_existing_torch.py --prefix \
|
||||
python3 /workspace/tools/use_existing_torch.py --prefix \
|
||||
&& uv pip install -r requirements/build/cpu.txt \
|
||||
--extra-index-url ${PYTORCH_CPU_INDEX_BASE_URL}/nightly/cpu; \
|
||||
else \
|
||||
@@ -287,7 +287,7 @@ RUN if [ "$GIT_REPO_CHECK" != 0 ]; then bash tools/check_repo.sh ; fi
|
||||
# now-unpinned dependency. Done at the end of vllm-src so vllm-build and
|
||||
# vllm-dev, which both derive from it, inherit the unpinned tree.
|
||||
RUN if [ "${PYTORCH_NIGHTLY}" = "1" ]; then \
|
||||
python3 /workspace/use_existing_torch.py --prefix; \
|
||||
python3 /workspace/tools/use_existing_torch.py --prefix; \
|
||||
fi
|
||||
|
||||
######################### BUILD IMAGE #########################
|
||||
@@ -343,7 +343,7 @@ RUN case "$(uname -m)" in \
|
||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||
export CFLAGS="${CFLAGS:+${CFLAGS} }-std=gnu17" && \
|
||||
if [ "${PYTORCH_NIGHTLY}" = "1" ]; then \
|
||||
python3 /workspace/use_existing_torch.py --prefix \
|
||||
python3 /workspace/tools/use_existing_torch.py --prefix \
|
||||
&& uv pip install -r requirements/test/cpu.txt \
|
||||
--extra-index-url ${PYTORCH_CPU_INDEX_BASE_URL}/nightly/cpu; \
|
||||
else \
|
||||
|
||||
@@ -36,10 +36,10 @@ COPY pyproject.toml ./
|
||||
|
||||
# The script is expected to install whatever python dependencies are missing
|
||||
# as well as whatever system libraries need to be installed from source
|
||||
COPY build_vllm_*.sh ./
|
||||
COPY docker/build_vllm_*.sh docker/
|
||||
|
||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||
sh ./build_vllm_$(uname -m).sh
|
||||
sh ./docker/build_vllm_$(uname -m).sh
|
||||
|
||||
# copy vllm source code to build cache
|
||||
COPY . .
|
||||
|
||||
@@ -171,7 +171,7 @@ COPY rust/proto /rust-input/vllm/rust/proto
|
||||
COPY rust/src /rust-input/vllm/rust/src
|
||||
COPY rust-toolchain.toml /rust-input/vllm/rust-toolchain.toml
|
||||
COPY tools/build_rust.py /rust-input/vllm/tools/build_rust.py
|
||||
COPY build_rust.sh /rust-input/vllm/build_rust.sh
|
||||
COPY tools/build_rust.sh /rust-input/vllm/tools/build_rust.sh
|
||||
|
||||
FROM base AS rust_input_1
|
||||
ARG VLLM_REPO
|
||||
@@ -188,7 +188,7 @@ RUN git clone --no-checkout --filter=blob:none ${VLLM_REPO} /rust-input/vllm \
|
||||
rust/src/** \
|
||||
rust-toolchain.toml \
|
||||
tools/build_rust.py \
|
||||
build_rust.sh \
|
||||
tools/build_rust.sh \
|
||||
&& git checkout FETCH_HEAD
|
||||
|
||||
FROM rust_input_${REMOTE_VLLM} AS rust-input
|
||||
@@ -244,7 +244,7 @@ RUN --mount=type=cache,id=vllm-rocm-uv,target=/root/.cache/uv \
|
||||
COPY --from=rust-input /rust-input/vllm/rust rust
|
||||
COPY --from=rust-input /rust-input/vllm/rust-toolchain.toml rust-toolchain.toml
|
||||
COPY --from=rust-input /rust-input/vllm/tools/build_rust.py tools/build_rust.py
|
||||
COPY --from=rust-input /rust-input/vllm/build_rust.sh build_rust.sh
|
||||
COPY --from=rust-input /rust-input/vllm/tools/build_rust.sh tools/build_rust.sh
|
||||
COPY --from=vllm-version /vllm-version.txt /tmp/vllm-version.txt
|
||||
|
||||
# Build the release binary. Cargo's registry/git caches can be written by
|
||||
@@ -258,7 +258,7 @@ RUN --mount=type=cache,id=vllm-rocm-cargo-registry,target=/root/.cargo/registry,
|
||||
&& sccache --show-stats; \
|
||||
fi \
|
||||
&& export SETUPTOOLS_SCM_PRETEND_VERSION="$(cat /tmp/vllm-version.txt)" \
|
||||
&& bash build_rust.sh \
|
||||
&& bash tools/build_rust.sh \
|
||||
&& test -x vllm/vllm-rs \
|
||||
&& if [ "$USE_SCCACHE" = "1" ]; then \
|
||||
sccache --show-stats; \
|
||||
@@ -368,7 +368,7 @@ COPY --from=build_vllm ${COMMON_WORKDIR}/vllm/requirements /requirements
|
||||
COPY --from=build_vllm ${COMMON_WORKDIR}/vllm/benchmarks /benchmarks
|
||||
COPY --from=build_vllm ${COMMON_WORKDIR}/vllm/tests /tests
|
||||
COPY --from=build_vllm ${COMMON_WORKDIR}/vllm/examples /examples
|
||||
COPY --from=build_vllm ${COMMON_WORKDIR}/vllm/scripts/benchmark_helion_kernels.py /scripts/benchmark_helion_kernels.py
|
||||
COPY --from=build_vllm ${COMMON_WORKDIR}/vllm/tools/benchmark_helion_kernels.py /tools/benchmark_helion_kernels.py
|
||||
COPY --from=build_vllm ${COMMON_WORKDIR}/vllm/tools/install_torchcodec_rocm.sh /tools/install_torchcodec_rocm.sh
|
||||
COPY --from=build_vllm ${COMMON_WORKDIR}/vllm/docker/Dockerfile /docker/Dockerfile
|
||||
COPY --from=build_vllm ${COMMON_WORKDIR}/vllm/docker/Dockerfile.cpu /docker/Dockerfile.cpu
|
||||
@@ -729,7 +729,7 @@ COPY --from=build_vllm_wheel_release ${COMMON_WORKDIR}/vllm/requirements /requir
|
||||
COPY --from=build_vllm_wheel_release ${COMMON_WORKDIR}/vllm/benchmarks /benchmarks
|
||||
COPY --from=build_vllm_wheel_release ${COMMON_WORKDIR}/vllm/tests /tests
|
||||
COPY --from=build_vllm_wheel_release ${COMMON_WORKDIR}/vllm/examples /examples
|
||||
COPY --from=build_vllm_wheel_release ${COMMON_WORKDIR}/vllm/scripts/benchmark_helion_kernels.py /scripts/benchmark_helion_kernels.py
|
||||
COPY --from=build_vllm_wheel_release ${COMMON_WORKDIR}/vllm/tools/benchmark_helion_kernels.py /tools/benchmark_helion_kernels.py
|
||||
COPY --from=build_vllm_wheel_release ${COMMON_WORKDIR}/vllm/tools/install_torchcodec_rocm.sh /tools/install_torchcodec_rocm.sh
|
||||
COPY --from=build_vllm_wheel_release ${COMMON_WORKDIR}/vllm/docker/Dockerfile /docker/Dockerfile
|
||||
COPY --from=build_vllm_wheel_release ${COMMON_WORKDIR}/vllm/docker/Dockerfile.cpu /docker/Dockerfile.cpu
|
||||
|
||||
@@ -171,7 +171,7 @@ COPY rust/proto /rust-input/vllm/rust/proto
|
||||
COPY rust/src /rust-input/vllm/rust/src
|
||||
COPY rust-toolchain.toml /rust-input/vllm/rust-toolchain.toml
|
||||
COPY tools/build_rust.py /rust-input/vllm/tools/build_rust.py
|
||||
COPY build_rust.sh /rust-input/vllm/build_rust.sh
|
||||
COPY tools/build_rust.sh /rust-input/vllm/tools/build_rust.sh
|
||||
|
||||
FROM base AS rust_input_1
|
||||
ARG VLLM_REPO
|
||||
@@ -188,7 +188,7 @@ RUN git clone --no-checkout --filter=blob:none ${VLLM_REPO} /rust-input/vllm \
|
||||
rust/src/** \
|
||||
rust-toolchain.toml \
|
||||
tools/build_rust.py \
|
||||
build_rust.sh \
|
||||
tools/build_rust.sh \
|
||||
&& git checkout FETCH_HEAD
|
||||
|
||||
FROM rust_input_${REMOTE_VLLM} AS rust-input
|
||||
@@ -244,7 +244,7 @@ RUN --mount=type=cache,id=vllm-rocm-uv,target=/root/.cache/uv \
|
||||
COPY --from=rust-input /rust-input/vllm/rust rust
|
||||
COPY --from=rust-input /rust-input/vllm/rust-toolchain.toml rust-toolchain.toml
|
||||
COPY --from=rust-input /rust-input/vllm/tools/build_rust.py tools/build_rust.py
|
||||
COPY --from=rust-input /rust-input/vllm/build_rust.sh build_rust.sh
|
||||
COPY --from=rust-input /rust-input/vllm/tools/build_rust.sh tools/build_rust.sh
|
||||
COPY --from=vllm-version /vllm-version.txt /tmp/vllm-version.txt
|
||||
|
||||
# Build the release binary. Cargo's registry/git caches can be written by
|
||||
@@ -258,7 +258,7 @@ RUN --mount=type=cache,id=vllm-rocm-cargo-registry,target=/root/.cargo/registry,
|
||||
&& sccache --show-stats; \
|
||||
fi \
|
||||
&& export SETUPTOOLS_SCM_PRETEND_VERSION="$(cat /tmp/vllm-version.txt)" \
|
||||
&& bash build_rust.sh \
|
||||
&& bash tools/build_rust.sh \
|
||||
&& test -x vllm/vllm-rs \
|
||||
&& if [ "$USE_SCCACHE" = "1" ]; then \
|
||||
sccache --show-stats; \
|
||||
@@ -366,7 +366,6 @@ COPY --from=build_vllm ${COMMON_WORKDIR}/vllm/requirements /requirements
|
||||
COPY --from=build_vllm ${COMMON_WORKDIR}/vllm/benchmarks /benchmarks
|
||||
COPY --from=build_vllm ${COMMON_WORKDIR}/vllm/tests /tests
|
||||
COPY --from=build_vllm ${COMMON_WORKDIR}/vllm/examples /examples
|
||||
COPY --from=build_vllm ${COMMON_WORKDIR}/vllm/scripts/benchmark_helion_kernels.py /scripts/benchmark_helion_kernels.py
|
||||
COPY --from=build_vllm ${COMMON_WORKDIR}/vllm/tools /tools
|
||||
COPY --from=build_vllm ${COMMON_WORKDIR}/vllm/docker/Dockerfile /docker/Dockerfile
|
||||
COPY --from=build_vllm ${COMMON_WORKDIR}/vllm/docker/Dockerfile.cpu /docker/Dockerfile.cpu
|
||||
@@ -749,7 +748,6 @@ COPY --from=build_vllm_wheel_release ${COMMON_WORKDIR}/vllm/requirements /requir
|
||||
COPY --from=build_vllm_wheel_release ${COMMON_WORKDIR}/vllm/benchmarks /benchmarks
|
||||
COPY --from=build_vllm_wheel_release ${COMMON_WORKDIR}/vllm/tests /tests
|
||||
COPY --from=build_vllm_wheel_release ${COMMON_WORKDIR}/vllm/examples /examples
|
||||
COPY --from=build_vllm_wheel_release ${COMMON_WORKDIR}/vllm/scripts/benchmark_helion_kernels.py /scripts/benchmark_helion_kernels.py
|
||||
COPY --from=build_vllm_wheel_release ${COMMON_WORKDIR}/vllm/tools /tools
|
||||
COPY --from=build_vllm_wheel_release ${COMMON_WORKDIR}/vllm/docker/Dockerfile /docker/Dockerfile
|
||||
COPY --from=build_vllm_wheel_release ${COMMON_WORKDIR}/vllm/docker/Dockerfile.cpu /docker/Dockerfile.cpu
|
||||
|
||||
@@ -166,7 +166,7 @@ RUN --mount=type=cache,id=vllm-rocm-cargo-registry,target=/root/.cargo/registry,
|
||||
--mount=type=cache,id=vllm-rocm-cargo-git,target=/root/.cargo/git,sharing=locked \
|
||||
cd ${COMMON_WORKDIR}/vllm \
|
||||
&& export SETUPTOOLS_SCM_PRETEND_VERSION="$(cat /tmp/vllm-version.txt)" \
|
||||
&& bash build_rust.sh \
|
||||
&& bash tools/build_rust.sh \
|
||||
&& test -x vllm/vllm-rs
|
||||
|
||||
# -----------------------
|
||||
|
||||
@@ -14,12 +14,12 @@ WORKDIR /workspace
|
||||
COPY requirements/build/rust.txt requirements/build/rust.txt
|
||||
RUN python3 -m pip install --no-cache-dir -r requirements/build/rust.txt
|
||||
|
||||
# Copy only the Rust build inputs; build_rust.sh publishes artifacts needed
|
||||
# Copy only the Rust build inputs; tools/build_rust.sh publishes artifacts needed
|
||||
# by the wheel build stage.
|
||||
COPY rust rust
|
||||
COPY rust-toolchain.toml rust-toolchain.toml
|
||||
COPY tools/build_rust.py tools/build_rust.py
|
||||
COPY build_rust.sh build_rust.sh
|
||||
COPY tools/build_rust.sh tools/build_rust.sh
|
||||
|
||||
# Cap cargo parallelism to avoid exhausting the CI host's open-file limit
|
||||
# (rustc spawns enough concurrent processes to hit RLIMIT_NOFILE otherwise).
|
||||
@@ -29,7 +29,7 @@ ENV CARGO_BUILD_JOBS=4
|
||||
# inputs. The child stage below relinks the crates that embed the exact version.
|
||||
RUN --mount=type=cache,target=/root/.cargo/registry,sharing=locked \
|
||||
--mount=type=cache,target=/root/.cargo/git,sharing=locked \
|
||||
SETUPTOOLS_SCM_PRETEND_VERSION="0.0.0+docker.cache" bash build_rust.sh
|
||||
SETUPTOOLS_SCM_PRETEND_VERSION="0.0.0+docker.cache" bash tools/build_rust.sh
|
||||
|
||||
# Relink with the exact Git-derived package version.
|
||||
FROM rust-build-cache AS rust-build
|
||||
@@ -37,7 +37,7 @@ FROM rust-build-cache AS rust-build
|
||||
RUN --mount=type=cache,target=/root/.cargo/registry,sharing=locked \
|
||||
--mount=type=cache,target=/root/.cargo/git,sharing=locked \
|
||||
--mount=type=bind,source=.git,target=.git \
|
||||
SETUPTOOLS_SCM_PRETEND_METADATA="{dirty=false}" bash build_rust.sh
|
||||
SETUPTOOLS_SCM_PRETEND_METADATA="{dirty=false}" bash tools/build_rust.sh
|
||||
|
||||
FROM ubuntu:24.04 AS vllm-base
|
||||
|
||||
|
||||
@@ -0,0 +1,241 @@
|
||||
#!/bin/bash
|
||||
set -eoux pipefail
|
||||
|
||||
########################################
|
||||
# Resolve repo root (IMPORTANT)
|
||||
########################################
|
||||
REPO_ROOT="$(pwd)"
|
||||
|
||||
cd "$REPO_ROOT"
|
||||
|
||||
########################################
|
||||
# DevPI configuration
|
||||
########################################
|
||||
|
||||
IBM_DEVPI_URL=${IBM_DEVPI_URL:-"https://wheels.developerfirst.ibm.com/ppc64le/linux/+simple/"}
|
||||
RHOAI_INDEX_URL=${RHOAI_INDEX_URL:-"https://console.redhat.com/api/pypi/public-rhai/rhoai/3.4/cpu-ubi9/simple/"}
|
||||
|
||||
########################################
|
||||
# wheel dir
|
||||
########################################
|
||||
|
||||
WHEEL_DIR=${WHEEL_DIR:-"/tmp/wheels"}
|
||||
mkdir -p "$WHEEL_DIR"
|
||||
|
||||
########################################
|
||||
# Helpers
|
||||
########################################
|
||||
try_install_from_devpi() {
|
||||
local pkg=$1
|
||||
uv pip install \
|
||||
--extra-index-url "${IBM_DEVPI_URL}" \
|
||||
--index-strategy unsafe-best-match \
|
||||
--no-build-isolation \
|
||||
"${pkg}"
|
||||
}
|
||||
|
||||
########################################
|
||||
# Package Versions
|
||||
########################################
|
||||
cd "$REPO_ROOT"
|
||||
TORCH_VERSION=${TORCH_VERSION:-$(grep -E '^torch==.+==\s*"ppc64le"' requirements/cpu.txt | grep -Eo '\b[0-9\.]+\b' || true)}
|
||||
TORCH_VERSION=${TORCH_VERSION:-2.11.0}
|
||||
|
||||
TORCHVISION_VERSION=${TORCHVISION_VERSION:-0.26.0}
|
||||
TORCHAUDIO_VERSION=${TORCHAUDIO_VERSION:-${TORCH_VERSION}}
|
||||
|
||||
export TORCH_VERSION
|
||||
export TORCHVISION_VERSION
|
||||
export TORCHAUDIO_VERSION
|
||||
export OPENCV_VERSION=${OPENCV_VERSION:-4.13.0.92}
|
||||
export XGRAMMAR_VERSION=${XGRAMMAR_VERSION:-0.2.1}
|
||||
|
||||
########################################
|
||||
# install system dependencies
|
||||
########################################
|
||||
|
||||
rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm || true
|
||||
|
||||
microdnf install -y \
|
||||
python3.12 python3.12-devel python3.12-pip gcc \
|
||||
git jq gcc-toolset-14 gcc-toolset-14-libatomic-devel \
|
||||
automake libtool clang-devel openssl-devel \
|
||||
harfbuzz-devel kmod lcms2-devel libimagequant-devel libjpeg-turbo-devel \
|
||||
llvm15-devel libraqm-devel libtiff-devel libwebp-devel libxcb-devel \
|
||||
ninja-build openjpeg2-devel pkgconfig \
|
||||
tcl-devel tk-devel xsimd-devel zeromq-devel zlib-devel patchelf file openblas openblas-devel protobuf numactl numactl-devel openmpi openmpi-devel
|
||||
|
||||
rpm -ivh --nodeps \
|
||||
https://mirror.stream.centos.org/9-stream/CRB/ppc64le/os/Packages/protobuf-lite-devel-3.14.0-17.el9.ppc64le.rpm
|
||||
|
||||
rpm -ivh --nodeps \
|
||||
https://mirror.stream.centos.org/9-stream/CRB/ppc64le/os/Packages/protobuf-devel-3.14.0-17.el9.ppc64le.rpm
|
||||
|
||||
rpm -ivh --nodeps \
|
||||
https://mirror.stream.centos.org/9-stream/CRB/ppc64le/os/Packages/protobuf-compiler-3.14.0-17.el9.ppc64le.rpm
|
||||
|
||||
########################################
|
||||
# Python 3.12 virtual environment
|
||||
########################################
|
||||
|
||||
python3.12 -m venv /opt/vllm
|
||||
source /opt/vllm/bin/activate
|
||||
|
||||
export PATH=/opt/vllm/bin:$PATH
|
||||
|
||||
python --version
|
||||
|
||||
########################################
|
||||
# install build tools (stable uv)
|
||||
########################################
|
||||
|
||||
pip install -U pip setuptools-rust
|
||||
pip install uv
|
||||
pip install "setuptools<70" build wheel cmake auditwheel
|
||||
uv pip install "setuptools<70" cython meson-python pybind11 "sympy>=1.13.3" --no-build-isolation
|
||||
|
||||
########################################
|
||||
# Rust
|
||||
########################################
|
||||
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||
source /root/.cargo/env
|
||||
|
||||
########################################
|
||||
# Compiler env
|
||||
########################################
|
||||
|
||||
source /opt/rh/gcc-toolset-14/enable
|
||||
|
||||
export PATH=/usr/lib64/llvm15/bin:$PATH
|
||||
export LLVM_CONFIG=/usr/lib64/llvm15/bin/llvm-config
|
||||
export CMAKE_ARGS="-DPython3_EXECUTABLE=python"
|
||||
|
||||
export MAX_JOBS=${MAX_JOBS:-$(nproc)}
|
||||
export GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1
|
||||
|
||||
########################################
|
||||
# Install Packages From Devpi
|
||||
########################################
|
||||
uv pip install numpy==2.3.5 pillow==12.2.0 --extra-index-url "$IBM_DEVPI_URL"
|
||||
try_install_from_devpi "opencv-python-headless==${OPENCV_VERSION}"
|
||||
try_install_from_devpi "torch==${TORCH_VERSION}"
|
||||
try_install_from_devpi "torchvision==${TORCHVISION_VERSION}"
|
||||
|
||||
########################################
|
||||
# torch audio
|
||||
########################################
|
||||
|
||||
TEMP_BUILD_DIR=$(mktemp -d)
|
||||
cd "${TEMP_BUILD_DIR}"
|
||||
export BUILD_SOX=1 BUILD_KALDI=1 BUILD_RNNT=1 USE_FFMPEG=0 USE_ROCM=0 USE_CUDA=0
|
||||
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_FFMPEG=1
|
||||
git clone --recursive https://github.com/pytorch/audio.git -b "v${TORCHAUDIO_VERSION}"
|
||||
cd audio
|
||||
#patching
|
||||
sed -i '
|
||||
s|_CSRC_DIR / "_torchaudio.cpp"|str(_CSRC_DIR / "_torchaudio.cpp")|;
|
||||
s|_CSRC_DIR / "utils.cpp"|str(_CSRC_DIR / "utils.cpp")|;
|
||||
s|sources=\[_CSRC_DIR / s for s in sources\]|sources=[str(_CSRC_DIR / s) for s in sources]|;
|
||||
' tools/setup_helpers/extension.py
|
||||
MAX_JOBS=${MAX_JOBS:-$(nproc)} \
|
||||
BUILD_VERSION=${TORCHAUDIO_VERSION} \
|
||||
uv build --wheel --out-dir "${WHEEL_DIR}" --no-build-isolation
|
||||
uv pip install "${WHEEL_DIR}"/torchaudio*.whl
|
||||
cd "${REPO_ROOT}"
|
||||
rm -rf "${TEMP_BUILD_DIR}"
|
||||
|
||||
########################################
|
||||
# Xgrammar
|
||||
########################################
|
||||
uv pip install \
|
||||
"scikit-build-core==0.11.6" \
|
||||
"pyproject-metadata<0.8" \
|
||||
pathspec \
|
||||
packaging \
|
||||
distro \
|
||||
"setuptools<70" \
|
||||
setuptools_scm \
|
||||
cmake \
|
||||
ninja \
|
||||
pybind11 \
|
||||
nanobind
|
||||
uv pip install apache-tvm-ffi==0.1.12 \
|
||||
--no-build-isolation \
|
||||
--no-cache
|
||||
|
||||
TEMP_BUILD_DIR=$(mktemp -d)
|
||||
|
||||
pushd "${TEMP_BUILD_DIR}"
|
||||
|
||||
export CFLAGS="-fno-lto -mcpu=power9"
|
||||
export CXXFLAGS="-fno-lto -mcpu=power9"
|
||||
export LDFLAGS="-fno-lto"
|
||||
export PATH=/opt/vllm/bin:$PATH
|
||||
|
||||
export Python_EXECUTABLE=/opt/vllm/bin/python3
|
||||
export Python3_EXECUTABLE=/opt/vllm/bin/python3
|
||||
export PYTHON_EXECUTABLE=/opt/vllm/bin/python3
|
||||
|
||||
export Python_ROOT_DIR=/opt/vllm
|
||||
export Python3_ROOT_DIR=/opt/vllm
|
||||
|
||||
git clone \
|
||||
--recursive \
|
||||
https://github.com/mlc-ai/xgrammar \
|
||||
-b "v${XGRAMMAR_VERSION}"
|
||||
|
||||
cd xgrammar
|
||||
|
||||
cp cmake/config.cmake .
|
||||
export PYTHONPATH=/opt/vllm/lib64/python3.12/site-packages:/opt/vllm/lib/python3.12/site-packages:${PYTHONPATH:-}
|
||||
|
||||
uv build \
|
||||
--wheel \
|
||||
--out-dir "${WHEEL_DIR}" \
|
||||
--no-build-isolation
|
||||
|
||||
uv pip install "${WHEEL_DIR}"/xgrammar*.whl -v
|
||||
|
||||
popd
|
||||
|
||||
rm -rf "${TEMP_BUILD_DIR}"
|
||||
cd "${REPO_ROOT}"
|
||||
|
||||
########################################
|
||||
# RHOAI Binary Downloads
|
||||
########################################
|
||||
pip download \
|
||||
--index-url "${RHOAI_INDEX_URL}" \
|
||||
--only-binary=:all: \
|
||||
--no-deps \
|
||||
llvmlite==0.47.0 \
|
||||
-d "${WHEEL_DIR}"
|
||||
|
||||
pip download \
|
||||
--index-url "${RHOAI_INDEX_URL}" \
|
||||
--only-binary=:all: \
|
||||
--no-deps \
|
||||
Numba==0.65.0 \
|
||||
-d "${WHEEL_DIR}"
|
||||
|
||||
########################################
|
||||
# install built wheels
|
||||
########################################
|
||||
uv pip install setuptools_scm maturin setuptools-rust ninja scikit-build-core pybind11 nanobind \
|
||||
--no-build-isolation
|
||||
uv pip install "${WHEEL_DIR}"/*.whl
|
||||
|
||||
########################################
|
||||
# install remaining deps
|
||||
########################################
|
||||
|
||||
sed -i.bak -e 's/.*torch.*//g' pyproject.toml requirements/*.txt
|
||||
|
||||
uv pip install "setuptools>=78.1.1" --no-build-isolation
|
||||
|
||||
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig:/usr/lib64/pkgconfig
|
||||
|
||||
uv pip install -r requirements/common.txt \
|
||||
-r requirements/cpu.txt \
|
||||
-r requirements/build/cpu.txt --index-strategy unsafe-best-match
|
||||
Reference in New Issue
Block a user