[Openmp-commits] [PATCH] D97883: [libomptarget] Add allocator support for target memory
George Rokos via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Wed Mar 3 12:33:34 PST 2021
grokos created this revision.
grokos added reviewers: hbae, RaviNarayanaswamy, jdoerfert, JonChesterfield.
grokos added a project: OpenMP.
grokos requested review of this revision.
Herald added a subscriber: sstefan1.
This patch adds the infrastructure for allocator support for target memory. Three allocators are introduced for device, host and shared memory. The corresponding API functions have the `llvm_` prefix temporarily, until they become part of the OpenMP standard:
`llvm_omp_target_alloc_device(size_t size, int device_num);`
- Returns memory owned by device.
- Memory is only accessible by device.
`llvm_omp_target_alloc_host(size_t size, int device_num);`
- Returns non-migratable memory owned by host.
- Memory is accessible by host and device(s).
`llvm_omp_target_alloc_shared(size_t size, int device_num);`
- Returns migratable memory owned by host and device.
- Memory is accessible by host and device.
The corresponding host OpenMP runtime patch is D96669 <https://reviews.llvm.org/D96669>.
Ultimately, libomptarget needs support from each plugin to allocate memory using the desired method. A new plugin function `__tgt_rtl_data_alloc_explicit` (optional) is introduced which is called by the base library to allocate memory appropriately. The patch provides a trivial sample implementation using the `generic-elf-64` plugin.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D97883
Files:
openmp/libomptarget/include/omptarget.h
openmp/libomptarget/include/omptargetplugin.h
openmp/libomptarget/plugins/exports
openmp/libomptarget/plugins/generic-elf-64bit/src/rtl.cpp
openmp/libomptarget/src/api.cpp
openmp/libomptarget/src/device.cpp
openmp/libomptarget/src/device.h
openmp/libomptarget/src/exports
openmp/libomptarget/src/rtl.cpp
openmp/libomptarget/src/rtl.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97883.327876.patch
Type: text/x-patch
Size: 7944 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210303/4b903f12/attachment.bin>
More information about the Openmp-commits
mailing list