[Openmp-commits] [PATCH] D104418: [OpenMP][Offloading] Fixed data race in libomptarget caused by async data movement

Ye Luo via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Jan 4 10:40:32 PST 2022


ye-luo added a comment.

I still think the new/old event exchange should be removed.
If T1 record an event for a D2H transfer and then T2 issues a H2D transfer and create an new event and then wait for the old event. the H2D or D2H may happen together when they are on two distinct streams.
This violates `atomic` data transfer behavior.
the solution is 1 persistent event per map and always check its status before issuing any transfer.



================
Comment at: openmp/libomptarget/src/device.cpp:95
+      void *Event = search->getEvent();
+      if (Event)
+        destroyEvent(Event);
----------------
Use unique_ptr with Deleter for Event?


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