Skip to content

Commit a05f5ad

Browse files
authored
Amd/dev/estewart/cherry pick openmp offload runtime build support (llvm#3046)
2 parents 511f469 + ff58d3a commit a05f5ad

File tree

5 files changed

+17
-25
lines changed

5 files changed

+17
-25
lines changed

clang/tools/amdllvm/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ option(CLANG_LINK_FLANG "Create flang install link to clang" ON)
1111
list(APPEND CLANG_LINKS_TO_CREATE clang clang++ clang-cl clang-cpp clang-${CLANG_VERSION_MAJOR} lld)
1212

1313
if(CLANG_LINK_FLANG)
14-
list(APPEND CLANG_LINKS_TO_CREATE flang flang-new flang-classic)
14+
list(APPEND CLANG_LINKS_TO_CREATE flang flang-new)
1515
endif()
1616

1717
foreach(link ${CLANG_LINKS_TO_CREATE})

flang/EnableFlangBuild

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DisableClassic

llvm/runtimes/CMakeLists.txt

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -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()

offload/EnableOffloadRuntime

Whitespace-only changes.

openmp/EnableOpenmpRuntime

Whitespace-only changes.

0 commit comments

Comments
 (0)