Skip to content

Commit

Permalink
[SYCL] [L0] Fix for event leakage when using immediate commandlists. (#…
Browse files Browse the repository at this point in the history
…7546)

This change properly gathers events that have been set and need to be
recycled.
  • Loading branch information
rdeodhar committed Dec 2, 2022
1 parent 5a140b3 commit 5b021a2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sycl/plugins/level_zero/pi_level_zero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1036,13 +1036,15 @@ _pi_queue::resetCommandList(pi_command_list_ptr_t CommandList,
EventList.clear();
} else {
// For immediate commandlist reset only those events that have signalled.
for (auto it = EventList.begin(); it != EventList.end(); it++) {
for (auto it = EventList.begin(); it != EventList.end();) {
std::scoped_lock<pi_shared_mutex> EventLock((*it)->Mutex);
ze_result_t ZeResult =
ZE_CALL_NOCHECK(zeEventQueryStatus, ((*it)->ZeEvent));
if (ZeResult == ZE_RESULT_SUCCESS) {
std::move(it, it, std::back_inserter(EventListToCleanup));
EventList.erase(it, it);
EventListToCleanup.push_back(std::move((*it)));
it = EventList.erase(it);
} else {
it++;
}
}
}
Expand Down

0 comments on commit 5b021a2

Please sign in to comment.