Skip to content

Commit 55b8aa7

Browse files
[SYCL][L0] address Coverity issue with active_barrier::clear (#8084)
Signed-off-by: Sergey V Maslov <[email protected]>
1 parent 5b904ff commit 55b8aa7

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

sycl/plugins/level_zero/pi_level_zero.cpp

100644100755
Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2017,7 +2017,8 @@ pi_result _pi_queue::insertActiveBarriers(pi_command_list_ptr_t &CmdList,
20172017
return Res;
20182018

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

20222023
if (ActiveBarriersWaitList.Length == 0) {
20232024
return PI_SUCCESS;
@@ -6215,10 +6216,11 @@ void _pi_queue::active_barriers::add(pi_event &Event) {
62156216
Events.push_back(Event);
62166217
}
62176218

6218-
void _pi_queue::active_barriers::clear() {
6219+
pi_result _pi_queue::active_barriers::clear() {
62196220
for (const auto &Event : Events)
6220-
piEventReleaseInternal(Event);
6221+
PI_CALL(piEventReleaseInternal(Event));
62216222
Events.clear();
6223+
return PI_SUCCESS;
62226224
}
62236225

62246226
static pi_result piEventReleaseInternal(pi_event Event) {
@@ -6751,7 +6753,8 @@ pi_result piEnqueueEventsWaitWithBarrier(pi_queue Queue,
67516753
if (auto Res = Queue->executeCommandList(CmdList, false, OkToBatch))
67526754
return Res;
67536755

6754-
Queue->ActiveBarriers.clear();
6756+
if (auto Res = Queue->ActiveBarriers.clear())
6757+
return Res;
67556758
Queue->ActiveBarriers.add(*Event);
67566759
return PI_SUCCESS;
67576760
}
@@ -6859,7 +6862,9 @@ pi_result _pi_queue::synchronize() {
68596862

68606863
// With the entire queue synchronized, the active barriers must be done so we
68616864
// can remove them.
6862-
ActiveBarriers.clear();
6865+
if (auto Res = ActiveBarriers.clear())
6866+
return Res;
6867+
68636868
return PI_SUCCESS;
68646869
}
68656870

sycl/plugins/level_zero/pi_level_zero.hpp

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ struct _pi_queue : _pi_object {
805805
struct active_barriers {
806806
std::vector<pi_event> Events;
807807
void add(pi_event &Event);
808-
void clear();
808+
pi_result clear();
809809
bool empty() { return Events.empty(); }
810810
std::vector<pi_event> &vector() { return Events; }
811811
};

0 commit comments

Comments
 (0)