[all-commits] [llvm/llvm-project] 846904: [OpenMP][libomptarget] New plugin infrastructure a...

Kevin Sala Penadés via All-commits all-commits at lists.llvm.org
Thu Oct 27 11:10:30 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 846904195bd603628ee3670d7dc0ca84e3e3bba4
      https://github.com/llvm/llvm-project/commit/846904195bd603628ee3670d7dc0ca84e3e3bba4
  Author: Kevin Sala <kevin.sala at bsc.es>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

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

  Log Message:
  -----------
  [OpenMP][libomptarget] New plugin infrastructure and new CUDA plugin

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)

Reviewed By: jhuber6, jdoerfert

Differential Revision: https://reviews.llvm.org/D134396




More information about the All-commits mailing list