[all-commits] [llvm/llvm-project] aa78e9: [Libomptarget] Support mapping indirect host calls...

Joseph Huber via All-commits all-commits at lists.llvm.org
Fri Aug 25 16:52:13 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: aa78e94b0bc66375de7f2383b4e39c07cd482104
      https://github.com/llvm/llvm-project/commit/aa78e94b0bc66375de7f2383b4e39c07cd482104
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2023-08-25 (Fri, 25 Aug 2023)

  Changed paths:
    M llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
    M openmp/libomptarget/DeviceRTL/include/Configuration.h
    M openmp/libomptarget/DeviceRTL/src/Configuration.cpp
    M openmp/libomptarget/DeviceRTL/src/Misc.cpp
    M openmp/libomptarget/include/Environment.h
    M openmp/libomptarget/include/omptarget.h
    M openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp
    M openmp/libomptarget/src/rtl.cpp
    A openmp/libomptarget/test/api/omp_indirect_call.c

  Log Message:
  -----------
  [Libomptarget] Support mapping indirect host calls to device functions

The changes in D157738 allowed for us to emit stub globals on the device
in the offloading entry section. These globals contain the addresses of
device functions and allow us to map host functions to their
corresponding device equivalent. This patch provides the initial support
required to build a table on the device to lookup the associated value.
This is done by finding these entries and creating a global table on the
device that can be searched with a simple binary search.

This requires an allocation, which supposedly should be automatically
freed at plugin shutdown. This includes a basic test which looks up device
pointers via a host pointer using the added function. This will need to be built
upon to provide full support for these calls in the runtime.

To support reverse offloading it would also be useful to provide a reverse table
that allows us to get host functions from device stubs.

Depends on D157738

Reviewed By: jdoerfert

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




More information about the All-commits mailing list