Skip to content

Commit fd89fa2

Browse files
authored
[runtimes] - Use extra_cmake_args for rocr/rocm-device-libs external … (llvm#3132)
…build The user's CMAKE_PREFIX_PATH and CMAKE_PROGRAM_PATH were not being passed through to the runtimes build. When the external rocr or rocm-device-libs build is triggered, we will prepend a path to the user provided path so that the llvm config can be found in the build tree.
1 parent a05f5ad commit fd89fa2

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

llvm/runtimes/CMakeLists.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,9 @@ if(build_runtimes)
506506
if("offload" IN_LIST LLVM_ENABLE_RUNTIMES)
507507
# With ROCm 6.3 the ROCr runtime and the thunk layer share a single repository.
508508
# No need to provide a separate path for ROCt.
509+
if (OFFLOAD_EXTERNAL_PROJECT_UNIFIED_ROCR OR DEFINED LIBOMPTARGET_EXTERNAL_PROJECT_ROCM_DEVICE_LIBS_PATH)
510+
list(APPEND extra_cmake_args "-DCMAKE_PREFIX_PATH=${CMAKE_BINARY_DIR}/lib/cmake;${CMAKE_PREFIX_PATH}")
511+
endif()
509512
if (OFFLOAD_EXTERNAL_PROJECT_UNIFIED_ROCR)
510513
if(NOT DEFINED LIBOMPTARGET_EXTERNAL_PROJECT_HSA_PATH)
511514
message(SEND_ERROR "External ROCr requires setting LIBOMPTARGET_EXTERNAL_PROJECT_HSA_PATH")
@@ -517,9 +520,9 @@ if(build_runtimes)
517520
DEPENDS clang llvm-link lld opt llvm-objcopy
518521
INSTALL_COMMAND ""
519522
CMAKE_ARGS -DBUILD_SHARED_LIBS=ON
520-
-DCMAKE_PREFIX_PATH=${CMAKE_BINARY_DIR}/lib/cmake
521523
-DIMAGE_SUPPORT=OFF
522-
-DLLVM_RUNTIME_OPENMP=ON)
524+
-DLLVM_RUNTIME_OPENMP=ON
525+
${extra_cmake_args})
523526
set(HSA_DEP rocr-runtime)
524527
endif()
525528

@@ -533,9 +536,9 @@ if(build_runtimes)
533536
SOURCE_DIR ${LIBOMPTARGET_EXTERNAL_PROJECT_ROCM_DEVICE_LIBS_PATH}
534537
DEPENDS clang llvm-link lld opt llvm-objcopy
535538
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${ROCM_DEVICE_LIBS_INSTALL_PREFIX_PATH}
536-
-DCMAKE_PREFIX_PATH=${CMAKE_BINARY_DIR}/lib/cmake
537539
-DROCM_DEVICE_LIBS_BITCODE_INSTALL_LOC_NEW=${ROCM_DEVICE_LIBS_BITCODE_INSTALL_LOC}
538-
-DROCM_DEVICE_LIBS_BITCODE_INSTALL_LOC_OLD=amdgcn)
540+
-DROCM_DEVICE_LIBS_BITCODE_INSTALL_LOC_OLD=amdgcn
541+
${extra_cmake_args})
539542
else()
540543
ExternalProject_Add(rocm-device-libs
541544
SOURCE_DIR ${LIBOMPTARGET_EXTERNAL_PROJECT_ROCM_DEVICE_LIBS_PATH}

0 commit comments

Comments
 (0)