Skip to content

Commit 26f1dfc

Browse files
Merge pull request #1960 from Bensuo/ewan/imm_command_list_fix
Command-buffer immediate command-list CTS fix
2 parents 89dc3a5 + 2dbe080 commit 26f1dfc

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

source/adapters/level_zero/command_buffer.cpp

+9-6
Original file line numberDiff line numberDiff line change
@@ -1300,13 +1300,14 @@ ur_result_t waitForDependencies(ur_exp_command_buffer_handle_t CommandBuffer,
13001300
* @param[in] CommandBuffer The command buffer.
13011301
* @param[in] Queue The UR queue used to submit the command buffer.
13021302
* @param[in] SignalCommandList The command-list to append the barrier to.
1303-
* @param[out] Event The host visible event which will be returned to the user.
1303+
* @param[out][optional] Event The host visible event which will be returned
1304+
* to the user, if user passed an output parameter to the UR API.
13041305
* @return UR_RESULT_SUCCESS or an error code on failure
13051306
*/
13061307
ur_result_t createUserEvent(ur_exp_command_buffer_handle_t CommandBuffer,
13071308
ur_queue_handle_legacy_t Queue,
13081309
ur_command_list_ptr_t SignalCommandList,
1309-
ur_event_handle_t &Event) {
1310+
ur_event_handle_t *Event) {
13101311
// Execution event for this enqueue of the UR command-buffer
13111312
ur_event_handle_t RetEvent{};
13121313

@@ -1342,7 +1343,9 @@ ur_result_t createUserEvent(ur_exp_command_buffer_handle_t CommandBuffer,
13421343
&(CommandBuffer->SignalEvent->ZeEvent)));
13431344
}
13441345

1345-
Event = RetEvent;
1346+
if (Event) {
1347+
*Event = RetEvent;
1348+
}
13461349

13471350
return UR_RESULT_SUCCESS;
13481351
}
@@ -1405,9 +1408,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferEnqueueExp(
14051408
ZE2UR_CALL(zeCommandListAppendEventReset,
14061409
(SignalCommandList->first, CommandBuffer->AllResetEvent->ZeEvent));
14071410

1408-
if (Event) {
1409-
UR_CALL(createUserEvent(CommandBuffer, Queue, SignalCommandList, *Event));
1410-
}
1411+
// Appends a wait on the main command-list signal and registers output Event
1412+
// parameter with signal command-list completing.
1413+
UR_CALL(createUserEvent(CommandBuffer, Queue, SignalCommandList, Event));
14111414

14121415
UR_CALL(Queue->executeCommandList(SignalCommandList, false, false));
14131416

0 commit comments

Comments
 (0)