summaryrefslogtreecommitdiffstats
path: root/openmp/libomptarget/src
diff options
context:
space:
mode:
authorGeorge Rokos <grokos@us.ibm.com>2017-03-22 16:43:40 +0000
committerGeorge Rokos <grokos@us.ibm.com>2017-03-22 16:43:40 +0000
commitba7380bf6c7ac2beff278c05598361ce7de14729 (patch)
tree6213271f1621d1ef8ae9262581106a66e7a3bc8e /openmp/libomptarget/src
parentf3fe2dd23524202c22f05b9bddf5b2ecdbbf8d45 (diff)
downloadbcm5719-llvm-ba7380bf6c7ac2beff278c05598361ce7de14729.tar.gz
bcm5719-llvm-ba7380bf6c7ac2beff278c05598361ce7de14729.zip
[OpenMP] Allow multiple weak symbols to be loaded from the fat binary
For compatibility with Fortran. Differential Revision: https://reviews.llvm.org/D31205 llvm-svn: 298516
Diffstat (limited to 'openmp/libomptarget/src')
-rw-r--r--openmp/libomptarget/src/omptarget.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/openmp/libomptarget/src/omptarget.cpp b/openmp/libomptarget/src/omptarget.cpp
index fe61ea9f782..1c04e3f0ece 100644
--- a/openmp/libomptarget/src/omptarget.cpp
+++ b/openmp/libomptarget/src/omptarget.cpp
@@ -1303,7 +1303,6 @@ static int InitLibrary(DeviceTy& Device) {
}
// process global data that needs to be mapped.
- Device.DataMapMtx.lock();
__tgt_target_table *HostTable = &TransTable->HostTable;
for (__tgt_offload_entry *CurrDeviceEntry = TargetTable->EntriesBegin,
*CurrHostEntry = HostTable->EntriesBegin,
@@ -1314,20 +1313,20 @@ static int InitLibrary(DeviceTy& Device) {
// has data.
assert(CurrDeviceEntry->size == CurrHostEntry->size &&
"data size mismatch");
- assert(Device.getTgtPtrBegin(CurrHostEntry->addr,
- CurrHostEntry->size) == NULL &&
- "data in declared target should not be already mapped");
- // add entry to map.
+
+ // Fortran may use multiple weak declarations for the same symbol,
+ // therefore we must allow for multiple weak symbols to be loaded from
+ // the fat binary. Treat these mappings as any other "regular" mapping.
+ // Add entry to map.
DP("Add mapping from host " DPxMOD " to device " DPxMOD " with size %zu"
"\n", DPxPTR(CurrHostEntry->addr), DPxPTR(CurrDeviceEntry->addr),
CurrDeviceEntry->size);
- Device.HostDataToTargetMap.push_front(HostDataToTargetTy(
- (uintptr_t)CurrHostEntry->addr, (uintptr_t)CurrHostEntry->addr,
- (uintptr_t)CurrHostEntry->addr + CurrHostEntry->size,
- (uintptr_t)CurrDeviceEntry->addr));
+ bool IsNew; //unused
+ Device.getOrAllocTgtPtr(CurrHostEntry->addr /*HstPtrBegin*/,
+ CurrHostEntry->addr /*HstPtrBase*/, CurrHostEntry->size /*Size*/,
+ IsNew, false /*IsImplicit*/, true /*UpdateRefCount*/);
}
}
- Device.DataMapMtx.unlock();
}
TrlTblMtx.unlock();
OpenPOWER on IntegriCloud