[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
Mon Dec 27 20:34:17 PST 2021

tianshilei1992 added inline comments.

Comment at: openmp/libomptarget/src/device.cpp:112
+      if (Event)
+        destroyEvent(Event);
       return OFFLOAD_SUCCESS;
tianshilei1992 wrote:
> 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.
Now we have event pool in plugin so it will not be an issue if we leave one event in `libomptarget`.

  rG LLVM Github Monorepo



More information about the Openmp-commits mailing list