Skip to content

[SYCL][Fusion] Avoid deferred cleanup for fusion #11598

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
Nov 30, 2023
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