[Openmp-commits] [PATCH] D157918: [Libomptarget] Support mapping indirect host calls to device functions

Joseph Huber via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon Aug 14 14:24:02 PDT 2023


jhuber6 created this revision.
jhuber6 added reviewers: jdoerfert, tianshilei1992, JonChesterfield, ye-luo, RaviNarayanaswamy, kevinsala, jplehr.
Herald added a subscriber: mgrang.
Herald added a project: All.
jhuber6 requested review of this revision.
Herald added subscribers: openmp-commits, sstefan1.
Herald added a project: OpenMP.

The changes in D157738 <https://reviews.llvm.org/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 <https://reviews.llvm.org/D157738>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D157918

Files:
  openmp/libomptarget/DeviceRTL/include/Configuration.h
  openmp/libomptarget/DeviceRTL/src/Configuration.cpp
  openmp/libomptarget/DeviceRTL/src/Misc.cpp
  openmp/libomptarget/include/Environment.h
  openmp/libomptarget/include/omptarget.h
  openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp
  openmp/libomptarget/src/rtl.cpp
  openmp/libomptarget/test/api/omp_indirect_call.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157918.550090.patch
Type: text/x-patch
Size: 10150 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20230814/aa34e66d/attachment-0001.bin>


More information about the Openmp-commits mailing list