Skip to content
Merged
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
11 changes: 9 additions & 2 deletions sycl/source/detail/scheduler/scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,15 @@ void Scheduler::cleanupCommands(const std::vector<Command *> &Cmds) {

} else {
std::lock_guard<std::mutex> Lock{MDeferredCleanupMutex};
MDeferredCleanupCommands.insert(MDeferredCleanupCommands.end(),
Cmds.begin(), Cmds.end());
// Full cleanup for fusion placeholder commands is handled by the entry
// points for fusion (start_fusion, ...). To avoid double free or access to
// objects after their lifetime, fusion commands should therefore never be
// added to the deferred command list.
std::copy_if(Cmds.begin(), Cmds.end(),
std::back_inserter(MDeferredCleanupCommands),
[](const Command *Cmd) {
return Cmd->getType() != Command::CommandType::FUSION;
});
}
}

Expand Down