Skip to content

Commit

Permalink
Add ROCM_PATH env var to resolve cmake issue in finding HIP package
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jithunnair-amd committed Aug 18, 2023
1 parent 6987207 commit 66369a6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libtorch/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions manywheel/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 66369a6

Please sign in to comment.