[Openmp-commits] [PATCH] D31205: [OpenMP] Allow multiple weak symbols to be loaded from the fat binary
George Rokos via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Wed Mar 22 09:55:53 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL298516: [OpenMP] Allow multiple weak symbols to be loaded from the fat binary (authored by grokos).
Changed prior to commit:
https://reviews.llvm.org/D31205?vs=92533&id=92649#toc
Repository:
rL LLVM
https://reviews.llvm.org/D31205
Files:
openmp/trunk/libomptarget/src/omptarget.cpp
Index: openmp/trunk/libomptarget/src/omptarget.cpp
===================================================================
--- openmp/trunk/libomptarget/src/omptarget.cpp
+++ openmp/trunk/libomptarget/src/omptarget.cpp
@@ -1303,7 +1303,6 @@
}
// 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 @@
// 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();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31205.92649.patch
Type: text/x-patch
Size: 1973 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20170322/192803f3/attachment.bin>
More information about the Openmp-commits
mailing list