@@ -521,41 +521,32 @@ if(build_runtimes)
521521 -DIMAGE_SUPPORT=OFF
522522 -DLLVM_RUNTIME_OPENMP=ON )
523523 set (HSA_DEP rocr-runtime)
524+ endif ()
524525
525- # omptarget device RTL depends on device libs, leading to circular dependency in build scripts.
526- # Providing path to the sources enables to build them as part of compiler build, which
527- # removes the ciruclar dependency on the script-side.
528- if (DEFINED LIBOMPTARGET_EXTERNAL_PROJECT_ROCM_DEVICE_LIBS_PATH)
529- message (STATUS "Add external AMD device-libs: ${LIBOMPTARGET_EXTERNAL_PROJECT_ROCM_DEVICE_LIBS_PATH} " )
526+ # omptarget device RTL depends on device libs, leading to circular dependency in build scripts.
527+ # Providing path to the sources enables to build them as part of compiler build, which
528+ # removes the ciruclar dependency on the script-side.
529+ if (DEFINED LIBOMPTARGET_EXTERNAL_PROJECT_ROCM_DEVICE_LIBS_PATH)
530+ message (STATUS "Add external AMD device-libs: ${LIBOMPTARGET_EXTERNAL_PROJECT_ROCM_DEVICE_LIBS_PATH} " )
531+ if (NOT ${ROCM_DEVICE_LIBS_INSTALL_PREFIX_PATH} STREQUAL "" )
530532 ExternalProject_Add(rocm-device-libs
531533 SOURCE_DIR ${LIBOMPTARGET_EXTERNAL_PROJECT_ROCM_DEVICE_LIBS_PATH}
532534 DEPENDS clang llvm-link lld opt llvm-objcopy
533535 CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${ROCM_DEVICE_LIBS_INSTALL_PREFIX_PATH}
534536 -DCMAKE_PREFIX_PATH=${CMAKE_BINARY_DIR} /lib/cmake
535537 -DROCM_DEVICE_LIBS_BITCODE_INSTALL_LOC_NEW=${ROCM_DEVICE_LIBS_BITCODE_INSTALL_LOC}
536538 -DROCM_DEVICE_LIBS_BITCODE_INSTALL_LOC_OLD=amdgcn)
539+ else ()
540+ ExternalProject_Add(rocm-device-libs
541+ SOURCE_DIR ${LIBOMPTARGET_EXTERNAL_PROJECT_ROCM_DEVICE_LIBS_PATH}
542+ DEPENDS clang llvm-link lld opt llvm-objcopy
543+ INSTALL_COMMAND ""
544+ CMAKE_ARGS -DCMAKE_PREFIX_PATH=${CMAKE_BINARY_DIR} /lib/cmake
545+ -DROCM_DEVICE_LIBS_BITCODE_INSTALL_LOC_NEW=${ROCM_DEVICE_LIBS_BITCODE_INSTALL_LOC}
546+ -DROCM_DEVICE_LIBS_BITCODE_INSTALL_LOC_OLD=amdgcn)
537547 endif ()
538548 endif ()
539549
540- if (DEFINED LIBOMPTARGET_EXTERNAL_PROJECT_HSA_PATH AND
541- DEFINED LIBOMPTARGET_EXTERNAL_PROJECT_THUNK_PATH AND
542- DEFINED LIBOMPTARGET_EXTERNAL_PROJECT_ROCM_DEVICE_LIBS_PATH)
543- ExternalProject_Add(roct
544- SOURCE_DIR ${LIBOMPTARGET_EXTERNAL_PROJECT_THUNK_PATH}
545- DEPENDS clang llvm-link lld opt llvm-objcopy
546- INSTALL_COMMAND ""
547- CMAKE_ARGS -DCMAKE_PREFIX_PATH=${CMAKE_BINARY_DIR} /lib/cmake)
548- ExternalProject_Add(rocr-runtime
549- SOURCE_DIR ${LIBOMPTARGET_EXTERNAL_PROJECT_HSA_PATH}
550- DEPENDS clang llvm-link lld opt llvm-objcopy roct
551- INSTALL_COMMAND ""
552- CMAKE_ARGS -DBUILD_SHARED_LIBS=ON -DCMAKE_PREFIX_PATH=${CMAKE_BINARY_DIR} /lib/cmake -DIMAGE_SUPPORT=OFF -DLLVM_RUNTIME_OPENMP=ON -DHSAKMT_SRC_PATH=${LIBOMPTARGET_EXTERNAL_PROJECT_THUNK_PATH} )
553- set (HSA_DEP rocr-runtime)
554- ExternalProject_Add(rocm-device-libs
555- SOURCE_DIR ${LIBOMPTARGET_EXTERNAL_PROJECT_ROCM_DEVICE_LIBS_PATH}
556- DEPENDS clang llvm-link lld opt llvm-objcopy
557- CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${ROCM_DEVICE_LIBS_INSTALL_PREFIX_PATH} -DCMAKE_PREFIX_PATH=${CMAKE_BINARY_DIR} /lib/cmake -DROCM_DEVICE_LIBS_BITCODE_INSTALL_LOC_NEW=${ROCM_DEVICE_LIBS_BITCODE_INSTALL_LOC} -DROCM_DEVICE_LIBS_BITCODE_INSTALL_LOC_OLD=amdgcn)
558- endif ()
559550 if ("AMDGPU" IN_LIST LLVM_TARGETS_TO_BUILD)
560551 set (AMDGPU_ARCH_DEP amdgpu-arch)
561552 endif ()
0 commit comments