[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
Sat Oct 16 16:41:04 PDT 2021


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


================
Comment at: openmp/libomptarget/src/device.cpp:112
+      if (Event)
+        destroyEvent(Event);
       return OFFLOAD_SUCCESS;
----------------
ye-luo wrote:
> I feel it is better to have a wrapper wraps the raw Event and handles destroyEvent at the destructor.
> 
> Once HostDataToTargetMap destructor got called, all the Events are leaked.
`HostDataToTargetMap` is destroyed along with `libomptarget`. Because of the way `libomptarget` and plugins are connected, plugins could already have been destroyed at that moment, and if that is the case, it is undefined behavior to call functions in plugins. D111954 can make sure the events are correctly released.


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