[Openmp-commits] [PATCH] D104418: [PoC][WIP][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
Sat Jun 19 01:18:01 PDT 2021
JonChesterfield added inline comments.
================
Comment at: openmp/libomptarget/src/device.h:54
+ /// Pointer to the event corresponding to the data movement of this map.
+ mutable std::shared_ptr<std::atomic<void *>> Event;
+
----------------
tianshilei1992 wrote:
> jdoerfert wrote:
> > tianshilei1992 wrote:
> > > We have to use `shared_ptr` here as this data structure has to be copied but `std::atomic` is un-copyable.
> > Why is this a shared ptr?
> Because `unique_ptr` is non-copyable.
Could write a copy constructor. Also possible it only needs to be moved, not copied. Don't really want to add an ad hoc garbage collector (aka shared_ptr) to the existing complexity if we can avoid it, lifetimes are opaque enough already
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