[Openmp-commits] [PATCH] D141545: [OpenMP] Implement `omp_get_mapped_ptr`
Johannes Doerfert via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Wed Jan 11 14:15:24 PST 2023
jdoerfert accepted this revision.
jdoerfert added a subscriber: carlo.bertolli.
jdoerfert added a comment.
This revision is now accepted and ready to land.
Fix the initial device case. Use a shared lock if we can already. Otherwise, it'll wait for @carlo.bertolli. LG
================
Comment at: openmp/libomptarget/src/api.cpp:335
+ REPORT("Device %d is initial device. No mapped pointer.\n", DeviceNum);
+ return nullptr;
+ }
----------------
> Otherwise it returns the device pointer, which is ptr if device_num is the value returned by omp_get_initial_device().
================
Comment at: openmp/libomptarget/src/api.cpp:340
+ {
+ std::lock_guard<std::mutex> LG(PM->RTLsMtx);
+ DevicesSize = PM->Devices.size();
----------------
We need a shared lock here. (and basically everywhere else)
================
Comment at: openmp/libomptarget/src/api.cpp:355
+ bool IsHostPtr = false;
+ auto &Device = *PM->Devices[DeviceNum];
+ TargetPointerResultTy TPR =
----------------
And this needs to be (shared) locked too.
@carlo.bertolli will fix these up consistently (see also above).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D141545/new/
https://reviews.llvm.org/D141545
More information about the Openmp-commits
mailing list