[CI/Build][NVIDIA] Build NIXL with NIXL EP from source in Rubin image (#60090)
Signed-off-by: Artem Perevedentsev <aperevedents@nvidia.com>
This commit is contained in:
@@ -92,6 +92,11 @@ ARG UV_KEYRING_PROVIDER=${PIP_KEYRING_PROVIDER}
|
||||
# Flag enables built-in KV-connector dependency libs into docker images
|
||||
ARG INSTALL_KV_CONNECTORS=false
|
||||
|
||||
# Flag builds NIXL, including its NIXL EP extension for the installed PyTorch,
|
||||
# from source and installs it in place of the nixl packages from the KV-connector
|
||||
# requirements
|
||||
ARG BUILD_NIXL=false
|
||||
|
||||
#################### BASE BUILD IMAGE ####################
|
||||
# prepare basic build environment
|
||||
FROM ${BUILD_BASE_IMAGE} AS base
|
||||
@@ -548,6 +553,24 @@ RUN --mount=type=cache,target=/opt/uv/cache \
|
||||
(cd "${TRITON_WORKSPACE}/dist" \
|
||||
&& sha256sum build-state > wheel.sha256); \
|
||||
fi
|
||||
|
||||
# Build NIXL and its NIXL EP extension against the PyTorch installed here when
|
||||
# requested. The wheels are installed by the final image, which has no compiler.
|
||||
ARG BUILD_NIXL
|
||||
COPY tools/build_nixl_with_torch215_for_rubin.py /tmp/build_nixl_for_rubin.py
|
||||
RUN --mount=type=bind,source=requirements,target=/tmp/vllm-requirements,ro \
|
||||
set -eux; \
|
||||
NIXL_WORKSPACE=/tmp/nixl_workspace; \
|
||||
mkdir -p "${NIXL_WORKSPACE}/dist"; \
|
||||
if [ "${BUILD_NIXL}" = "true" ]; then \
|
||||
dnf install -y --setopt=install_weak_deps=False autoconf automake libtool; \
|
||||
dnf clean all; \
|
||||
rm -rf /var/cache/dnf; \
|
||||
NIXL_REQUIREMENTS_FILE=/tmp/vllm-requirements/kv_connectors.txt \
|
||||
WHEELS_CACHE_HOME="${NIXL_WORKSPACE}/dist" \
|
||||
MAX_JOBS="${max_jobs:-}" \
|
||||
python3 /tmp/build_nixl_for_rubin.py --skip-system-deps --build-only; \
|
||||
fi
|
||||
#################### EXTENSIONS BUILD IMAGE ####################
|
||||
|
||||
#################### WHEEL BUILD IMAGE ####################
|
||||
@@ -1260,6 +1283,25 @@ RUN --mount=type=cache,target=/opt/uv/cache \
|
||||
/tmp/install_triton_from_source.sh \
|
||||
/tmp/triton-source-wheel.sha256
|
||||
|
||||
# Install source-built NIXL last, replacing the nixl packages installed above, so
|
||||
# the image has a NIXL EP build for its PyTorch version. There is no GPU driver
|
||||
# at build time, so check for the extension instead of importing it.
|
||||
ARG BUILD_NIXL
|
||||
RUN --mount=type=cache,target=/opt/uv/cache \
|
||||
--mount=type=bind,from=extensions-build,source=/tmp/nixl_workspace/dist,target=/tmp/nixl-dist,ro \
|
||||
set -eu; \
|
||||
if [ "${BUILD_NIXL}" = "true" ]; then \
|
||||
ls /tmp/nixl-dist/*.whl; \
|
||||
uv pip uninstall --system nixl nixl-cu12 nixl-cu13; \
|
||||
uv pip install --system --no-deps /tmp/nixl-dist/*.whl; \
|
||||
python3 -c "import glob, importlib.util as u, os, torch; \
|
||||
spec = u.find_spec('nixl_ep_cu' + os.environ['CUDA_VERSION'].split('.')[0]); \
|
||||
mm = ''.join(torch.__version__.split('.')[:2]); \
|
||||
ext = glob.glob(os.path.join(spec.submodule_search_locations[0], 'nixl_ep_cpp_torch' + mm + '.*')) if spec else []; \
|
||||
assert ext, 'NIXL EP has no build for torch ' + torch.__version__; \
|
||||
print('NIXL EP extension:', ext[0])"; \
|
||||
fi
|
||||
|
||||
ENV VLLM_USAGE_SOURCE production-docker-image
|
||||
ENV VLLM_BUILD_COMMIT=${VLLM_BUILD_COMMIT:-unknown} \
|
||||
VLLM_BUILD_PIPELINE=${VLLM_BUILD_PIPELINE:-local} \
|
||||
|
||||
@@ -37,6 +37,9 @@
|
||||
"INSTALL_KV_CONNECTORS": {
|
||||
"default": "false"
|
||||
},
|
||||
"BUILD_NIXL": {
|
||||
"default": "false"
|
||||
},
|
||||
"SCCACHE_BUCKET_NAME": {
|
||||
"default": "vllm-build-sccache"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user