[Openmp-commits] [openmp] [Libomptarget] Make a plugin specific namespace for each library (PR #86315)

via Openmp-commits openmp-commits at lists.llvm.org
Fri Mar 22 10:39:26 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-amdgpu

Author: Joseph Huber (jhuber6)

<details>
<summary>Changes</summary>

Summary:
Currently, we get to avoid function collisions due to the fact that
these are built as shared libraries. However, when moving to static
libraries these interface functions will all conflict with eachother.
This patch changes the existing `plugin::` namespace to be a macro
defined by the built library. This means that the resulting symbols will
look like `omp::target::amdgpu::...`.
Depends on https://github.com/llvm/llvm-project/pull/86191 


---

Patch is 37.36 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/86315.diff


20 Files Affected:

- (modified) openmp/libomptarget/plugins-nextgen/CMakeLists.txt (+97-1) 
- (modified) openmp/libomptarget/plugins-nextgen/amdgpu/CMakeLists.txt (+13-67) 
- (modified) openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp (+2-2) 
- (modified) openmp/libomptarget/plugins-nextgen/amdgpu/utils/UtilitiesRTL.h (+2-2) 
- (removed) openmp/libomptarget/plugins-nextgen/common/CMakeLists.txt (-110) 
- (removed) openmp/libomptarget/plugins-nextgen/common/OMPT/CMakeLists.txt (-70) 
- (modified) openmp/libomptarget/plugins-nextgen/common/include/GlobalHandler.h (+2-2) 
- (modified) openmp/libomptarget/plugins-nextgen/common/include/JIT.h (+3-3) 
- (modified) openmp/libomptarget/plugins-nextgen/common/include/PluginInterface.h (+2-2) 
- (modified) openmp/libomptarget/plugins-nextgen/common/include/RPC.h (+10-10) 
- (modified) openmp/libomptarget/plugins-nextgen/common/src/GlobalHandler.cpp (+1-1) 
- (modified) openmp/libomptarget/plugins-nextgen/common/src/JIT.cpp (+1-1) 
- (modified) openmp/libomptarget/plugins-nextgen/common/src/PluginInterface.cpp (+2-2) 
- (modified) openmp/libomptarget/plugins-nextgen/common/src/RPC.cpp (+22-22) 
- (modified) openmp/libomptarget/plugins-nextgen/cuda/CMakeLists.txt (+5-35) 
- (modified) openmp/libomptarget/plugins-nextgen/cuda/src/rtl.cpp (+2-2) 
- (modified) openmp/libomptarget/plugins-nextgen/host/CMakeLists.txt (+4-25) 
- (modified) openmp/libomptarget/plugins-nextgen/host/src/rtl.cpp (+2-2) 
- (modified) openmp/libomptarget/test/offloading/ompx_bare.c (+3-1) 
- (modified) openmp/libomptarget/test/offloading/struct_mapping_with_pointers.cpp (+3-3) 


``````````diff
diff --git a/openmp/libomptarget/plugins-nextgen/CMakeLists.txt b/openmp/libomptarget/plugins-nextgen/CMakeLists.txt
index 75540f0558442e..3d9e1db6ad8b1c 100644
--- a/openmp/libomptarget/plugins-nextgen/CMakeLists.txt
+++ b/openmp/libomptarget/plugins-nextgen/CMakeLists.txt
@@ -10,7 +10,103 @@
 #
 ##===----------------------------------------------------------------------===##
 
-add_subdirectory(common)
+# Common interface to handle creating a plugin library.
+set(common_dir ${CMAKE_CURRENT_SOURCE_DIR}/common)
+function(add_target_library target_name lib_name plugin_target)
+  llvm_map_components_to_libnames(llvm_libs
+    ${LLVM_TARGETS_TO_BUILD}
+    AggressiveInstCombine
+    Analysis
+    BinaryFormat
+    BitReader
+    BitWriter
+    CodeGen
+    Core
+    Extensions
+    InstCombine
+    Instrumentation
+    IPO
+    IRReader
+    Linker
+    MC
+    Object
+    Passes
+    Remarks
+    ScalarOpts
+    Support
+    Target
+    TargetParser
+    TransformUtils
+    Vectorize
+  )
+
+  add_llvm_library(${target_name} SHARED
+    ${common_dir}/src/PluginInterface.cpp
+    ${common_dir}/src/GlobalHandler.cpp
+    ${common_dir}/src/JIT.cpp
+    ${common_dir}/src/RPC.cpp
+    ${common_dir}/src/Utils/ELF.cpp
+
+    NO_INSTALL_RPATH
+    BUILDTREE_ONLY
+  )
+
+  target_link_libraries(${target_name} PUBLIC ${llvm_libs} ${OPENMP_PTHREAD_LIB})
+  llvm_update_compile_flags(${target_name})
+
+  # Include the RPC server from the `libc` project if availible.
+  if(TARGET llvmlibc_rpc_server AND ${LIBOMPTARGET_GPU_LIBC_SUPPORT})
+    target_link_libraries(${target_name} PRIVATE llvmlibc_rpc_server)
+    target_compile_definitions(${target_name} PRIVATE LIBOMPTARGET_RPC_SUPPORT)
+  elseif(${LIBOMPTARGET_GPU_LIBC_SUPPORT})
+    find_library(llvmlibc_rpc_server NAMES llvmlibc_rpc_server
+                 PATHS ${LIBOMPTARGET_LLVM_LIBRARY_DIR} NO_DEFAULT_PATH)
+    if(llvmlibc_rpc_server)
+      target_link_libraries(${target_name} PRIVATE ${llvmlibc_rpc_server})
+      target_compile_definitions(${target_name} PRIVATE LIBOMPTARGET_RPC_SUPPORT)
+      # We may need to get the headers directly from the 'libc' source directory.
+      target_include_directories(${target_name} PRIVATE
+                                 ${CMAKE_SOURCE_DIR}/../libc/utils/gpu/server
+                                 ${CMAKE_SOURCE_DIR}/../libc/include)
+    endif()
+  endif()
+
+  # Only enable JIT for those targets that LLVM can support.
+  string(TOUPPER "${LLVM_TARGETS_TO_BUILD}" TargetsSupported)
+  foreach(Target ${TargetsSupported})
+    target_compile_definitions(${target_name} PRIVATE "LIBOMPTARGET_JIT_${Target}")
+  endforeach()
+
+  target_compile_definitions(${target_name} PRIVATE PLUGIN=${plugin_target})
+  target_compile_definitions(${target_name} PRIVATE TARGET_NAME=${lib_name})
+  target_compile_definitions(${target_name} PRIVATE 
+                             DEBUG_PREFIX="TARGET ${lib_name} RTL")
+
+  # If we have OMPT enabled include it in the list of sourced.
+  if (OMPT_TARGET_DEFAULT AND LIBOMPTARGET_OMPT_SUPPORT)
+    target_sources(${target_name} PRIVATE ${common_dir}/OMPT/OmptCallback.cpp)
+  endif()
+
+  if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+    # On FreeBSD, the 'environ' symbol is undefined at link time, but resolved by
+    # the dynamic linker at runtime. Therefore, allow the symbol to be undefined
+    # when creating a shared library.
+    target_link_libraries(${target_name} PRIVATE "-Wl,--allow-shlib-undefined")
+  else()
+    target_link_libraries(${target_name} PRIVATE "-Wl,-z,defs")
+  endif()
+
+  target_include_directories(${target_name} PRIVATE
+    ${LIBOMPTARGET_INCLUDE_DIR}
+    ${common_dir}/include
+  )
+  if(LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
+    target_link_libraries(${target_name} PRIVATE
+    "-Wl,--version-script=${common_dir}/../exports")
+  endif()
+  set_target_properties(${target_name} PROPERTIES CXX_VISIBILITY_PRESET protected)
+endfunction()
+
 add_subdirectory(amdgpu)
 add_subdirectory(cuda)
 add_subdirectory(host)
diff --git a/openmp/libomptarget/plugins-nextgen/amdgpu/CMakeLists.txt b/openmp/libomptarget/plugins-nextgen/amdgpu/CMakeLists.txt
index 8fbfe4d9b13f73..30d7d8defa9d1c 100644
--- a/openmp/libomptarget/plugins-nextgen/amdgpu/CMakeLists.txt
+++ b/openmp/libomptarget/plugins-nextgen/amdgpu/CMakeLists.txt
@@ -27,76 +27,23 @@ if(NOT (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64)|(ppc64le)|(aarch64)$" AND CMAKE
   return()
 endif()
 
-################################################################################
-# Define the suffix for the runtime messaging dumps.
-add_definitions(-DTARGET_NAME=AMDGPU)
-
-# Define debug prefix. TODO: This should be automatized in the Debug.h but it
-# requires changing the original plugins.
-add_definitions(-DDEBUG_PREFIX="TARGET AMDGPU RTL")
+# Create the library and add the default arguments.
+add_target_library(omptarget.rtl.amdgpu AMDGPU amdgpu)
 
-set(LIBOMPTARGET_DLOPEN_LIBHSA OFF)
-option(LIBOMPTARGET_FORCE_DLOPEN_LIBHSA "Build with dlopened libhsa" ${LIBOMPTARGET_DLOPEN_LIBHSA})
-
-if (${hsa-runtime64_FOUND} AND NOT LIBOMPTARGET_FORCE_DLOPEN_LIBHSA)
-  libomptarget_say("Building AMDGPU NextGen plugin linked against libhsa")
-  set(LIBOMPTARGET_EXTRA_SOURCE)
-  set(LIBOMPTARGET_DEP_LIBRARIES hsa-runtime64::hsa-runtime64)
-else()
-  libomptarget_say("Building AMDGPU NextGen plugin for dlopened libhsa")
-  include_directories(dynamic_hsa)
-  set(LIBOMPTARGET_EXTRA_SOURCE dynamic_hsa/hsa.cpp)
-  set(LIBOMPTARGET_DEP_LIBRARIES)
-endif()
+target_sources(omptarget.rtl.amdgpu PRIVATE src/rtl.cpp)
+target_include_directories(omptarget.rtl.amdgpu PRIVATE
+                           ${CMAKE_CURRENT_SOURCE_DIR}/utils)
 
-if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
-  # On FreeBSD, the 'environ' symbol is undefined at link time, but resolved by
-  # the dynamic linker at runtime. Therefore, allow the symbol to be undefined
-  # when creating a shared library.
-  set(LDFLAGS_UNDEFINED "-Wl,--allow-shlib-undefined")
+option(LIBOMPTARGET_FORCE_DLOPEN_LIBHSA "Build with dlopened libhsa" OFF)
+if(hsa-runtime64_FOUND AND NOT LIBOMPTARGET_FORCE_DLOPEN_LIBHSA)
+  libomptarget_say("Building AMDGPU plugin linked against libhsa")
+  target_link_libraries(omptarget.rtl.amdgpu PRIVATE hsa-runtime64::hsa-runtime64)
 else()
-  set(LDFLAGS_UNDEFINED "-Wl,-z,defs")
+  libomptarget_say("Building AMDGPU plugin for dlopened libhsa")
+  target_include_directories(omptarget.rtl.amdgpu PRIVATE dynamic_hsa)
+  target_sources(omptarget.rtl.amdgpu PRIVATE dynamic_hsa/hsa.cpp)
 endif()
 
-add_llvm_library(omptarget.rtl.amdgpu SHARED
-  src/rtl.cpp
-  ${LIBOMPTARGET_EXTRA_SOURCE}
-
-  ADDITIONAL_HEADER_DIRS
-  ${LIBOMPTARGET_INCLUDE_DIR}
-  ${CMAKE_CURRENT_SOURCE_DIR}/utils
-
-  LINK_COMPONENTS
-  Support
-  Object
-
-  LINK_LIBS
-  PRIVATE
-  PluginCommon
-  ${LIBOMPTARGET_DEP_LIBRARIES}
-  ${OPENMP_PTHREAD_LIB}
-  ${LDFLAGS_UNDEFINED}
-
-  NO_INSTALL_RPATH
-  BUILDTREE_ONLY
-)
-
-if ((OMPT_TARGET_DEFAULT) AND (LIBOMPTARGET_OMPT_SUPPORT))
-  target_link_libraries(omptarget.rtl.amdgpu PRIVATE OMPT)
-endif()
-
-if (LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
-  target_link_libraries(omptarget.rtl.amdgpu PRIVATE
-    "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exports")
-endif()
-
-target_include_directories(
-  omptarget.rtl.amdgpu
-  PRIVATE
-  ${LIBOMPTARGET_INCLUDE_DIR}
-  ${CMAKE_CURRENT_SOURCE_DIR}/utils
-)
-
 # Configure testing for the AMDGPU plugin. We will build tests if we could a
 # functional AMD GPU on the system, or if manually specifies by the user.
 option(LIBOMPTARGET_FORCE_AMDGPU_TESTS "Build AMDGPU libomptarget tests" OFF)
@@ -114,5 +61,4 @@ endif()
 # Install plugin under the lib destination folder.
 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)
+  INSTALL_RPATH "$ORIGIN" BUILD_RPATH "$ORIGIN:${CMAKE_CURRENT_BINARY_DIR}/..")
diff --git a/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp b/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
index fce7454bf2800d..6d92f526afe9bf 100644
--- a/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
+++ b/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
@@ -72,7 +72,7 @@
 namespace llvm {
 namespace omp {
 namespace target {
-namespace plugin {
+namespace PLUGIN {
 
 /// Forward declarations for all specialized data structures.
 struct AMDGPUKernelTy;
@@ -3441,7 +3441,7 @@ void *AMDGPUDeviceTy::allocate(size_t Size, void *, TargetAllocTy Kind) {
   return Alloc;
 }
 
-} // namespace plugin
+} // namespace PLUGIN
 } // namespace target
 } // namespace omp
 } // namespace llvm
diff --git a/openmp/libomptarget/plugins-nextgen/amdgpu/utils/UtilitiesRTL.h b/openmp/libomptarget/plugins-nextgen/amdgpu/utils/UtilitiesRTL.h
index 58a3b5df00fac6..8234fc81a8401f 100644
--- a/openmp/libomptarget/plugins-nextgen/amdgpu/utils/UtilitiesRTL.h
+++ b/openmp/libomptarget/plugins-nextgen/amdgpu/utils/UtilitiesRTL.h
@@ -32,7 +32,7 @@ using namespace llvm::ELF;
 namespace llvm {
 namespace omp {
 namespace target {
-namespace plugin {
+namespace PLUGIN {
 namespace utils {
 
 // The implicit arguments of COV5 AMDGPU kernels.
@@ -311,7 +311,7 @@ readAMDGPUMetaDataFromImage(MemoryBufferRef MemBuffer,
 }
 
 } // namespace utils
-} // namespace plugin
+} // namespace PLUGIN
 } // namespace target
 } // namespace omp
 } // namespace llvm
diff --git a/openmp/libomptarget/plugins-nextgen/common/CMakeLists.txt b/openmp/libomptarget/plugins-nextgen/common/CMakeLists.txt
deleted file mode 100644
index 085d443071650e..00000000000000
--- a/openmp/libomptarget/plugins-nextgen/common/CMakeLists.txt
+++ /dev/null
@@ -1,110 +0,0 @@
-##===----------------------------------------------------------------------===##
-#
-# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-# See https://llvm.org/LICENSE.txt for license information.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-#
-##===----------------------------------------------------------------------===##
-#
-# Common parts which can be used by all plugins
-#
-##===----------------------------------------------------------------------===##
-
-# NOTE: Don't try to build `PluginInterface` using `add_llvm_library` because we
-# don't want to export `PluginInterface` while `add_llvm_library` requires that.
-add_library(PluginCommon OBJECT
-  src/PluginInterface.cpp
-  src/GlobalHandler.cpp
-  src/JIT.cpp
-  src/RPC.cpp
-  src/Utils/ELF.cpp
-)
-
-# Only enable JIT for those targets that LLVM can support.
-string(TOUPPER "${LLVM_TARGETS_TO_BUILD}" TargetsSupported)
-foreach(Target ${TargetsSupported})
-	target_compile_definitions(PluginCommon PRIVATE "LIBOMPTARGET_JIT_${Target}")
-endforeach()
-
-# This is required when using LLVM libraries.
-llvm_update_compile_flags(PluginCommon)
-
-if (LLVM_LINK_LLVM_DYLIB)
-  set(llvm_libs LLVM)
-else()
-  llvm_map_components_to_libnames(llvm_libs
-    ${LLVM_TARGETS_TO_BUILD}
-    AggressiveInstCombine
-    Analysis
-    BinaryFormat
-    BitReader
-    BitWriter
-    CodeGen
-    Core
-    Extensions
-    InstCombine
-    Instrumentation
-    IPO
-    IRReader
-    Linker
-    MC
-    Object
-    Passes
-    Remarks
-    ScalarOpts
-    Support
-    Target
-    TargetParser
-    TransformUtils
-    Vectorize
-  )
-endif()
-
-target_link_libraries(PluginCommon
-  PUBLIC
-    ${llvm_libs}
-)
-
-# Include the RPC server from the `libc` project if availible.
-if(TARGET llvmlibc_rpc_server AND ${LIBOMPTARGET_GPU_LIBC_SUPPORT})
-	target_link_libraries(PluginCommon PRIVATE llvmlibc_rpc_server)
-	target_compile_definitions(PluginCommon PRIVATE LIBOMPTARGET_RPC_SUPPORT)
-elseif(${LIBOMPTARGET_GPU_LIBC_SUPPORT})
-  find_library(llvmlibc_rpc_server NAMES llvmlibc_rpc_server
-               PATHS ${LIBOMPTARGET_LLVM_LIBRARY_DIR} NO_DEFAULT_PATH)
-  if(llvmlibc_rpc_server)
-		target_link_libraries(PluginCommon PRIVATE ${llvmlibc_rpc_server})
-		target_compile_definitions(PluginCommon PRIVATE LIBOMPTARGET_RPC_SUPPORT)
-    # We may need to get the headers directly from the 'libc' source directory.
-    target_include_directories(PluginCommon PRIVATE
-                               ${CMAKE_SOURCE_DIR}/../libc/utils/gpu/server
-                               ${CMAKE_SOURCE_DIR}/../libc/include)
-  endif()
-endif()
-
-if ((OMPT_TARGET_DEFAULT) AND (LIBOMPTARGET_OMPT_SUPPORT))
-	target_link_libraries(PluginCommon PUBLIC OMPT)
-endif()
-
-# Define the TARGET_NAME and DEBUG_PREFIX.
-target_compile_definitions(PluginCommon PRIVATE
-  TARGET_NAME="PluginInterface"
-  DEBUG_PREFIX="PluginInterface"
-)
-
-target_compile_options(PluginCommon PUBLIC ${offload_compile_flags})
-target_link_options(PluginCommon PUBLIC ${offload_link_flags})
-
-target_include_directories(PluginCommon
-  PRIVATE
-  ${LIBOMPTARGET_INCLUDE_DIR}
-  PUBLIC
-  ${CMAKE_CURRENT_SOURCE_DIR}/include
-)
-
-set_target_properties(PluginCommon PROPERTIES
-  POSITION_INDEPENDENT_CODE ON
-  CXX_VISIBILITY_PRESET protected)
-
-add_subdirectory(OMPT)
-
diff --git a/openmp/libomptarget/plugins-nextgen/common/OMPT/CMakeLists.txt b/openmp/libomptarget/plugins-nextgen/common/OMPT/CMakeLists.txt
deleted file mode 100644
index be4c743665b3e9..00000000000000
--- a/openmp/libomptarget/plugins-nextgen/common/OMPT/CMakeLists.txt
+++ /dev/null
@@ -1,70 +0,0 @@
-##===----------------------------------------------------------------------===##
-#
-# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-# See https://llvm.org/LICENSE.txt for license information.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-#
-##===----------------------------------------------------------------------===##
-#
-# Aggregation of parts which can be used by OpenMP tools
-#
-##===----------------------------------------------------------------------===##
-
-# NOTE: Don't try to build `OMPT` using `add_llvm_library` because we
-# don't want to export `OMPT` while `add_llvm_library` requires that.
-add_library(OMPT OBJECT
-  OmptCallback.cpp)
-
-# This is required when using LLVM libraries.
-llvm_update_compile_flags(OMPT)
-
-if (LLVM_LINK_LLVM_DYLIB)
-  set(llvm_libs LLVM)
-else()
-  llvm_map_components_to_libnames(llvm_libs
-    ${LLVM_TARGETS_TO_BUILD}
-    AggressiveInstCombine
-    Analysis
-    BinaryFormat
-    BitReader
-    BitWriter
-    CodeGen
-    Core
-    Extensions
-    InstCombine
-    Instrumentation
-    IPO
-    IRReader
-    Linker
-    MC
-    Object
-    Passes
-    Remarks
-    ScalarOpts
-    Support
-    Target
-    TargetParser
-    TransformUtils
-    Vectorize
-  )
-endif()
-
-target_link_libraries(OMPT
-  PUBLIC
-    ${llvm_libs}
-)
-
-# Define the TARGET_NAME and DEBUG_PREFIX.
-target_compile_definitions(OMPT PRIVATE
-  TARGET_NAME="OMPT"
-  DEBUG_PREFIX="OMPT"
-)
-
-target_include_directories(OMPT
-  INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}
-  PRIVATE ${LIBOMPTARGET_INCLUDE_DIR}
-)
-
-set_target_properties(OMPT PROPERTIES
-  POSITION_INDEPENDENT_CODE ON
-  CXX_VISIBILITY_PRESET protected)
diff --git a/openmp/libomptarget/plugins-nextgen/common/include/GlobalHandler.h b/openmp/libomptarget/plugins-nextgen/common/include/GlobalHandler.h
index 829b4b72911935..e3f663879b1570 100644
--- a/openmp/libomptarget/plugins-nextgen/common/include/GlobalHandler.h
+++ b/openmp/libomptarget/plugins-nextgen/common/include/GlobalHandler.h
@@ -26,7 +26,7 @@
 namespace llvm {
 namespace omp {
 namespace target {
-namespace plugin {
+namespace PLUGIN {
 
 class DeviceImageTy;
 struct GenericDeviceTy;
@@ -166,7 +166,7 @@ class GenericGlobalHandlerTy {
   }
 };
 
-} // namespace plugin
+} // namespace PLUGIN
 } // namespace target
 } // namespace omp
 } // namespace llvm
