[Openmp-commits] [PATCH] D95786: [OpenMP] Fix seg fault in libomptarget when using Info with multiple threads
Joseph Huber via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Mon Feb 1 08:22:28 PST 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGfda48539988d: [OpenMP] Fix seg fault in libomptarget when using Info with multiple threads (authored by jhuber6).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D95786/new/
https://reviews.llvm.org/D95786
Files:
openmp/libomptarget/src/interface.cpp
openmp/libomptarget/src/private.h
Index: openmp/libomptarget/src/private.h
===================================================================
--- openmp/libomptarget/src/private.h
+++ openmp/libomptarget/src/private.h
@@ -99,7 +99,7 @@
////////////////////////////////////////////////////////////////////////////////
/// dump a table of all the host-target pointer pairs on failure
static inline void dumpTargetPointerMappings(const ident_t *Loc,
- const DeviceTy &Device) {
+ DeviceTy &Device) {
if (Device.HostDataToTargetMap.empty())
return;
@@ -109,6 +109,7 @@
Kernel.getFilename(), Kernel.getLine(), Kernel.getColumn());
INFO(OMP_INFOTYPE_ALL, Device.DeviceID, "%-18s %-18s %s %s %s\n", "Host Ptr",
"Target Ptr", "Size (B)", "RefCount", "Declaration");
+ Device.DataMapMtx.lock();
for (const auto &HostTargetMap : Device.HostDataToTargetMap) {
SourceInfo Info(HostTargetMap.HstPtrName);
INFO(OMP_INFOTYPE_ALL, Device.DeviceID,
@@ -118,6 +119,7 @@
HostTargetMap.getRefCount(), Info.getName(), Info.getFilename(),
Info.getLine(), Info.getColumn());
}
+ Device.DataMapMtx.unlock();
}
////////////////////////////////////////////////////////////////////////////////
Index: openmp/libomptarget/src/interface.cpp
===================================================================
--- openmp/libomptarget/src/interface.cpp
+++ openmp/libomptarget/src/interface.cpp
@@ -58,7 +58,7 @@
case tgt_mandatory:
if (!success) {
if (getInfoLevel() & OMP_INFOTYPE_DUMP_TABLE)
- for (const auto &Device : PM->Devices)
+ for (auto &Device : PM->Devices)
dumpTargetPointerMappings(loc, Device);
else
FAILURE_MESSAGE("Run with LIBOMPTARGET_DEBUG=%d to dump host-target "
@@ -76,7 +76,7 @@
1, "failure of target construct while offloading is mandatory");
} else {
if (getInfoLevel() & OMP_INFOTYPE_DUMP_TABLE)
- for (const auto &Device : PM->Devices)
+ for (auto &Device : PM->Devices)
dumpTargetPointerMappings(loc, Device);
}
break;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95786.320480.patch
Type: text/x-patch
Size: 2161 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210201/2ec58aa1/attachment-0001.bin>
More information about the Openmp-commits
mailing list