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

via libcxx-commits libcxx-commits at lists.llvm.org
Fri Oct 13 13:23:57 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) {
+      // If addresses match it means that we are dealing with a host pointer
+      // which has to be marked as one and present flag reset:
+      if (LR.TPR.getEntry()->TgtPtrBegin == LR.TPR.getEntry()->HstPtrBegin) {
+        LR.TPR.Flags.IsPresent = false;
----------------
carlobertolli wrote:

Again, still odd: do we not always use getTargetPointer to add a new entry and before calling getTgtPtrBegin? Again, it might be that I do not understand how these APIs are used. 

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


More information about the libcxx-commits mailing list