diff --git a/openmp/libomptarget/plugins-nextgen/common/include/JIT.h b/openmp/libomptarget/plugins-nextgen/common/include/JIT.h
index b22197b8920838..2bcd016c6a61a2 100644
--- a/openmp/libomptarget/plugins-nextgen/common/include/JIT.h
+++ b/openmp/libomptarget/plugins-nextgen/common/include/JIT.h
@@ -34,9 +34,9 @@ class MemoryBuffer;
 
 namespace omp {
 namespace target {
-namespace plugin {
+namespace PLUGIN {
 struct GenericDeviceTy;
-} // namespace plugin
+} // namespace PLUGIN
 
 /// The JIT infrastructure and caching mechanism.
 struct JITEngine {
@@ -53,7 +53,7 @@ struct JITEngine {
   /// generated device image that could be loaded to the device directly.
   Expected<const __tgt_device_image *>
   process(const __tgt_device_image &Image,
-          target::plugin::GenericDeviceTy &Device);
+          target::PLUGIN::GenericDeviceTy &Device);
 
   /// Return true if \p Image is a bitcode image that can be JITed for the given
   /// architecture.
diff --git a/openmp/libomptarget/plugins-nextgen/common/include/PluginInterface.h b/openmp/libomptarget/plugins-nextgen/common/include/PluginInterface.h
index b7be7b645ba33e..8753db090a9f62 100644
--- a/openmp/libomptarget/plugins-nextgen/common/include/PluginInterface.h
+++ b/openmp/libomptarget/plugins-nextgen/common/include/PluginInterface.h
@@ -49,7 +49,7 @@ namespace llvm {
 namespace omp {
 namespace target {
 
-namespace plugin {
+namespace PLUGIN {
 
 struct GenericPluginTy;
 struct GenericKernelTy;
@@ -1395,7 +1395,7 @@ template <typename ResourceRef> class GenericDeviceResourceManagerTy {
 /// A static check on whether or not we support RPC in libomptarget.
 bool libomptargetSupportsRPC();
 
-} // namespace plugin
+} // namespace PLUGIN
 } // namespace target
 } // namespace omp
 } // namespace llvm
diff --git a/openmp/libomptarget/plugins-nextgen/common/include/RPC.h b/openmp/libomptarget/plugins-nextgen/common/include/RPC.h
index 2e39b3f299c888..dfb342e11b5bae 100644
--- a/openmp/libomptarget/plugins-nextgen/common/include/RPC.h
+++ b/openmp/libomptarget/plugins-nextgen/common/include/RPC.h
@@ -21,11 +21,11 @@
 #include <cstdint>
 
 namespace llvm::omp::target {
-namespace plugin {
+namespace PLUGIN {
 struct GenericDeviceTy;
 class GenericGlobalHandlerTy;
 class DeviceImageTy;
-} // namespace plugin
+} // namespace PLUGIN
 
 /// A generic class implementing the interface between the RPC server provided
 /// by the 'libc' project and 'libomptarget'. If the RPC server is not availible
@@ -37,24 +37,24 @@ struct RPCServerTy {
   /// Check if this device image is using an RPC server. This checks for the
   /// precense of an externally visible symbol in the device image that will
   /// be present whenever RPC code is called.
-  llvm::Expected<bool> isDeviceUsingRPC(plugin::GenericDeviceTy &Device,
-                                        plugin::GenericGlobalHandlerTy &Handler,
-                                        plugin::DeviceImageTy &Image);
+  llvm::Expected<bool> isDeviceUsingRPC(PLUGIN::GenericDeviceTy &Device,
+                                        PLUGIN::GenericGlobalHandlerTy &Handler,
+                                        PLUGIN::DeviceImageTy &Image);
 
   /// Initialize the RPC server for the given device. This will allocate host
   /// memory for the internal server and copy the data to the client on the
   /// device. The device must be loaded before this is valid.
-  llvm::Error initDevice(plugin::GenericDeviceTy &Device,
-                         plugin::GenericGlobalHandlerTy &Handler,
-                         plugin::DeviceImageTy &Image);
+  llvm::Error initDevice(PLUGIN::GenericDeviceTy &Device,
+                         PLUGIN::GenericGlobalHandlerTy &Handler,
+                         PLUGIN::DeviceImageTy &Image);
 
   /// Runs the RPC server associated with the \p Device until the pending work
   /// is cleared.
-  llvm::Error runServer(plugin::GenericDeviceTy &Device);
+  llvm::Error runServer(PLUGIN::GenericDeviceTy &Device);
 
   /// Deinitialize the RPC server for the given device. This will free the
   /// memory associated with the k
-  llvm::Error deinitDevice(plugin::GenericDeviceTy &Device);
+  llvm::Error deinitDevice(PLUGIN::GenericDeviceTy &Device);
 
   ~RPCServerTy();
 };
diff --git a/openmp/libomptarget/plugins-nextgen/common/src/GlobalHandler.cpp b/openmp/libomptarget/plugins-nextgen/common/src/GlobalHandler.cpp
index ba0aa47f8e51c3..67151288757e54 100644
--- a/openmp/libomptarget/plugins-nextgen/common/src/GlobalHandler.cpp
+++ b/openmp/libomptarget/plugins-nextgen/common/src/GlobalHandler.cpp
@@ -23,7 +23,7 @@
 using namespace llvm;
 using namespace omp;
 using namespace target...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/86315


More information about the Openmp-commits mailing list