From 1be9c207594de9f8dd2547bef954f5d75def6f3f Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Wed, 27 Mar 2024 15:27:16 -0500 Subject: [PATCH] [Libomptarget] Rename `libomptarget.rtl.x86_64` to `libomptarget.rtl.host` Summary: All of these are functionally the same code, just compiled for separate architectures. We currently do not expose a way to execute these on separate architectures as the host plugin works using `dlopen` into the same process, and therefore cannot possibly be an incompatible architecture. (This could work with a remote plugin, but this is not supported yet). This patch simply renames all of these to the same thing so we no longer need to check around for its varying definitions. --- offload/plugins-nextgen/host/CMakeLists.txt | 40 ++++++++++----------- offload/src/CMakeLists.txt | 5 +-- 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/offload/plugins-nextgen/host/CMakeLists.txt b/offload/plugins-nextgen/host/CMakeLists.txt index 7da18ee278d49..6407f72e8db0a 100644 --- a/offload/plugins-nextgen/host/CMakeLists.txt +++ b/offload/plugins-nextgen/host/CMakeLists.txt @@ -14,36 +14,36 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le$") endif() # Create the library and add the default arguments. -add_target_library(omptarget.rtl.${machine} ${machine}) +add_target_library(omptarget.rtl.host ${machine}) -target_sources(omptarget.rtl.${machine} PRIVATE src/rtl.cpp) +target_sources(omptarget.rtl.host PRIVATE src/rtl.cpp) if(LIBOMPTARGET_DEP_LIBFFI_FOUND) libomptarget_say("Building ${machine} plugin linked with libffi") if(FFI_STATIC_LIBRARIES) - target_link_libraries(omptarget.rtl.${machine} PRIVATE FFI::ffi_static) + target_link_libraries(omptarget.rtl.host PRIVATE FFI::ffi_static) else() - target_link_libraries(omptarget.rtl.${machine} PRIVATE FFI::ffi) + target_link_libraries(omptarget.rtl.host PRIVATE FFI::ffi) endif() else() libomptarget_say("Building ${machine} plugin for dlopened libffi") - target_sources(omptarget.rtl.${machine} PRIVATE dynamic_ffi/ffi.cpp) - target_include_directories(omptarget.rtl.${machine} PRIVATE dynamic_ffi) + target_sources(omptarget.rtl.host PRIVATE dynamic_ffi/ffi.cpp) + target_include_directories(omptarget.rtl.host PRIVATE dynamic_ffi) endif() # Install plugin under the lib destination folder. -install(TARGETS omptarget.rtl.${machine} +install(TARGETS omptarget.rtl.host LIBRARY DESTINATION "${OFFLOAD_INSTALL_LIBDIR}") -set_target_properties(omptarget.rtl.${machine} PROPERTIES +set_target_properties(omptarget.rtl.host PROPERTIES INSTALL_RPATH "$ORIGIN" BUILD_RPATH "$ORIGIN:${CMAKE_CURRENT_BINARY_DIR}/.." POSITION_INDEPENDENT_CODE ON CXX_VISIBILITY_PRESET protected) -target_include_directories(omptarget.rtl.${machine} PRIVATE +target_include_directories(omptarget.rtl.host PRIVATE ${LIBOMPTARGET_INCLUDE_DIR}) if(LIBOMPTARGET_DEP_LIBFFI_FOUND) - list(APPEND LIBOMPTARGET_TESTED_PLUGINS omptarget.rtl.${machine}) + list(APPEND LIBOMPTARGET_TESTED_PLUGINS omptarget.rtl.host) set(LIBOMPTARGET_TESTED_PLUGINS "${LIBOMPTARGET_TESTED_PLUGINS}" PARENT_SCOPE) else() @@ -52,36 +52,36 @@ endif() # Define the target specific triples and ELF machine values. if(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le$") - target_compile_definitions(omptarget.rtl.${machine} PRIVATE TARGET_ELF_ID=EM_PPC64) - target_compile_definitions(omptarget.rtl.${machine} PRIVATE + target_compile_definitions(omptarget.rtl.host PRIVATE TARGET_ELF_ID=EM_PPC64) + target_compile_definitions(omptarget.rtl.host PRIVATE LIBOMPTARGET_NEXTGEN_GENERIC_PLUGIN_TRIPLE="powerpc64le-ibm-linux-gnu") list(APPEND LIBOMPTARGET_SYSTEM_TARGETS "powerpc64le-ibm-linux-gnu" "powerpc64le-ibm-linux-gnu-LTO") set(LIBOMPTARGET_SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS}" PARENT_SCOPE) elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64$") - target_compile_definitions(omptarget.rtl.${machine} PRIVATE TARGET_ELF_ID=EM_PPC64) - target_compile_definitions(omptarget.rtl.${machine} PRIVATE + target_compile_definitions(omptarget.rtl.host PRIVATE TARGET_ELF_ID=EM_PPC64) + target_compile_definitions(omptarget.rtl.host PRIVATE LIBOMPTARGET_NEXTGEN_GENERIC_PLUGIN_TRIPLE="powerpc64-ibm-linux-gnu") list(APPEND LIBOMPTARGET_SYSTEM_TARGETS "powerpc64-ibm-linux-gnu" "powerpc64-ibm-linux-gnu-LTO") set(LIBOMPTARGET_SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS}" PARENT_SCOPE) elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64$") - target_compile_definitions(omptarget.rtl.${machine} PRIVATE TARGET_ELF_ID=EM_X86_64) - target_compile_definitions(omptarget.rtl.${machine} PRIVATE + target_compile_definitions(omptarget.rtl.host PRIVATE TARGET_ELF_ID=EM_X86_64) + target_compile_definitions(omptarget.rtl.host PRIVATE LIBOMPTARGET_NEXTGEN_GENERIC_PLUGIN_TRIPLE="x86_64-pc-linux-gnu") list(APPEND LIBOMPTARGET_SYSTEM_TARGETS "x86_64-pc-linux-gnu" "x86_64-pc-linux-gnu-LTO") set(LIBOMPTARGET_SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS}" PARENT_SCOPE) elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64$") - target_compile_definitions(omptarget.rtl.${machine} PRIVATE TARGET_ELF_ID=EM_AARCH64) - target_compile_definitions(omptarget.rtl.${machine} PRIVATE + target_compile_definitions(omptarget.rtl.host PRIVATE TARGET_ELF_ID=EM_AARCH64) + target_compile_definitions(omptarget.rtl.host PRIVATE LIBOMPTARGET_NEXTGEN_GENERIC_PLUGIN_TRIPLE="aarch64-unknown-linux-gnu") list(APPEND LIBOMPTARGET_SYSTEM_TARGETS "aarch64-unknown-linux-gnu" "aarch64-unknown-linux-gnu-LTO") set(LIBOMPTARGET_SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS}" PARENT_SCOPE) elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "s390x$") - target_compile_definitions(omptarget.rtl.${machine} PRIVATE TARGET_ELF_ID=EM_S390) - target_compile_definitions(omptarget.rtl.${machine} PRIVATE + target_compile_definitions(omptarget.rtl.host PRIVATE TARGET_ELF_ID=EM_S390) + target_compile_definitions(omptarget.rtl.host PRIVATE LIBOMPTARGET_NEXTGEN_GENERIC_PLUGIN_TRIPLE="s390x-ibm-linux-gnu") list(APPEND LIBOMPTARGET_SYSTEM_TARGETS "s390x-ibm-linux-gnu" "s390x-ibm-linux-gnu-LTO") diff --git a/offload/src/CMakeLists.txt b/offload/src/CMakeLists.txt index fb1ad3d7ae709..8b7be98771a9e 100644 --- a/offload/src/CMakeLists.txt +++ b/offload/src/CMakeLists.txt @@ -74,12 +74,9 @@ endmacro() set(LIBOMPTARGET_PLUGINS_TO_LOAD "" CACHE STRING "Comma separated list of plugin names to look for at runtime") if (NOT LIBOMPTARGET_PLUGINS_TO_LOAD) - check_plugin_target(ppc64) - check_plugin_target(x86_64) check_plugin_target(cuda) - check_plugin_target(aarch64) check_plugin_target(amdgpu) - check_plugin_target(s390x) + check_plugin_target(host) endif() list(TRANSFORM LIBOMPTARGET_PLUGINS_TO_LOAD PREPEND "\"libomptarget.rtl.")