@@ -21,6 +21,7 @@ ur_result_t ur_queue_handle_legacy_t_::enqueueNativeCommandExp(
2121 uint32_t NumEventsInWaitList, const ur_event_handle_t *phEventList,
2222 ur_event_handle_t *phEvent) {
2323 auto Queue = this ;
24+ std::scoped_lock<ur_shared_mutex> lock (Queue->Mutex );
2425
2526 bool UseCopyEngine = false ;
2627
@@ -60,22 +61,19 @@ ur_result_t ur_queue_handle_legacy_t_::enqueueNativeCommandExp(
6061 }
6162
6263 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 ));
6765 UR_CALL (Queue->Context ->getAvailableCommandList (
68- Queue, CommandList, UseCopyEngine, NumEventsInWaitList, phEventList ));
66+ Queue, CommandList, UseCopyEngine, 0 , nullptr ));
6967 }
7068 ScopedCommandList Active{Queue, CommandList->first };
7169
7270 // Call interop func which enqueues native async work
7371 pfnNativeEnqueue (Queue, data);
7472
7573 if (!isInOrderQueue ()) {
76- queueFinish ( );
74+ UR_CALL (Queue-> executeCommandList (CommandList, false , false ) );
7775 UR_CALL (Queue->Context ->getAvailableCommandList (
78- Queue, CommandList, UseCopyEngine, NumEventsInWaitList, phEventList ));
76+ Queue, CommandList, UseCopyEngine, 0 , nullptr ));
7977 }
8078
8179 ZE2UR_CALL (zeCommandListAppendSignalEvent, (ZeCommandList, ZeEvent));
0 commit comments