[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 20:12:02 PST 2022

ye-luo added inline comments.

Comment at: openmp/libomptarget/src/device.cpp:279
+    void *Event = Entry->getEvent();
+    bool NeedNewEvent = Event == nullptr;
One more question. Should the event only protect IsNew or both IsNew and HasFlagAlways? I feel in the case of HasFlagAlways not IsNew, it is user's responsible to handle the ordering of multiple transfers.

Comment at: openmp/libomptarget/src/device.cpp:311
+      if (Event) {
+        int Ret = waitEvent(Event, AsyncInfo);
+        Entry->unlock();
ye-luo wrote:
> ye-luo wrote:
> > After the first transfer, every look up calls waitEvent which is still costly.
> > It is better to return the even back to the pool and avoid waitEvent cost.
> I misunderstood waitEvent. It just enqueues the event to the stream. Need to find a better place to reduce the necessary waitEvent.
I think waitEvent can be bypassed if the present modifier is true.

  rG LLVM Github Monorepo



More information about the Openmp-commits mailing list