[Openmp-commits] [PATCH] D136952: [libomptarget] Fix a race condition in checkDeviceAndCtors
Joachim Protze via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Mon Oct 31 07:38:42 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb923c15d3c00: [libomptarget] Fix a race condition in checkDeviceAndCtors (authored by lechenyu, committed by protze.joachim).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D136952/new/
https://reviews.llvm.org/D136952
Files:
openmp/libomptarget/src/omptarget.cpp
Index: openmp/libomptarget/src/omptarget.cpp
===================================================================
--- openmp/libomptarget/src/omptarget.cpp
+++ openmp/libomptarget/src/omptarget.cpp
@@ -80,9 +80,6 @@
int Rc = OFFLOAD_SUCCESS;
bool SupportsEmptyImages = Device.RTL->supports_empty_images &&
Device.RTL->supports_empty_images() > 0;
-
- std::lock_guard<decltype(Device.PendingGlobalsMtx)> LG(
- Device.PendingGlobalsMtx);
{
std::lock_guard<decltype(PM->TrlTblMtx)> LG(PM->TrlTblMtx);
for (auto *HostEntriesBegin : PM->HostEntriesBeginRegistrationOrder) {
@@ -320,16 +317,14 @@
DeviceTy &Device = *PM->Devices[DeviceID];
// Check whether global data has been mapped for this device
- bool HasPendingGlobals;
{
std::lock_guard<decltype(Device.PendingGlobalsMtx)> LG(
Device.PendingGlobalsMtx);
- HasPendingGlobals = Device.HasPendingGlobals;
- }
- if (HasPendingGlobals && initLibrary(Device) != OFFLOAD_SUCCESS) {
- REPORT("Failed to init globals on device %" PRId64 "\n", DeviceID);
- handleTargetOutcome(false, Loc);
- return true;
+ if (Device.HasPendingGlobals && initLibrary(Device) != OFFLOAD_SUCCESS) {
+ REPORT("Failed to init globals on device %" PRId64 "\n", DeviceID);
+ handleTargetOutcome(false, Loc);
+ return true;
+ }
}
return false;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136952.472004.patch
Type: text/x-patch
Size: 1386 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20221031/25d7f907/attachment.bin>
More information about the Openmp-commits
mailing list