Skip to content

[SYCL][L0] address Coverity issue with active_barrier::clear #8084

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
15 changes: 10 additions & 5 deletions sycl/plugins/level_zero/pi_level_zero.cpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2012,7 +2012,8 @@ pi_result _pi_queue::insertActiveBarriers(pi_command_list_ptr_t &CmdList,
return Res;

// We can now replace active barriers with the ones in the wait list.
ActiveBarriers.clear();
if (auto Res = ActiveBarriers.clear())
return Res;

if (ActiveBarriersWaitList.Length == 0) {
return PI_SUCCESS;
Expand Down Expand Up @@ -6210,10 +6211,11 @@ void _pi_queue::active_barriers::add(pi_event &Event) {
Events.push_back(Event);
}

void _pi_queue::active_barriers::clear() {
pi_result _pi_queue::active_barriers::clear() {
for (const auto &Event : Events)
piEventReleaseInternal(Event);
PI_CALL(piEventReleaseInternal(Event));
Events.clear();
return PI_SUCCESS;
}

static pi_result piEventReleaseInternal(pi_event Event) {
Expand Down Expand Up @@ -6746,7 +6748,8 @@ pi_result piEnqueueEventsWaitWithBarrier(pi_queue Queue,
if (auto Res = Queue->executeCommandList(CmdList, false, OkToBatch))
return Res;

Queue->ActiveBarriers.clear();
if (auto Res = Queue->ActiveBarriers.clear())
return Res;
Queue->ActiveBarriers.add(*Event);
return PI_SUCCESS;
}
Expand Down Expand Up @@ -6854,7 +6857,9 @@ pi_result _pi_queue::synchronize() {

// With the entire queue synchronized, the active barriers must be done so we
// can remove them.
ActiveBarriers.clear();
if (auto Res = ActiveBarriers.clear())
return Res;

return PI_SUCCESS;
}

Expand Down
2 changes: 1 addition & 1 deletion sycl/plugins/level_zero/pi_level_zero.hpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ struct _pi_queue : _pi_object {
struct active_barriers {
std::vector<pi_event> Events;
void add(pi_event &Event);
void clear();
pi_result clear();
bool empty() { return Events.empty(); }
std::vector<pi_event> &vector() { return Events; }
};
Expand Down