[Openmp-commits] [openmp] r336569 - [OPENMP, NVPTX] Support several images in the executable.
Alexey Bataev via Openmp-commits
openmp-commits at lists.llvm.org
Mon Jul 9 10:46:55 PDT 2018
Author: abataev
Date: Mon Jul 9 10:46:55 2018
New Revision: 336569
URL: http://llvm.org/viewvc/llvm-project?rev=336569&view=rev
Log:
[OPENMP, NVPTX] Support several images in the executable.
Summary:
Currently Cuda plugin supports loading of the single image, though we
may have the executable with the several images, if it has target
regions inside of the dynamically loaded library. Patch allows to load
multiple images.
Reviewers: grokos
Subscribers: guansong, openmp-commits, kkwli0
Differential Revision: https://reviews.llvm.org/D49036
Modified:
openmp/trunk/libomptarget/plugins/cuda/src/rtl.cpp
Modified: openmp/trunk/libomptarget/plugins/cuda/src/rtl.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/libomptarget/plugins/cuda/src/rtl.cpp?rev=336569&r1=336568&r2=336569&view=diff
==============================================================================
--- openmp/trunk/libomptarget/plugins/cuda/src/rtl.cpp (original)
+++ openmp/trunk/libomptarget/plugins/cuda/src/rtl.cpp Mon Jul 9 10:46:55 2018
@@ -92,7 +92,7 @@ std::list<KernelTy> KernelsList;
/// Class containing all the device information.
class RTLDeviceInfoTy {
- std::vector<FuncOrGblEntryTy> FuncGblEntries;
+ std::vector<std::list<FuncOrGblEntryTy>> FuncGblEntries;
public:
int NumberOfDevices;
@@ -122,7 +122,7 @@ public:
void addOffloadEntry(int32_t device_id, __tgt_offload_entry entry) {
assert(device_id < (int32_t)FuncGblEntries.size() &&
"Unexpected device id!");
- FuncOrGblEntryTy &E = FuncGblEntries[device_id];
+ FuncOrGblEntryTy &E = FuncGblEntries[device_id].back();
E.Entries.push_back(entry);
}
@@ -131,7 +131,7 @@ public:
bool findOffloadEntry(int32_t device_id, void *addr) {
assert(device_id < (int32_t)FuncGblEntries.size() &&
"Unexpected device id!");
- FuncOrGblEntryTy &E = FuncGblEntries[device_id];
+ FuncOrGblEntryTy &E = FuncGblEntries[device_id].back();
for (auto &it : E.Entries) {
if (it.addr == addr)
@@ -145,7 +145,7 @@ public:
__tgt_target_table *getOffloadEntriesTable(int32_t device_id) {
assert(device_id < (int32_t)FuncGblEntries.size() &&
"Unexpected device id!");
- FuncOrGblEntryTy &E = FuncGblEntries[device_id];
+ FuncOrGblEntryTy &E = FuncGblEntries[device_id].back();
int32_t size = E.Entries.size();
@@ -167,7 +167,8 @@ public:
void clearOffloadEntriesTable(int32_t device_id) {
assert(device_id < (int32_t)FuncGblEntries.size() &&
"Unexpected device id!");
- FuncOrGblEntryTy &E = FuncGblEntries[device_id];
+ FuncGblEntries[device_id].emplace_back();
+ FuncOrGblEntryTy &E = FuncGblEntries[device_id].back();
E.Entries.clear();
E.Table.EntriesBegin = E.Table.EntriesEnd = 0;
}
More information about the Openmp-commits
mailing list