[Openmp-commits] [PATCH] D120089: [OpenMP] Explicitly deinitialize device resources

Shilei Tian via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon Mar 7 07:37:46 PST 2022


tianshilei1992 added inline comments.


================
Comment at: openmp/libomptarget/plugins/cuda/src/rtl.cpp:590
 
+    assert(InitializedFlags[DeviceId] == false && "Reinitializing device!");
+    InitializedFlags[DeviceId] = true;
----------------
Actually this could have data race. Say if multiple threads are trying to initialize it at the same time. I don't remember we have the guard in `libomptarget`. We could potentially use `std::vector<std::once_flag>` instead.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120089



More information about the Openmp-commits mailing list