Skip to content

Commit 2dbe080

Browse files
committed
Command-buffer immediate command-list CTS fix
As discovered in #1951 (comment) there is an issue running the command-buffer CTS tests on L0 with command-lists enabled. After investigating, this was because the CTS tests we're not using the output event parameter to command-buffer enqueue. In the L0 adapter code a path for registering an event with the queue to waiting on the workload was guarded by this event being set. Therefore `urQueueFinish` was not working as expected, as the queue was not aware of this work to wait on. Fixed by always registering the work to wait on with the queue, and miss out on propagation of the created event when user doesn't pass an output event, rather than not creating it at all.
1 parent 89dc3a5 commit 2dbe080

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

source/adapters/level_zero/command_buffer.cpp

Lines changed: 9 additions & 6 deletions
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)