[Openmp-commits] [PATCH] D124652: [OpenMP] [OMPT] [amdgpu] [5/8] Implemented device init/fini/load callbacks

Michael Halkenhäuser via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Mar 22 10:41:52 PDT 2023


mhalk added inline comments.


================
Comment at: openmp/libomptarget/plugins-nextgen/common/OMPT/OmptCallback.cpp:32
+void OmptDeviceCallbacksTy::resize(int NumDevices) {
+  Devices = new OmptDeviceTy[NumDevices];
+}
----------------
dhruvachak wrote:
> mhalk wrote:
> > jplehr wrote:
> > > Potentially we should not allocate if `Devices` already holds a pointer, i.e., is not `nullptr`? This looks suspiciously as if we can leak memory here.
> > Agreed. I'll simply send a DebugPrint when allocation failed.
> > That is, when: zero or negative NumDevices were requested or when `Devices` was already allocated / non-nullptr.
> Why not assert that Devices is nullptr before allocation?
I decided to update the revision, so you can see how I handled things "in the meantime".
(Hopefully, my intermediate changes won't break this, otherwise I'll have to update the whole patch stack.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124652



More information about the Openmp-commits mailing list