[Openmp-commits] [PATCH] D104418: [OpenMP][Offloading] Fixed data race in libomptarget caused by async data movement

Shilei Tian via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Jan 4 16:52:03 PST 2022


tianshilei1992 marked an inline comment as done.
tianshilei1992 added inline comments.


================
Comment at: openmp/libomptarget/src/device.cpp:95
+      void *Event = search->getEvent();
+      if (Event)
+        destroyEvent(Event);
----------------
ye-luo wrote:
> Use unique_ptr with Deleter for Event?
That sounds reasonable but actually not practical. Same as what I said before, we can't have automatic destroy of the event because when `libomptarget` starts to destroy, we don't know whether the plugin is already dead. Calling to plugin may cause segment fault. Since we already have event pool, all those events will be destroyed properly when a plugin is destroyed. For those resources shared between `libomptarget` and plugins, `libomptarget` can only hold it, but not own it. That being said, we can only have *explicit* destruction.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104418



More information about the Openmp-commits mailing list