[Libomptarget] Move target table handling out of the plugins (#77150)
commit621bafd5c14cc324612e32c8123ac1ebf1c0530b
authorJoseph Huber <huberjn@outlook.com>
Mon, 22 Jan 2024 17:06:47 +0000 (22 11:06 -0600)
committerGitHub <noreply@github.com>
Mon, 22 Jan 2024 17:06:47 +0000 (22 11:06 -0600)
tree318e88d0763edfe02390daa8d3b882a27434643f
parentebd4dc42630e201c15894b48c3ea890eaa8c3b18
[Libomptarget] Move target table handling out of the plugins (#77150)

Summary:
This patch removes the bulk of the handling of the
`__tgt_offload_entries` out of the plugins itself. The reason for this
is because the plugins themselves should not be handling this
implementation detail of the OpenMP runtime. Instead, we expose two new
plugin API functions to get the points to a device pointer for a global
as well as a kernel type.

This required introducing a new type to represent a binary image that
has been loaded on a device. We can then use this to load the addresses
as needed. The creation of the mapping table is then handled just in
`libomptarget` where we simply look up each address individually. This
should allow us to expose these operations more generically when we
provide a separate API.
14 files changed:
openmp/libomptarget/include/Shared/APITypes.h
openmp/libomptarget/include/Shared/PluginAPI.h
openmp/libomptarget/include/Shared/PluginAPI.inc
openmp/libomptarget/include/device.h
openmp/libomptarget/include/rtl.h
openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
openmp/libomptarget/plugins-nextgen/common/include/GlobalHandler.h
openmp/libomptarget/plugins-nextgen/common/include/PluginInterface.h
openmp/libomptarget/plugins-nextgen/common/src/PluginInterface.cpp
openmp/libomptarget/plugins-nextgen/cuda/src/rtl.cpp
openmp/libomptarget/plugins-nextgen/generic-elf-64bit/src/rtl.cpp
openmp/libomptarget/src/PluginManager.cpp
openmp/libomptarget/src/device.cpp
openmp/libomptarget/src/omptarget.cpp