Skip to content

Commit

Permalink
Merge pull request #1300 from nrspruit/queue_release_cleanup
Browse files Browse the repository at this point in the history
[L0] Cleanup Queue at Release unconditionally and reset command list after failure
  • Loading branch information
pbalcer committed Feb 9, 2024
2 parents 9babc4d + 24066e4 commit 32e2533
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions source/adapters/level_zero/queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,11 +407,11 @@ UR_APIEXPORT ur_result_t UR_APICALL urQueueRelease(
//
// It is possible to get to here and still have an open command list
// if no wait or finish ever occurred for this queue.
if (auto Res = Queue->executeAllOpenCommandLists())
return Res;
auto Res = Queue->executeAllOpenCommandLists();

// Make sure all commands get executed.
UR_CALL(Queue->synchronize());
if (Res == UR_RESULT_SUCCESS)
UR_CALL(Queue->synchronize());

// Destroy all the fences created associated with this queue.
for (auto it = Queue->CommandListMap.begin();
Expand Down Expand Up @@ -1207,6 +1207,12 @@ ur_queue_handle_t_::executeCommandList(ur_command_list_ptr_t CommandList,
// Turn into a more informative end-user error.
return UR_RESULT_ERROR_UNKNOWN;
}
// Reset Command List and erase the Fence forcing the user to resubmit
// their commands.
std::vector<ur_event_handle_t> EventListToCleanup;
resetCommandList(CommandList, true, EventListToCleanup, false);
CleanupEventListFromResetCmdList(EventListToCleanup,
true /* QueueLocked */);
return ze2urResult(ZeResult);
}
}
Expand Down

0 comments on commit 32e2533

Please sign in to comment.