[all-commits] [llvm/llvm-project] fa9e90: [Reland][Libomptarget] Statically link all plugin ...

Joseph Huber via All-commits all-commits at lists.llvm.org
Thu May 9 07:38:53 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fa9e90f5d23312587b3a17920941334e0d1a58a1
      https://github.com/llvm/llvm-project/commit/fa9e90f5d23312587b3a17920941334e0d1a58a1
  Author: Joseph Huber <huberjn at outlook.com>
  Date:   2024-05-09 (Thu, 09 May 2024)

  Changed paths:
    M clang/test/Driver/linker-wrapper-image.c
    M llvm/lib/Frontend/Offloading/OffloadWrapper.cpp
    M offload/include/PluginManager.h
    M offload/include/device.h
    M offload/plugins-nextgen/CMakeLists.txt
    M offload/plugins-nextgen/amdgpu/CMakeLists.txt
    M offload/plugins-nextgen/amdgpu/src/rtl.cpp
    M offload/plugins-nextgen/common/CMakeLists.txt
    M offload/plugins-nextgen/common/include/PluginInterface.h
    M offload/plugins-nextgen/common/include/Utils/ELF.h
    M offload/plugins-nextgen/common/src/JIT.cpp
    M offload/plugins-nextgen/common/src/PluginInterface.cpp
    M offload/plugins-nextgen/cuda/CMakeLists.txt
    M offload/plugins-nextgen/cuda/src/rtl.cpp
    M offload/plugins-nextgen/host/CMakeLists.txt
    M offload/plugins-nextgen/host/src/rtl.cpp
    M offload/src/CMakeLists.txt
    M offload/src/OffloadRTL.cpp
    M offload/src/OpenMP/InteropAPI.cpp
    M offload/src/PluginManager.cpp
    M offload/src/device.cpp
    M offload/src/interface.cpp
    M offload/tools/kernelreplay/llvm-omp-kernel-replay.cpp
    M offload/unittests/Plugins/NextgenPluginsTest.cpp

  Log Message:
  -----------
  [Reland][Libomptarget] Statically link all plugin runtimes (#87009)

This patch overhauls the `libomptarget` and plugin interface. Currently,
we define a C API and compile each plugin as a separate shared library.
Then, `libomptarget` loads these API functions and forwards its internal
calls to them. This was originally designed to allow multiple
implementations of a library to be live. However, since then no one has
used this functionality and it prevents us from using much nicer
interfaces. If the old behavior is desired it should instead be
implemented as a separate plugin.

This patch replaces the `PluginAdaptorTy` interface with the
`GenericPluginTy` that is used by the plugins. Each plugin exports a
`createPlugin_<name>` function that is used to get the specific
implementation. This code is now shared with `libomptarget`.

There are some notable improvements to this.
1. Massively improved lifetimes of life runtime objects
2. The plugins can use a C++ interface
3. Global state does not need to be duplicated for each plugin +
   libomptarget
4. Easier to use and add features and improve error handling
5. Less function call overhead / Improved LTO performance.

Additional changes in this plugin are related to contending with the
fact that state is now shared. Initialization and deinitialization is
now handled correctly and in phase with the underlying runtime, allowing
us to actually know when something is getting deallocated.

Depends on https://github.com/llvm/llvm-project/pull/86971
https://github.com/llvm/llvm-project/pull/86875
https://github.com/llvm/llvm-project/pull/86868



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list