[Openmp-commits] [PATCH] D49418: Also support several images for elf

Jannis Klinkenberg via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Jul 17 03:59:52 PDT 2018


jklinkenberg created this revision.
jklinkenberg added reviewers: protze.joachim, ABataev, grokos.
Herald added a subscriber: openmp-commits.

In revision r336569 libomptarget support for multiple nvidia images has been fixed in case a target region resides inside one or multiple libraries and in the compiled application. But the issues was still present for elf images.
This fix will also support multiple images for elf.


Repository:
  rOMP OpenMP

https://reviews.llvm.org/D49418

Files:
  libomptarget/plugins/generic-elf-64bit/src/rtl.cpp


Index: libomptarget/plugins/generic-elf-64bit/src/rtl.cpp
===================================================================
--- libomptarget/plugins/generic-elf-64bit/src/rtl.cpp
+++ libomptarget/plugins/generic-elf-64bit/src/rtl.cpp
@@ -66,7 +66,7 @@
 
 /// Class containing all the device information.
 class RTLDeviceInfoTy {
-  std::vector<FuncOrGblEntryTy> FuncGblEntries;
+  std::vector<std::list<FuncOrGblEntryTy>> FuncGblEntries;
 
 public:
   std::list<DynLibTy> DynLibs;
@@ -76,7 +76,8 @@
                           __tgt_offload_entry *end) {
     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.Table.EntriesBegin = begin;
     E.Table.EntriesEnd = end;
@@ -86,7 +87,7 @@
   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 (__tgt_offload_entry *i = E.Table.EntriesBegin, *e = E.Table.EntriesEnd;
          i < e; ++i) {
@@ -101,7 +102,7 @@
   __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();
 
     return &E.Table;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49418.155839.patch
Type: text/x-patch
Size: 1604 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20180717/dce3ed31/attachment.bin>


More information about the Openmp-commits mailing list