Skip to content

Commit a5a5e03

Browse files
authored
[SYCL] Skip alloca commands when checking for leaves completion (#10740)
Scheduler::checkLeavesCompletion checks status of all leaves of the buffer to see whether we can destroy that sycl::buffer. There are many scenarios when alloca commands are leaves, these commands don't have associated event and currently they are always incorrectly considered "in progress" because of that preventing buffers to be destroyed timely and deferring their destruction till the point of program termination. Skip alloca commands to fix that.
1 parent bf97252 commit a5a5e03

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

sycl/source/detail/scheduler/scheduler.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,15 @@ namespace detail {
2727

2828
bool Scheduler::checkLeavesCompletion(MemObjRecord *Record) {
2929
for (Command *Cmd : Record->MReadLeaves) {
30-
if (!Cmd->getEvent()->isCompleted())
30+
if (!(Cmd->getType() == detail::Command::ALLOCA ||
31+
Cmd->getType() == detail::Command::ALLOCA_SUB_BUF) &&
32+
!Cmd->getEvent()->isCompleted())
3133
return false;
3234
}
3335
for (Command *Cmd : Record->MWriteLeaves) {
34-
if (!Cmd->getEvent()->isCompleted())
36+
if (!(Cmd->getType() == detail::Command::ALLOCA ||
37+
Cmd->getType() == detail::Command::ALLOCA_SUB_BUF) &&
38+
!Cmd->getEvent()->isCompleted())
3539
return false;
3640
}
3741
return true;

0 commit comments

Comments
 (0)