[libc-commits] [libc] [OpenMP][libomptarget] Add map checks when running under unified shared memory (PR #69005)

Gheorghe-Teodor Bercea via libc-commits libc-commits at lists.llvm.org
Mon Oct 16 08:23:45 PDT 2023


================
@@ -444,6 +486,29 @@ DeviceTy::getTgtPtrBegin(void *HstPtrBegin, int64_t Size, bool UpdateRefCount,
          LR.TPR.getEntry()->dynRefCountToStr().c_str(), DynRefCountAction,
          LR.TPR.getEntry()->holdRefCountToStr().c_str(), HoldRefCountAction);
     LR.TPR.TargetPointer = (void *)TP;
+
+    // If this entry is not marked as being host pointer (the way the
+    // implementation works today this is never true, mistake?) then we
+    // have to check if this is a host pointer or not. This is a host pointer
+    // if the host address matches the target address.
+    if ((PM->RTLs.RequiresFlags & OMP_REQ_UNIFIED_SHARED_MEMORY) &&
+        !LR.TPR.Flags.IsHostPointer) {
----------------
doru1004 wrote:

There are several tests which exercise the call to the getTgtPtrBegin. The reason this change is needed is because the first condition, if true, and it can be true even when USM is enabled, then the USM branch will not be taken at all and the IsHostPointer and IsPresent will not be correctly set.

https://github.com/llvm/llvm-project/pull/69005


More information about the libc-commits mailing list