Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions sycl/plugins/level_zero/pi_level_zero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4111,8 +4111,13 @@ pi_result piEventGetInfo(pi_event Event, pi_event_info ParamName,
// Lock automatically releases when this goes out of scope.
std::lock_guard<std::mutex> lock(Event->Queue->PiQueueMutex);

if (auto Res = Event->Queue->executeOpenCommandList())
return Res;
// Only do the execute of the open command list if the event that
// is being queried and event that is to be signalled by something
// currently in that open command list.
if (Event->Queue->ZeOpenCommandList == Event->ZeCommandList) {
if (auto Res = Event->Queue->executeOpenCommandList())
return Res;
}
}

ze_result_t ZeResult;
Expand Down
19 changes: 13 additions & 6 deletions sycl/source/detail/queue_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,21 @@ void queue_impl::addSharedEvent(const event &Event) {
// of them can be released.
const size_t EventThreshold = 128;
if (MEventsShared.size() >= EventThreshold) {
// Generally, the vector is ordered so that the oldest events are in the
// front and the newer events are in the end. So, search to find the first
// event that isn't yet complete. All the events prior to that can be
// erased. This could leave some few events further on that have completed
// not yet erased, but that is OK. This cleanup doesn't have to be perfect.
// This also keeps the algorithm linear rather than quadratic because it
// doesn't continually recheck things towards the back of the list that
// really haven't had time to complete.
MEventsShared.erase(
std::remove_if(
MEventsShared.begin(), MEventsShared.end(),
[](const event &E) {
return E.get_info<info::event::command_execution_status>() ==
MEventsShared.begin(),
std::find_if(
MEventsShared.begin(), MEventsShared.end(), [](const event &E) {
return E.get_info<info::event::command_execution_status>() !=
info::event_command_status::complete;
}),
MEventsShared.end());
}));
}
MEventsShared.push_back(Event);
}
Expand Down