[Openmp-commits] [PATCH] D111954: [OpenMP][Plugin] Introduce resouce manager

Ye Luo via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Sat Oct 16 17:41:58 PDT 2021


ye-luo added inline comments.


================
Comment at: openmp/libomptarget/plugins/cuda/src/rtl.cpp:213
+    for (size_t I = CurSize; I < Size; ++I)
+      Resources.push_back(Allocator.allocate());
   }
----------------
Whe CUDA call fails. Allocator.allocate() returns nullptr and the code continues running. This doesn't make sense.


================
Comment at: openmp/libomptarget/plugins/cuda/src/rtl.cpp:270
+
+  CUstream allocate() noexcept {
+    if (!checkResult(cuCtxSetCurrent(DeviceData.Context),
----------------
ye-luo wrote:
> allocate and deallocate are really meant for pointers. How about create/destroy for single object.
Error handling and returning the object needs to be separate.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111954



More information about the Openmp-commits mailing list