[Openmp-commits] [PATCH] D104559: [OpenMP] Improve ref count debug messages

George Rokos via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Jun 22 01:22:27 PDT 2021


grokos added inline comments.


================
Comment at: openmp/libomptarget/src/device.cpp:266-275
+    HostDataToTargetTy newEntry((uintptr_t)HstPtrBase, (uintptr_t)HstPtrBegin,
+                                (uintptr_t)HstPtrBegin + Size, tp, HstPtrName);
     INFO(OMP_INFOTYPE_MAPPING_CHANGED, DeviceID,
          "Creating new map entry with "
-         "HstPtrBegin=" DPxMOD ", TgtPtrBegin=" DPxMOD ", Size=%ld, Name=%s\n",
+         "HstPtrBegin=" DPxMOD ", TgtPtrBegin=" DPxMOD ", Size=%ld, "
+         "RefCount=%s, Name=%s\n",
          DPxPTR(HstPtrBegin), DPxPTR(tp), Size,
----------------
grokos wrote:
> Just to restore the faster `emplace` method, we can have something like this:
> ```
> auto newEntry = HostDataToTargetMap.emplace(HostDataToTargetTy(base, begin,...));
> INFO(..., newEntry.refCountToStr().c_str(), ...);
> ```
> 
Actually, you don't even need to create a `HostDataToTargetTy` object inside `emplace`, just call the function with the arguments directly (like in D104580):
```
auto newEntry = HostDataToTargetMap.emplace(base, begin,...);
INFO(..., newEntry.refCountToStr().c_str(), ...);
```



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104559/new/

https://reviews.llvm.org/D104559



More information about the Openmp-commits mailing list