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

via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 13 13:23:59 PDT 2023


================
@@ -289,13 +306,38 @@ TargetPointerResultTy DeviceTy::getTargetPointer(
     // In addition to the mapping rules above, the close map modifier forces the
     // mapping of the variable to the device.
     if (Size) {
-      DP("Return HstPtrBegin " DPxMOD " Size=%" PRId64 " for unified shared "
-         "memory\n",
-         DPxPTR((uintptr_t)HstPtrBegin), Size);
-      LR.TPR.Flags.IsPresent = false;
+      LR.TPR.Flags.IsNewEntry = true;
+      assert(TgtPadding == 0 && "TgtPadding must always be zero in USM mode");
+      uintptr_t TgtPtrBegin = (uintptr_t)HstPtrBegin + TgtPadding;
+      LR.TPR.setEntry(
----------------
carlobertolli wrote:

As you are changing the behavior of getTargetPointer under unified_shared_memory, please update the comment on the declaration of getTargetPointer in device.h.

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


More information about the cfe-commits mailing list