Skip to content

Commit

Permalink
[OpenMP] Delete old plugins
Browse files Browse the repository at this point in the history
It's time to remove the old plugins as the next-gen has already been set
to default in LLVM 16.

Reviewed By: tianshilei1992

Differential Revision: https://reviews.llvm.org/D142820
  • Loading branch information
jhuber6 committed Jul 5, 2023
1 parent 70c08db commit e90ab91
Show file tree
Hide file tree
Showing 50 changed files with 35 additions and 7,228 deletions.
2 changes: 1 addition & 1 deletion openmp/docs/design/Runtimes.rst
Expand Up @@ -1378,7 +1378,7 @@ clause. Examples for both are given below.
.. code-block:: console
$ clang++ -fopenmp --offload-arch=gfx90a -O3 shared.c
$ env LIBOMPTARGET_NEXTGEN_PLUGINS=1 ./shared
$ env ./shared
.. _libomptarget_device_debugging:
Expand Down
1 change: 0 additions & 1 deletion openmp/libomptarget/CMakeLists.txt
Expand Up @@ -105,7 +105,6 @@ set(LIBOMPTARGET_LLVM_LIBRARY_DIR "${LLVM_LIBRARY_DIR}" CACHE STRING
"Path to folder containing llvm library libomptarget.so")

# Build offloading plugins and device RTLs if they are available.
add_subdirectory(plugins)
add_subdirectory(plugins-nextgen)
add_subdirectory(DeviceRTL)
add_subdirectory(tools)
Expand Down
16 changes: 8 additions & 8 deletions openmp/libomptarget/plugins-nextgen/CMakeLists.txt
Expand Up @@ -12,12 +12,12 @@

add_subdirectory(common)

# void build_generic_elf64_nextgen(string tmachine, string tmachine_name, string tmachine_libname, string elf_machine_id);
# void build_generic_elf64(string tmachine, string tmachine_name, string tmachine_libname, string elf_machine_id);
# - build a plugin for an ELF based generic 64-bit target based on libffi.
# - tmachine: name of the machine processor as used in the cmake build system.
# - tmachine_name: name of the machine to be printed with the debug messages.
# - tmachine_libname: machine name to be appended to the plugin library name.
macro(build_generic_elf64_nextgen tmachine tmachine_name tmachine_libname tmachine_triple elf_machine_id)
macro(build_generic_elf64 tmachine tmachine_name tmachine_libname tmachine_triple elf_machine_id)
if(CMAKE_SYSTEM_PROCESSOR MATCHES "${tmachine}$")
if(LIBOMPTARGET_DEP_LIBFFI_FOUND)

Expand All @@ -36,7 +36,7 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "${tmachine}$")
# Define target regiple
add_definitions("-DLIBOMPTARGET_NEXTGEN_GENERIC_PLUGIN_TRIPLE=${tmachine}")

add_llvm_library("omptarget.rtl.${tmachine_libname}.nextgen"
add_llvm_library("omptarget.rtl.${tmachine_libname}"
SHARED

${CMAKE_CURRENT_SOURCE_DIR}/../generic-elf-64bit/src/rtl.cpp
Expand All @@ -58,23 +58,23 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "${tmachine}$")
)

