[Openmp-commits] [openmp] a3a42c3 - [OpenMP][FIX] Ensure to set the context for wait events if necessary
Johannes Doerfert via Openmp-commits
openmp-commits at lists.llvm.org
Tue Apr 12 14:44:01 PDT 2022
Author: Johannes Doerfert
Date: 2022-04-12T16:42:50-05:00
New Revision: a3a42c3ca23e94d710bf3100965cc2146f11dbf8
URL: https://github.com/llvm/llvm-project/commit/a3a42c3ca23e94d710bf3100965cc2146f11dbf8
DIFF: https://github.com/llvm/llvm-project/commit/a3a42c3ca23e94d710bf3100965cc2146f11dbf8.diff
LOG: [OpenMP][FIX] Ensure to set the context for wait events if necessary
Differential Revision: https://reviews.llvm.org/D123445
Added:
Modified:
openmp/libomptarget/plugins/cuda/src/rtl.cpp
Removed:
################################################################################
diff --git a/openmp/libomptarget/plugins/cuda/src/rtl.cpp b/openmp/libomptarget/plugins/cuda/src/rtl.cpp
index f34d9079d1b80..d6cf1667bb944 100644
--- a/openmp/libomptarget/plugins/cuda/src/rtl.cpp
+++ b/openmp/libomptarget/plugins/cuda/src/rtl.cpp
@@ -1734,7 +1734,10 @@ int32_t __tgt_rtl_wait_event(int32_t device_id, void *event_ptr,
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);
}
More information about the Openmp-commits
mailing list