Skip to content

Commit def30e8

Browse files
author
Hugh Delaney
committed
Don't change order of active context
1 parent 87afd90 commit def30e8

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

source/adapters/cuda/enqueue.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -644,12 +644,11 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferReadRect(
644644
&hBuffer->LastEventWritingToMemObj));
645645
}
646646

647+
ScopedContext Active(Device);
648+
647649
UR_CHECK_ERROR(enqueueEventsWait(hQueue, Stream, numEventsInWaitList,
648650
phEventWaitList));
649651

650-
// enqueueEventsWait may set a context so we need to reset it here
651-
ScopedContext Active(Device);
652-
653652
if (phEvent) {
654653
RetImplEvent =
655654
std::unique_ptr<ur_event_handle_t_>(ur_event_handle_t_::makeNative(
@@ -1655,12 +1654,11 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferRead(
16551654
&hBuffer->LastEventWritingToMemObj));
16561655
}
16571656

1657+
ScopedContext Active(Device);
1658+
16581659
UR_CHECK_ERROR(enqueueEventsWait(hQueue, Stream, numEventsInWaitList,
16591660
phEventWaitList));
16601661

1661-
// enqueueEventsWait may set a context so we need to reset it here
1662-
ScopedContext Active(Device);
1663-
16641662
if (phEvent) {
16651663
RetImplEvent =
16661664
std::unique_ptr<ur_event_handle_t_>(ur_event_handle_t_::makeNative(

0 commit comments

Comments
 (0)