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

Joseph Huber via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Jun 18 12:14:36 PDT 2021


jhuber6 added inline comments.


================
Comment at: openmp/libomptarget/src/device.cpp:229
          (IsImplicit ? " (implicit)" : ""), DPxPTR(HstPtrBegin), DPxPTR(tp),
-         Size, (UpdateRefCount ? " updated" : ""),
-         HT.isRefCountInf() ? "INF" : std::to_string(HT.getRefCount()).c_str(),
+         Size, HT.refCountToStr().c_str(), RefCountAction,
          (HstPtrName) ? getNameFromMapping(HstPtrName).c_str() : "unknown");
----------------
jdenny wrote:
> jhuber6 wrote:
> > 
> I would prefer to determine the action and the record of the action at the same time instead of duplicating the logic.  I think that's easier to maintain.  However, this case is simple, so I can change it if you feel strongly.
It's fine as is if you're going to be using it for something more complicated. If it was just printing it this would be the best option.


================
Comment at: openmp/libomptarget/src/device.h:92
+
+  std::string refCountToStr() const {
+    return isRefCountInf() ? "INF" : std::to_string(getRefCount());
----------------
jdenny wrote:
> jhuber6 wrote:
> > We'll also want to do this for dumping the device table, since anything with an infinite ref count will be printed at the end of the program.
> Thanks, I'll change that.  Is it just `dumpTargetPointerMappings`?
Yes, where it calls `getRefCount`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104559



More information about the Openmp-commits mailing list