From b604e5f34866fbc39c80f643d1b4f5f076d7083e Mon Sep 17 00:00:00 2001 From: "romain.biessy" Date: Wed, 10 Jul 2024 17:31:41 +0200 Subject: [PATCH 1/2] [HIP] Fix libclang_rt.builtins.a not found --- cmake/FindCompiler.cmake | 13 ++++++++++++- docs/building_the_project_with_dpcpp.rst | 11 ++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/cmake/FindCompiler.cmake b/cmake/FindCompiler.cmake index aeb7ad43d..a8b7d14ee 100644 --- a/cmake/FindCompiler.cmake +++ b/cmake/FindCompiler.cmake @@ -71,4 +71,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) diff --git a/docs/building_the_project_with_dpcpp.rst b/docs/building_the_project_with_dpcpp.rst index 365028237..9cd4a666f 100644 --- a/docs/building_the_project_with_dpcpp.rst +++ b/docs/building_the_project_with_dpcpp.rst @@ -457,11 +457,12 @@ 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++``. Could NOT find CBLAS (missing: CBLAS file) Encountered when tests are enabled along with the BLAS domain. The tests From 41ed84ce38f4e8fca5fccdefb570cef00c781c58 Mon Sep 17 00:00:00 2001 From: "romain.biessy" Date: Mon, 15 Jul 2024 11:17:45 +0200 Subject: [PATCH 2/2] Document rocm backends may fail to link --- docs/building_the_project_with_dpcpp.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/building_the_project_with_dpcpp.rst b/docs/building_the_project_with_dpcpp.rst index 9cd4a666f..40ac91ea8 100644 --- a/docs/building_the_project_with_dpcpp.rst +++ b/docs/building_the_project_with_dpcpp.rst @@ -463,6 +463,8 @@ clangrt builtins lib not found 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