From 979c21cc2dfdcb2dfda21823586922cd16a48b69 Mon Sep 17 00:00:00 2001 From: Hugh Delaney Date: Tue, 25 Jun 2024 10:53:31 +0100 Subject: [PATCH] Get scopedcontext device from UR context An event created with interop doesn't have an associated queue. So get an active device through the context. --- source/adapters/cuda/event.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/adapters/cuda/event.cpp b/source/adapters/cuda/event.cpp index bbe92ddef8..9889031f1b 100644 --- a/source/adapters/cuda/event.cpp +++ b/source/adapters/cuda/event.cpp @@ -219,7 +219,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urEventSetCallback(ur_event_handle_t, UR_APIEXPORT ur_result_t UR_APICALL urEventWait(uint32_t numEvents, const ur_event_handle_t *phEventWaitList) { try { - ScopedContext Active(phEventWaitList[0]->getQueue()->getDevice()); + // Interop events don't have an associated queue, so get device through + // context + ScopedContext Active(phEventWaitList[0]->getContext()->getDevices()[0]); auto WaitFunc = [](ur_event_handle_t Event) -> ur_result_t { UR_ASSERT(Event, UR_RESULT_ERROR_INVALID_EVENT);