[Openmp-commits] [PATCH] D123445: [OpenMP][FIX] Ensure to set the context for wait events if necessary

Johannes Doerfert via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Apr 8 22:14:49 PDT 2022


jdoerfert created this revision.
jdoerfert added reviewers: ye-luo, JonChesterfield, jhuber6, tianshilei1992.
Herald added subscribers: guansong, bollu, yaxunl.
Herald added a project: All.
jdoerfert requested review of this revision.
Herald added a subscriber: sstefan1.
Herald added a project: OpenMP.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D123445

Files:
  openmp/libomptarget/plugins/cuda/src/rtl.cpp


Index: openmp/libomptarget/plugins/cuda/src/rtl.cpp
===================================================================
--- openmp/libomptarget/plugins/cuda/src/rtl.cpp
+++ openmp/libomptarget/plugins/cuda/src/rtl.cpp
@@ -1734,7 +1734,10 @@
   assert(DeviceRTL.isValidDeviceId(device_id) && "device_id is invalid");
   assert(async_info_ptr && "async_info_ptr is nullptr");
   assert(event_ptr && "event is nullptr");
-  // NOTE: We might not need to set context for event sync.
+  // If we don't have a queue we need to set the context.
+  if (!async_info_ptr->Queue &&
+      DeviceRTL.setContext(device_id) != OFFLOAD_SUCCESS)
+    return OFFLOAD_FAIL;
   return DeviceRTL.waitEvent(device_id, async_info_ptr, event_ptr);
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123445.421688.patch
Type: text/x-patch
Size: 730 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20220409/96cd7d38/attachment.bin>


More information about the Openmp-commits mailing list