if (LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
target_link_libraries("omptarget.rtl.${tmachine_libname}.nextgen" PRIVATE
target_link_libraries("omptarget.rtl.${tmachine_libname}" PRIVATE
"-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exports")
endif()

# Install plugin under the lib destination folder.
install(TARGETS "omptarget.rtl.${tmachine_libname}.nextgen"
install(TARGETS "omptarget.rtl.${tmachine_libname}"
LIBRARY DESTINATION "${OPENMP_INSTALL_LIBDIR}")
set_target_properties("omptarget.rtl.${tmachine_libname}.nextgen" PROPERTIES
set_target_properties("omptarget.rtl.${tmachine_libname}" PROPERTIES
INSTALL_RPATH "$ORIGIN" BUILD_RPATH "$ORIGIN:${CMAKE_CURRENT_BINARY_DIR}/.."
CXX_VISIBILITY_PRESET protected)

target_include_directories( "omptarget.rtl.${tmachine_libname}.nextgen" PRIVATE
target_include_directories( "omptarget.rtl.${tmachine_libname}" PRIVATE
${LIBOMPTARGET_INCLUDE_DIR}
${LIBOMPTARGET_DEP_LIBFFI_INCLUDE_DIR})

list(APPEND LIBOMPTARGET_TESTED_PLUGINS
"omptarget.rtl.${tmachine_libname}.nextgen")
"omptarget.rtl.${tmachine_libname}")

else(LIBOMPTARGET_DEP_LIBFFI_FOUND)
libomptarget_say("Not building ${tmachine_name} NextGen offloading plugin: libffi dependency not found.")
Expand Down
2 changes: 1 addition & 1 deletion openmp/libomptarget/plugins-nextgen/aarch64/CMakeLists.txt
Expand Up @@ -11,7 +11,7 @@
##===----------------------------------------------------------------------===##

if(CMAKE_SYSTEM_NAME MATCHES "Linux")
build_generic_elf64_nextgen("aarch64" "aarch64" "aarch64" "aarch64-unknown-linux-gnu" "183")
build_generic_elf64("aarch64" "aarch64" "aarch64" "aarch64-unknown-linux-gnu" "183")
else()
libomptarget_say("Not building aarch64 NextGen offloading plugin: machine not found in the system.")
endif()
16 changes: 8 additions & 8 deletions openmp/libomptarget/plugins-nextgen/amdgpu/CMakeLists.txt
Expand Up @@ -52,8 +52,8 @@ if (${hsa-runtime64_FOUND} AND NOT LIBOMPTARGET_FORCE_DLOPEN_LIBHSA)
set(LIBOMPTARGET_DEP_LIBRARIES hsa-runtime64::hsa-runtime64)
else()
libomptarget_say("Building AMDGPU NextGen plugin for dlopened libhsa")
include_directories(../../plugins/amdgpu/dynamic_hsa)
set(LIBOMPTARGET_EXTRA_SOURCE ../../plugins/amdgpu/dynamic_hsa/hsa.cpp)
include_directories(dynamic_hsa)
set(LIBOMPTARGET_EXTRA_SOURCE dynamic_hsa/hsa.cpp)
set(LIBOMPTARGET_DEP_LIBRARIES)
endif()

Expand All @@ -66,7 +66,7 @@ else()
set(LDFLAGS_UNDEFINED "-Wl,-z,defs")
endif()

add_llvm_library(omptarget.rtl.amdgpu.nextgen SHARED
add_llvm_library(omptarget.rtl.amdgpu SHARED
src/rtl.cpp
${LIBOMPTARGET_EXTRA_SOURCE}

Expand All @@ -91,24 +91,24 @@ add_llvm_library(omptarget.rtl.amdgpu.nextgen SHARED
)

if ((OMPT_TARGET_DEFAULT) AND (LIBOMPTARGET_OMPT_SUPPORT))
target_link_libraries(omptarget.rtl.amdgpu.nextgen PRIVATE OMPT)
target_link_libraries(omptarget.rtl.amdgpu PRIVATE OMPT)
endif()

if (LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
target_link_libraries(omptarget.rtl.amdgpu.nextgen PRIVATE
target_link_libraries(omptarget.rtl.amdgpu PRIVATE
"-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exports")
endif()

target_include_directories(
omptarget.rtl.amdgpu.nextgen
omptarget.rtl.amdgpu
PRIVATE
${LIBOMPTARGET_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/utils
)


# Install plugin under the lib destination folder.
install(TARGETS omptarget.rtl.amdgpu.nextgen LIBRARY DESTINATION "${OPENMP_INSTALL_LIBDIR}")
set_target_properties(omptarget.rtl.amdgpu.nextgen PROPERTIES
install(TARGETS omptarget.rtl.amdgpu LIBRARY DESTINATION "${OPENMP_INSTALL_LIBDIR}")
set_target_properties(omptarget.rtl.amdgpu PROPERTIES
INSTALL_RPATH "$ORIGIN" BUILD_RPATH "$ORIGIN:${CMAKE_CURRENT_BINARY_DIR}/.."
CXX_VISIBILITY_PRESET protected)
2 changes: 2 additions & 0 deletions openmp/libomptarget/plugins-nextgen/common/CMakeLists.txt
Expand Up @@ -12,3 +12,5 @@

add_subdirectory(OMPT)
add_subdirectory(PluginInterface)
add_subdirectory(MemoryManager)
add_subdirectory(elf_common)
Expand Up @@ -11,7 +11,7 @@
##===----------------------------------------------------------------------===##

# NOTE: Don't try to build `elf_common` using `add_llvm_library`.
# See openmp/libomptarget/plugins-nextgen/common/PluginInterface/CMakeLists.txt
# See openmp/libomptarget/plugins/common/PluginInterface/CMakeLists.txt
# for more explanation.
add_library(elf_common OBJECT elf_common.cpp ELFSymbols.cpp)

Expand Down
22 changes: 11 additions & 11 deletions openmp/libomptarget/plugins-nextgen/cuda/CMakeLists.txt
Expand Up @@ -26,7 +26,7 @@ libomptarget_say("Building CUDA NextGen offloading plugin.")
set(LIBOMPTARGET_DLOPEN_LIBCUDA OFF)
option(LIBOMPTARGET_FORCE_DLOPEN_LIBCUDA "Build with dlopened libcuda" ${LIBOMPTARGET_DLOPEN_LIBCUDA})

add_llvm_library(omptarget.rtl.cuda.nextgen SHARED
add_llvm_library(omptarget.rtl.cuda SHARED
src/rtl.cpp

LINK_COMPONENTS
Expand All @@ -43,33 +43,33 @@ add_llvm_library(omptarget.rtl.cuda.nextgen SHARED
)

if ((OMPT_TARGET_DEFAULT) AND (LIBOMPTARGET_OMPT_SUPPORT))
target_link_libraries(omptarget.rtl.cuda.nextgen PRIVATE OMPT)
target_link_libraries(omptarget.rtl.cuda PRIVATE OMPT)
endif()

if (LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
target_link_libraries(omptarget.rtl.cuda.nextgen PRIVATE
target_link_libraries(omptarget.rtl.cuda PRIVATE
"-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exports,-z,defs")
endif()


if(LIBOMPTARGET_DEP_CUDA_FOUND AND NOT LIBOMPTARGET_FORCE_DLOPEN_LIBCUDA)
libomptarget_say("Building CUDA plugin linked against libcuda")
target_link_libraries(omptarget.rtl.cuda.nextgen PRIVATE CUDA::cuda_driver)
target_link_libraries(omptarget.rtl.cuda PRIVATE CUDA::cuda_driver)
else()
libomptarget_say("Building CUDA plugin for dlopened libcuda")
target_include_directories(omptarget.rtl.cuda.nextgen PRIVATE ../../plugins/cuda/dynamic_cuda)
target_sources(omptarget.rtl.cuda.nextgen PRIVATE ../../plugins/cuda/dynamic_cuda/cuda.cpp)
target_include_directories(omptarget.rtl.cuda PRIVATE dynamic_cuda)
target_sources(omptarget.rtl.cuda PRIVATE dynamic_cuda/cuda.cpp)
endif()

# Define debug prefix. TODO: This should be automatized in the Debug.h but it
# requires changing the original plugins.
target_compile_definitions(omptarget.rtl.cuda.nextgen PRIVATE TARGET_NAME="CUDA")
target_compile_definitions(omptarget.rtl.cuda.nextgen PRIVATE DEBUG_PREFIX="TARGET CUDA RTL")
target_compile_definitions(omptarget.rtl.cuda PRIVATE TARGET_NAME="CUDA")
target_compile_definitions(omptarget.rtl.cuda PRIVATE DEBUG_PREFIX="TARGET CUDA RTL")

target_include_directories(omptarget.rtl.cuda.nextgen PRIVATE ${LIBOMPTARGET_INCLUDE_DIR})
target_include_directories(omptarget.rtl.cuda PRIVATE ${LIBOMPTARGET_INCLUDE_DIR})

# Install plugin under the lib destination folder.
install(TARGETS omptarget.rtl.cuda.nextgen LIBRARY DESTINATION "${OPENMP_INSTALL_LIBDIR}")
set_target_properties(omptarget.rtl.cuda.nextgen PROPERTIES
install(TARGETS omptarget.rtl.cuda LIBRARY DESTINATION "${OPENMP_INSTALL_LIBDIR}")
set_target_properties(omptarget.rtl.cuda PROPERTIES
INSTALL_RPATH "$ORIGIN" BUILD_RPATH "$ORIGIN:${CMAKE_CURRENT_BINARY_DIR}/.."
CXX_VISIBILITY_PRESET protected)
2 changes: 1 addition & 1 deletion openmp/libomptarget/plugins-nextgen/ppc64/CMakeLists.txt
Expand Up @@ -11,7 +11,7 @@
##===----------------------------------------------------------------------===##

if(CMAKE_SYSTEM_NAME MATCHES "Linux")
build_generic_elf64_nextgen("ppc64" "PPC64" "ppc64" "powerpc64-ibm-linux-gnu" "21")
build_generic_elf64("ppc64" "PPC64" "ppc64" "powerpc64-ibm-linux-gnu" "21")
else()
libomptarget_say("Not building ppc64 NextGen offloading plugin: machine not found in the system.")
endif()
2 changes: 1 addition & 1 deletion openmp/libomptarget/plugins-nextgen/ppc64le/CMakeLists.txt
Expand Up @@ -11,7 +11,7 @@
##===----------------------------------------------------------------------===##

if(CMAKE_SYSTEM_NAME MATCHES "Linux")
build_generic_elf64_nextgen("ppc64le" "PPC64le" "ppc64" "powerpc64le-ibm-linux-gnu" "21")
build_generic_elf64("ppc64le" "PPC64le" "ppc64" "powerpc64le-ibm-linux-gnu" "21")
else()
libomptarget_say("Not building ppc64le NextGen offloading plugin: machine not found in the system.")
endif()
2 changes: 1 addition & 1 deletion openmp/libomptarget/plugins-nextgen/x86_64/CMakeLists.txt
Expand Up @@ -11,7 +11,7 @@
##===----------------------------------------------------------------------===##

if(CMAKE_SYSTEM_NAME MATCHES "Linux")
build_generic_elf64_nextgen("x86_64" "x86_64" "x86_64" "x86_64-pc-linux-gnu" "62")
build_generic_elf64("x86_64" "x86_64" "x86_64" "x86_64-pc-linux-gnu" "62")
else()
libomptarget_say("Not building x86_64 NextGen offloading plugin: machine not found in the system.")
endif()
89 changes: 0 additions & 89 deletions openmp/libomptarget/plugins/CMakeLists.txt

This file was deleted.

17 changes: 0 additions & 17 deletions openmp/libomptarget/plugins/aarch64/CMakeLists.txt

This file was deleted.

0 comments on commit e90ab91

Please sign in to comment.