Skip to content

Commit

Permalink
[HIP] Fix libclang_rt.builtins.a not found (#532)
Browse files Browse the repository at this point in the history
* The solution to the libclang_rt builtins problem has changed with newer version of ROCm, as used by the Codeplay AMD plugin. The old suggested solution does not work.
* This PR:
  * Suggests a new solution, with accompanying minor CMake work.
  * Updates documentation.
  • Loading branch information
Rbiessy authored Aug 9, 2024
1 parent 5b5f3f4 commit 09b4123
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
13 changes: 12 additions & 1 deletion cmake/FindCompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,15 @@ if(is_dpcpp)
INTERFACE_LINK_LIBRARIES ${SYCL_LIBRARY})
endif()

endif()
if(ENABLE_ROCBLAS_BACKEND OR ENABLE_ROCRAND_BACKEND OR ENABLE_ROCSOLVER_BACKEND)
# Allow find_package(HIP) to find the correct path to libclang_rt.builtins.a
# HIP's CMake uses the command `${HIP_CXX_COMPILER} -print-libgcc-file-name --rtlib=compiler-rt` to find this path.
# This can print a non-existing file if the compiler used is icpx.
if(NOT HIP_CXX_COMPILER)
find_path(HIP_CXX_COMPILER clang++
HINTS ENV HIPROOT ENV ROCM_PATH
)
endif()
endif()

endif(is_dpcpp)
13 changes: 8 additions & 5 deletions docs/building_the_project_with_dpcpp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -457,11 +457,14 @@ Build FAQ

clangrt builtins lib not found
Encountered when trying to build oneMKL with some ROCm libraries. There are
several possible solutions: * If building Open DPC++ from source, add
``compiler-rt`` to the external projects compile option:
``--llvm-external-projects compiler-rt``. * The *clangrt* from ROCm can be
used, depending on ROCm version: ``export
LIBRARY_PATH=/path/to/rocm-$rocm-version$/llvm/lib/clang/$clang-version$/lib/linux/:$LIBRARY_PATH``
several possible solutions:

* If building Open DPC++ from source, add ``compiler-rt`` to the external
projects compile option: ``--llvm-external-projects compiler-rt``.
* Manually set the variable ``HIP_CXX_COMPILER`` to HIP's toolkit ``clang++``
path, for instance ``-DHIP_CXX_COMPILER=/opt/rocm/6.1.0/llvm/bin/clang++``.
oneMKL may fail to link if the clang versions of ``icpx`` and ``rocm`` are
not compatible.

Could NOT find CBLAS (missing: CBLAS file)
Encountered when tests are enabled along with the BLAS domain. The tests
Expand Down

0 comments on commit 09b4123

Please sign in to comment.