[Openmp-commits] [PATCH] D134396: [OpenMP][libomptarget] New plugin infrastructure and new CUDA plugin

Kevin Sala Penad├ęs via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Sep 21 16:10:29 PDT 2022


kevinsala created this revision.
kevinsala added reviewers: jhuber6, tianshilei1992, JonChesterfield, jdoerfert.
kevinsala added a project: OpenMP.
Herald added subscribers: mattd, guansong, kbarton, yaxunl, nemanjai.
Herald added a project: All.
kevinsala requested review of this revision.
Herald added subscribers: llvm-commits, openmp-commits, sstefan1.
Herald added a project: LLVM.

This patch adds a new infrastructure for OpenMP target plugins. It also implements the CUDA and GenericELF64bit plugins under this new infrastructure. We place the sources in a separate directory named plugins-nextgen, and we build the new plugins as different plugin libraries. The original plugins, which remain untouched, will be used by default. However, the user can change this behavior at run-time through the boolean envar LIBOMPTARGET_NEXTGEN_PLUGINS. If enabled, the libomptarget will try to load the NextGen version of each plugin, falling back to the original if they are not present or valid.

The idea of this new plugin infrastructure is to implement the common parts of target plugins in generic classes (defined in files inside plugins-next/common/PluginInterface folder), and then, each specific plugin defines its own specific classes inheriting from the common ones. In this way, most logic remains on the common interface while reducing the plugin-specific source code. It is also beneficial in the sense that now most code and behavior are the same across the different plugins. As an example, we define classes for a plugin, a device, a device image, a stream manager, etc. The plugin object (a single instance per plugin library) holds different device objects (i.e., one per available device), while these latter are the responsible for managing its own resources.

Most code on this patch is based on the changes made by @jdoerfert (Johannes Doerfert)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134396

Files:
  llvm/include/llvm/Frontend/OpenMP/OMPGridValues.h
  openmp/libomptarget/CMakeLists.txt
  openmp/libomptarget/include/Utilities.h
  openmp/libomptarget/include/rtl.h
  openmp/libomptarget/plugins-nextgen/CMakeLists.txt
  openmp/libomptarget/plugins-nextgen/aarch64/CMakeLists.txt
  openmp/libomptarget/plugins-nextgen/common/CMakeLists.txt
  openmp/libomptarget/plugins-nextgen/common/PluginInterface/CMakeLists.txt
  openmp/libomptarget/plugins-nextgen/common/PluginInterface/GlobalHandler.cpp
  openmp/libomptarget/plugins-nextgen/common/PluginInterface/GlobalHandler.h
  openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp
  openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.h
  openmp/libomptarget/plugins-nextgen/cuda/CMakeLists.txt
  openmp/libomptarget/plugins-nextgen/cuda/dynamic_cuda/cuda.cpp
  openmp/libomptarget/plugins-nextgen/cuda/dynamic_cuda/cuda.h
  openmp/libomptarget/plugins-nextgen/cuda/src/rtl.cpp
  openmp/libomptarget/plugins-nextgen/exports
  openmp/libomptarget/plugins-nextgen/generic-elf-64bit/src/rtl.cpp
  openmp/libomptarget/plugins-nextgen/ppc64/CMakeLists.txt
  openmp/libomptarget/plugins-nextgen/ppc64le/CMakeLists.txt
  openmp/libomptarget/plugins-nextgen/x86_64/CMakeLists.txt
  openmp/libomptarget/src/rtl.cpp
  openmp/libomptarget/test/lit.cfg

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134396.462033.patch
Type: text/x-patch
Size: 189459 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20220921/1b9df37a/attachment-0001.bin>


More information about the Openmp-commits mailing list