diff --git a/docker/rocm_ci/Dockerfile.TheRock_ci b/docker/rocm_ci/Dockerfile.TheRock_ci index b2339332a6..18c7efcb22 100644 --- a/docker/rocm_ci/Dockerfile.TheRock_ci +++ b/docker/rocm_ci/Dockerfile.TheRock_ci @@ -6,8 +6,7 @@ # context should contain. # # docker buildx (local): -# docker buildx build --build-context warp_src=/path/to/warp \ -# -f docker/Dockerfile.rocm_ci --target warp_base . +# docker buildx build --build-context warp_src=/path/to/warp -f docker/rocm_ci/Dockerfile.TheRock_ci --target warp_base -t warp-base . # # buildctl (CI entrypoint.sh): # buildctl build --local warp_src="${SRC_FOLDER}/warp" \ @@ -27,11 +26,13 @@ ENV PYTORCH_ROCM_ARCH="gfx942" ENV ROCM_AMDGPU_TARGETS="gfx942" -ARG THE_ROCK_VERSION=7.9.0rc20250930 +# 7.10.0a20251121 +# 7.11.0a20251201 +# 7.12.0a20260311 +ARG THE_ROCK_VERSION=7.10.0a20251121 ARG GFX_FAMILY="gfx94X-dcgpu" -ARG PY_VERSION=3.12 ARG TORCH_VERSION=2.9.1 -ARG MAMBA_ENV_NAME=base +ARG PY_VERSION=3.12 # Install Ubuntu dependencies ENV DEBIAN_FRONTEND=noninteractive @@ -54,19 +55,17 @@ RUN apt update \ && update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100 \ && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100 +# Setup uv +COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ +RUN uv venv -p ${PY_VERSION} /opt/venv +ENV VIRTUAL_ENV=/opt/venv +ENV PATH="/opt/venv/bin:$PATH" -# Note: the index page is at https://therock-nightly-tarball.s3.amazonaws.com/index.html -# This will directly download the TheROCK nightly ROCm SDK tarball -ENV THEROCK_TARBALL=https://rocm.nightlies.amd.com/tarball/therock-dist-linux-gfx94X-dcgpu-7.9.0rc20250930.tar.gz - -RUN mkdir -p /opt/rocm \ - && cd /opt/rocm \ - && wget ${THEROCK_TARBALL} \ - && tar -xvf *.tar.gz -C /opt/rocm \ - && rm *.tar.gz \ - # && rm /opt/rocm/bin/flatc \ - && rm -rf /opt/rocm/include/flatbuffers \ - && rm -rf /opt/rocm/lib/libflatbuffers* +# rocm and torch MUST be installed together or torch nightlies will +# mess up the rocm version +RUN uv pip install cmake pybind11 build ninja scikit-build-core setuptools-scm numpy pytest pytest-xdist Pillow && \ + uv pip install --index-url https://rocm.nightlies.amd.com/v2/${GFX_FAMILY}/ "rocm[libraries,devel]"==${THE_ROCK_VERSION} torch==${TORCH_VERSION} && \ + rocm-sdk init # warp_src is a named build context — see file header for invocation details. COPY --from=warp_src . /root/warp/ @@ -78,27 +77,25 @@ RUN test -f /root/warp/pyproject.toml && \ } RUN git config --global --add safe.directory /root/warp -# Setup ROCm stack related envs -# Note: /opt/rocm/lib is intentionally NOT in PATH (it is a library dir, not a bin dir). -ENV PATH="/opt/rocm/bin:$PATH" -ENV LD_LIBRARY_PATH=/opt/rocm/lib -ENV ROCM_PATH=/opt/rocm -ENV HIP_PLATFORM=amd -ENV HIP_DEVICE_LIB_PATH=/opt/rocm/lib/llvm/amdgcn/bitcode -# Workaround for the HAS_STATUS_ERROR_OUT_OF_RESOURCES issue (runtime) -ENV HAS_ENABLE_SCRATCH_ASYNC_RECLAIM=0 -ENV HAS_NO_SCRATCH_RECLAIM=1 - -RUN curl -L micro.mamba.pm/install.sh | bash && \ - ~/.local/bin/micromamba run -n ${MAMBA_ENV_NAME} ~/.local/bin/micromamba install python=${PY_VERSION} -c conda-forge --override-channels -y && \ - ~/.local/bin/micromamba run -n ${MAMBA_ENV_NAME} pip install cmake pybind11 build ninja scikit-build-core setuptools-scm numpy pytest pytest-xdist Pillow && \ - ~/.local/bin/micromamba run -n ${MAMBA_ENV_NAME} pip install --index-url https://rocm.nightlies.amd.com/v2-staging/${GFX_FAMILY}/ --pre torch && \ - /bin/bash -c "eval \"\$(~/.local/bin/micromamba shell hook --shell bash)\" && \ - micromamba activate ${MAMBA_ENV_NAME} && \ - cd /root/warp/ && \ - python build_lib.py --jobs \$(nproc) && \ - python -m build --wheel -C--build-option=-Plinux-x86_64 && \ - pip install dist/warp_lang-*.whl" +# Persist ROCm environment for interactive containers and build scripts +RUN cat <<'EOF' > ~/.rocm-env.sh +export ROCM_PATH=$(rocm-sdk path --root) +export LD_LIBRARY_PATH=$(rocm-sdk path --root)/lib +# necessary for rocm < 7.12 https://github.com/ROCm/TheRock/issues/3213 +export HIP_DEVICE_LIB_PATH=$(rocm-sdk path --root)/lib/llvm/amdgcn/bitcode +EOF +RUN echo 'source ~/.rocm-env.sh' >> ~/.bashrc + +# Build warp_lang wheel +WORKDIR /root/warp +RUN cat <<'EOF' > build.sh +set -euxo pipefail +source ~/.rocm-env.sh +python build_lib.py --jobs $(nproc) 2>&1 | tee build_lib_${THE_ROCK_VERSION}.log +python -m build --wheel -C--build-option=-Plinux-x86_64 +uv pip install dist/warp_lang-*.whl +EOF +RUN /bin/bash build.sh #----------------------------------------------------------------------------- # Stage 2 (warp_base): clean release image shipped to users. @@ -107,22 +104,8 @@ RUN curl -L micro.mamba.pm/install.sh | bash && \ # ----------------------------------------------------------------------------- FROM warp_build AS warp_base -# ARG must be redeclared in each stage that uses it (Docker multi-stage scoping). -ARG MAMBA_ENV_NAME=base - RUN rm -rf /root/warp/ -# Activate the micromamba base env for all shell types: -# - ENV PATH: covers non-interactive shells (docker exec, entrypoints, scripts) -# - shell init + bashrc append: covers interactive bash sessions -ENV MAMBA_ROOT_PREFIX=/root/micromamba -ENV CONDA_PREFIX=/root/micromamba -ENV CONDA_DEFAULT_ENV=${MAMBA_ENV_NAME} -ENV PATH=/root/micromamba/bin:${PATH} - -RUN /root/.local/bin/micromamba shell init --shell bash --root-prefix /root/micromamba && \ -echo "micromamba activate base" >> /root/.bashrc - # ----------------------------------------------------------------------------- # Stage 3 (whl_export): minimal scratch image used only to extract the wheel. # Built by CI with --output type=local — never shipped to users.