diff --git a/openmp/libomptarget/DeviceRTL/CMakeLists.txt b/openmp/libomptarget/DeviceRTL/CMakeLists.txt --- a/openmp/libomptarget/DeviceRTL/CMakeLists.txt +++ b/openmp/libomptarget/DeviceRTL/CMakeLists.txt @@ -31,9 +31,8 @@ find_program(PACKAGER_TOOL clang-offload-packager PATHS ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH) find_program(LINK_TOOL llvm-link PATHS ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH) find_program(OPT_TOOL opt PATHS ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH) - find_program(EXTRACT_TOOL llvm-extract PATHS ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH) - if ((NOT CLANG_TOOL) OR (NOT LINK_TOOL) OR (NOT OPT_TOOL) OR (NOT EXTRACT_TOOL) OR (NOT PACKAGER_TOOL)) - libomptarget_say("Not building DeviceRTL. Missing clang: ${CLANG_TOOL}, llvm-link: ${LINK_TOOL}, opt: ${OPT_TOOL}, llvm-extract: ${EXTRACT_TOOL}, or clang-offload-packager: ${PACKAGER_TOOL}") + if ((NOT CLANG_TOOL) OR (NOT LINK_TOOL) OR (NOT OPT_TOOL) OR (NOT PACKAGER_TOOL)) + libomptarget_say("Not building DeviceRTL. Missing clang: ${CLANG_TOOL}, llvm-link: ${LINK_TOOL}, opt: ${OPT_TOOL}, or clang-offload-packager: ${PACKAGER_TOOL}") return() else() libomptarget_say("Building DeviceRTL. Using clang: ${CLANG_TOOL}, llvm-link: ${LINK_TOOL} and opt: ${OPT_TOOL}") @@ -45,7 +44,6 @@ set(PACKAGER_TOOL $) set(LINK_TOOL $) set(OPT_TOOL $) - set(EXTRACT_TOOL $) libomptarget_say("Building DeviceRTL. Using clang from in-tree build") else() libomptarget_say("Not building DeviceRTL. No appropriate clang found") @@ -114,7 +112,6 @@ set(clang_opt_flags -O3 -mllvm -openmp-opt-disable -DSHARED_SCRATCHPAD_SIZE=512) set(link_opt_flags -O3 -openmp-opt-disable -attributor-enable=module) set(link_export_flag -passes=internalize -internalize-public-api-file=${source_directory}/exports) -set(link_extract_flag --func='__keep_alive' --delete) # Prepend -I to each list element set (LIBOMPTARGET_LLVM_INCLUDE_DIRS_DEVICERTL "${LIBOMPTARGET_LLVM_INCLUDE_DIRS}") @@ -220,18 +217,6 @@ # Install bitcode library under the lib destination folder. install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${bclib_name} DESTINATION "${OPENMP_INSTALL_LIBDIR}") - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/extracted_${bclib_name} - COMMAND ${EXTRACT_TOOL} ${link_extract_flag} ${CMAKE_CURRENT_BINARY_DIR}/${bclib_name} - -o ${CMAKE_CURRENT_BINARY_DIR}/extracted_${bclib_name} - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${bclib_name} ${bclib_target_name} - COMMENT "Extracting LLVM bitcode ${bclib_name}" - ) - if("${EXTRACT_TOOL}" STREQUAL "$") - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/extracted_${bclib_name} - DEPENDS llvm-extract - APPEND) - endif() - set(target_feature "") if("${target_triple}" STREQUAL "nvptx64-nvidia-cuda") set(target_feature "feature=+ptx61") @@ -240,8 +225,8 @@ # Package the bitcode in the bitcode and embed it in an ELF for the static library add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/packaged_${bclib_name} COMMAND ${PACKAGER_TOOL} -o ${CMAKE_CURRENT_BINARY_DIR}/packaged_${bclib_name} - "--image=file=${CMAKE_CURRENT_BINARY_DIR}/extracted_${bclib_name},${target_feature},triple=${target_triple},arch=${target_cpu},kind=openmp" - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/extracted_${bclib_name} + "--image=file=${CMAKE_CURRENT_BINARY_DIR}/${bclib_name},${target_feature},triple=${target_triple},arch=${target_cpu},kind=openmp" + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${bclib_name} COMMENT "Packaging LLVM offloading binary ${bclib_name}.out" ) if("${PACKAGER_TOOL}" STREQUAL "$") diff --git a/openmp/libomptarget/DeviceRTL/src/Utils.cpp b/openmp/libomptarget/DeviceRTL/src/Utils.cpp --- a/openmp/libomptarget/DeviceRTL/src/Utils.cpp +++ b/openmp/libomptarget/DeviceRTL/src/Utils.cpp @@ -21,16 +21,6 @@ extern "C" __attribute__((weak)) int IsSPMDMode; -/// Helper to keep code alive without introducing a performance penalty. -extern "C" __attribute__((weak, optnone, cold, used, retain)) void -__keep_alive() { - __kmpc_get_hardware_thread_id_in_block(); - __kmpc_get_hardware_num_threads_in_block(); - __kmpc_get_warp_size(); - __kmpc_barrier_simple_spmd(nullptr, IsSPMDMode); - __kmpc_barrier_simple_generic(nullptr, IsSPMDMode); -} - namespace impl { bool isSharedMemPtr(const void *Ptr) { return false; } diff --git a/openmp/libomptarget/DeviceRTL/src/exports b/openmp/libomptarget/DeviceRTL/src/exports --- a/openmp/libomptarget/DeviceRTL/src/exports +++ b/openmp/libomptarget/DeviceRTL/src/exports @@ -4,7 +4,6 @@ _ZN4ompx* -__keep_alive IsSPMDMode memcmp