[Openmp-commits] [PATCH] D132676: [libomptarget] Avoid double-frees and user-after-frees of entries

Ye Luo via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Sep 7 12:17:02 PDT 2022


ye-luo added inline comments.


================
Comment at: openmp/libomptarget/src/omptarget.cpp:687
+    DelEntry = false;
+  }
+
----------------
ye-luo wrote:
> jdoerfert wrote:
> > I think, this can leave an entry intact on the device:
> > ```
> > T1: arrives here, TPR is still life so DeleterThreadCount is 3, won't destory the entry, HDTTMap is released.
> > T2: arrives here, TPR is still life so DeleterThreadCount is 3, won't destory the entry. HDTTMap is released.
> > Both exit this function, TPRs are destroyed, DeleterThreadCount is decremented twice and reaches 1, but nobody executing the code that would delete the entry.
> > ```
> Can this be protected by not calling HDTTMap.destroy()?
Second thought on this. If the mutex protection from HDTTMap is anyway needed, std::atomic seems likely not needed.
Probably need to revisit D123443, D123444 and D123446.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132676



More information about the Openmp-commits mailing list