From 66369a64c38ef5db6d2cd0fc7701688f872855f1 Mon Sep 17 00:00:00 2001 From: Jithun Nair Date: Fri, 18 Aug 2023 18:46:25 +0000 Subject: [PATCH] Add ROCM_PATH env var to resolve cmake issue in finding HIP package This is necessitated because we updated the LoadHip.cmake file in release branches of PyTorch for ROCm6.0 changes, which involved using the HIP cmake file from ${ROCM_PATH}/lib/cmake/hip, instead of ${HIP_PATH}/cmake The FindHIP.cmake file at that location has the following code: get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_DIR}/../" REALPATH) find_path( HIP_ROOT_DIR NAMES bin/hipconfig PATHS "$ENV{ROCM_PATH}" "$ENV{ROCM_PATH}/hip" ENV HIP_PATH ${_IMPORT_PREFIX} DOC "HIP installed location" NO_DEFAULT_PATH ) If ROCM_PATH env var is not defined, it will look for bin/hipconfig in in /opt/rocm/lib/cmake instead of /opt/rocm/hip, where it'd have found it before we made the change in LoadHIP.cmake. To keep the ROCm6.0-compatible changes as-is, we define the ROCM_PATH env var to fix ROCm5.7 builds. --- libtorch/Dockerfile | 2 ++ manywheel/Dockerfile | 2 ++ 2 files changed, 4 insertions(+) diff --git a/libtorch/Dockerfile b/libtorch/Dockerfile index a71d78594..3a3893db1 100644 --- a/libtorch/Dockerfile +++ b/libtorch/Dockerfile @@ -60,6 +60,8 @@ FROM cpu as rocm ARG PYTORCH_ROCM_ARCH ENV PYTORCH_ROCM_ARCH ${PYTORCH_ROCM_ARCH} ENV MKLROOT /opt/intel +# Adding ROCM_PATH env var so that cmake find HIP works +ENV ROCM_PATH /opt/rocm # No need to install ROCm as base docker image should have full ROCm install #ADD ./common/install_rocm.sh install_rocm.sh ADD ./common/install_rocm_drm.sh install_rocm_drm.sh diff --git a/manywheel/Dockerfile b/manywheel/Dockerfile index 44d8f7de1..d1b332873 100644 --- a/manywheel/Dockerfile +++ b/manywheel/Dockerfile @@ -160,6 +160,8 @@ ARG ROCM_VERSION=3.7 ARG PYTORCH_ROCM_ARCH ARG PYTORCH_BRANCH ENV PYTORCH_ROCM_ARCH ${PYTORCH_ROCM_ARCH} +# Adding ROCM_PATH env var so that cmake find HIP works +ENV ROCM_PATH /opt/rocm # No need to install ROCm as base docker image should have full ROCm install #ADD ./common/install_rocm.sh install_rocm.sh #RUN ROCM_VERSION=${ROCM_VERSION} bash ./install_rocm.sh && rm install_rocm.sh