hipamd icon indicating copy to clipboard operation
hipamd copied to clipboard

hip-config.cmake contains wrong paths when not using /opt/rocm/

Open JacekJagosz opened this issue 3 years ago • 2 comments

This issue comes up when rocm is installed in system directories and not /opt/rocm, for example Fedora package by @Mystro256 and Solus package I have done. When building something relying on hip (in my case rocblas), hip-config.cmake causes problems. Ones I currently found are:

  1. _IMPORT_PREFIX: ${_IMPORT_PREFIX}/../include will mean that it will point to /usr/../include which doesn't exist. Changing all the occurrences to ${_IMPORT_PREFIX}/include it now correctly points to /usr/include
  2. HIP_CLANG_ROOT: When using system's LLVM ${ROCM_PATH}/llvm will not find the correct folders in system directories, like for example it then looks for ${ROCM_PATH}/llvm/clang, and the folder it is looking for is /usr/lib64/clang. So you can't simply set ${ROCM_PATH}, you need to correct this .cmake file too. I had to change ${ROCM_PATH}/llvm to /usr.

Here is the generated hip-config.cmake that is problematic for me (in /usr/lib64/cmake/hip/). And to fix it I did:

sed -i 's|${_IMPORT_PREFIX}/../include|${_IMPORT_PREFIX}/include|g' /usr/lib64/cmake/hip/hip-config.cmake
sed -i 's|"${ROCM_PATH}/llvm"|"/usr"|g' /usr/lib64/cmake/hip/hip-config.cmake

JacekJagosz avatar May 25 '22 15:05 JacekJagosz

Hi, you might need this clang patch:

https://src.fedoraproject.org/rpms/clang/pull-request/156

As I said in the other thread, I would copy the Debian packaging w.r.t. hip, as I've been focusing on functional openCL in the short-term. We've been working with them closely.

On May 25, 2022 11:13:26 a.m. EDT, Jacek Jagosz @.***> wrote:

This issue comes up when rocm is installed in system directories and not /opt/rocm, for example Fedora package by @Mystro256 and Solus package I have done. When building something relying on hip, in my case rocblas hip-config.cmake causes problems. Ones I currently found are:

-- Reply to this email directly or view it on GitHub: https://github.com/ROCm-Developer-Tools/hipamd/issues/27 You are receiving this because you were mentioned.

Message ID: @.***>

Mystro256 avatar May 29 '22 14:05 Mystro256

Unfortunately I was using this patch already, and it even got merged in LLVM 14.0.4. With or without this patch the result was the same. I will definitely go through Debian package and see how they do it, thank you for recommendation, up to this point I have only looked at Fedora and Arch. For now in Solus it also only focuses on OpenCL support, but I try to package more, hope my findings can help Debian or Fedora packagers when they get to it.

JacekJagosz avatar May 30 '22 11:05 JacekJagosz