@@ -21,6 +21,7 @@ ur_result_t ur_queue_handle_legacy_t_::enqueueNativeCommandExp(
21
21
uint32_t NumEventsInWaitList, const ur_event_handle_t *phEventList,
22
22
ur_event_handle_t *phEvent) {
23
23
auto Queue = this ;
24
+ std::scoped_lock<ur_shared_mutex> lock (Queue->Mutex );
24
25
25
26
bool UseCopyEngine = false ;
26
27
@@ -60,22 +61,19 @@ ur_result_t ur_queue_handle_legacy_t_::enqueueNativeCommandExp(
60
61
}
61
62
62
63
if (!isInOrderQueue ()) {
63
- UR_CALL (Queue->executeCommandList (CommandList, false ));
64
- queueFinish ();
65
- // queue finish will execute the command list. Open it again so that
66
- // `zeCommandListAppendSignalEvent` can be executed.
64
+ UR_CALL (Queue->executeCommandList (CommandList, false , false ));
67
65
UR_CALL (Queue->Context ->getAvailableCommandList (
68
- Queue, CommandList, UseCopyEngine, NumEventsInWaitList, phEventList ));
66
+ Queue, CommandList, UseCopyEngine, 0 , nullptr ));
69
67
}
70
68
ScopedCommandList Active{Queue, CommandList->first };
71
69
72
70
// Call interop func which enqueues native async work
73
71
pfnNativeEnqueue (Queue, data);
74
72
75
73
if (!isInOrderQueue ()) {
76
- queueFinish ( );
74
+ UR_CALL (Queue-> executeCommandList (CommandList, false , false ) );
77
75
UR_CALL (Queue->Context ->getAvailableCommandList (
78
- Queue, CommandList, UseCopyEngine, NumEventsInWaitList, phEventList ));
76
+ Queue, CommandList, UseCopyEngine, 0 , nullptr ));
79
77
}
80
78
81
79
ZE2UR_CALL (zeCommandListAppendSignalEvent, (ZeCommandList, ZeEvent));
0 commit comments