[Openmp-commits] [PATCH] D104418: [OpenMP][Offloading] Fixed data race in libomptarget caused by async data movement
Jon Chesterfield via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Wed Jan 5 02:02:34 PST 2022
JonChesterfield added inline comments.
Comment at: openmp/libomptarget/src/device.cpp:95
+ void *Event = search->getEvent();
+ if (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.
This would be solvable by calling dlclose on the plugins that have been opened by dlopen before libomptarget is destructed. That seems like a good idea independent of this patch - the plugin lifetime can be strictly nested within the lifetime of libomptarget.so
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
More information about the Openmp-commits