Skip to content

Commit

Permalink
Merge pull request #1259 from igchor/fix_sync
Browse files Browse the repository at this point in the history
[L0] do not ignore returned values from zeHostSynchronize
  • Loading branch information
kbenzie authored Jan 22, 2024
2 parents 92f44da + f9ad3d4 commit 6032f6f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion source/adapters/level_zero/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueEventsWait(
/* IsInternal */ false));
}

Queue->synchronize();
UR_CALL(Queue->synchronize());

if (OutEvent) {
Queue->LastCommandEvent = reinterpret_cast<ur_event_handle_t>(*OutEvent);
Expand Down
8 changes: 4 additions & 4 deletions source/adapters/level_zero/queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urQueueRelease(
return Res;

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

// Destroy all the fences created associated with this queue.
for (auto it = Queue->CommandListMap.begin();
Expand Down Expand Up @@ -654,7 +654,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urQueueFinish(
// Lock automatically releases when this goes out of scope.
std::scoped_lock<ur_shared_mutex> Lock(UrQueue->Mutex);

UrQueue->synchronize();
UR_CALL(UrQueue->synchronize());
} else {
std::unique_lock<ur_shared_mutex> Lock(UrQueue->Mutex);
std::vector<ze_command_queue_handle_t> ZeQueues;
Expand Down Expand Up @@ -1241,7 +1241,7 @@ ur_queue_handle_t_::executeCommandList(ur_command_list_ptr_t CommandList,
// Check global control to make every command blocking for debugging.
if (IsBlocking || (UrL0Serialize & UrL0SerializeBlock) != 0) {
if (UsingImmCmdLists) {
synchronize();
UR_CALL(synchronize());
} else {
// Wait until command lists attached to the command queue are executed.
ZE2UR_CALL(zeHostSynchronize, (ZeCommandQueue));
Expand Down Expand Up @@ -1445,7 +1445,7 @@ ur_result_t ur_queue_handle_t_::synchronize() {
for (auto &QueueGroup : QueueMap) {
if (UsingImmCmdLists) {
for (auto &ImmCmdList : QueueGroup.second.ImmCmdLists)
syncImmCmdList(this, ImmCmdList);
UR_CALL(syncImmCmdList(this, ImmCmdList));
} else {
for (auto &ZeQueue : QueueGroup.second.ZeQueues)
if (ZeQueue)
Expand Down
2 changes: 1 addition & 1 deletion source/adapters/level_zero/queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ struct ur_queue_handle_t_ : _ur_object {
bool isImmediateSubmission() const;

// Wait for all commandlists associated with this Queue to finish operations.
ur_result_t synchronize();
[[nodiscard]] ur_result_t synchronize();

// Get event from the queue's cache.
// Returns nullptr if the cache doesn't contain any reusable events or if the
Expand Down

0 comments on commit 6032f6f

Please sign in to comment.