[Openmp-commits] [PATCH] D74145: [OpenMP][Offloading] Added support for multiple streams so that multiple kernels can be executed concurrently

Shilei Tian via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Feb 7 10:08:17 PST 2020


tianshilei1992 marked 2 inline comments as done.
tianshilei1992 added inline comments.


================
Comment at: openmp/libomptarget/plugins/cuda/src/rtl.cpp:95
   std::vector<std::list<FuncOrGblEntryTy>> FuncGblEntries;
+  std::vector<std::unique_ptr<std::atomic_int>> NextStreamId;
 
----------------
JonChesterfield wrote:
> tianshilei1992 wrote:
> > jdoerfert wrote:
> > > Make it `uint` please.
> > Right, in case of integer overflow, my bad...
> vector of pointers to atomic_int is interesting. What's the advantage over vector<atomic_int>?
> 
> It might be worth putting a few asserts in the code to the effect that resizing the vector after the initial construction will break access from other threads.
`atomic_int` is not copyable. And the initialization of all these pointers are after the resize of vector, so we might not need to consider that.


================
Comment at: openmp/libomptarget/plugins/cuda/src/rtl.cpp:259
+    for (std::unique_ptr<std::atomic_int> &Ptr : NextStreamId) {
+      Ptr = std::unique_ptr<std::atomic_int>(new std::atomic_int(0));
+    }
----------------
JonChesterfield wrote:
> If we do need the pointer wrapper, this should be make_unique
`make_unique` only works since C++14.


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

https://reviews.llvm.org/D74145





More information about the Openmp-commits mailing list