Skip to content

Commit 34a4689

Browse files
authored
[SYCL] Destroy event_impl dependencies in command class destructor (#5401)
Move destroying of dependencies to command destructor. Signed-off-by: mdimakov <maxim.dimakov@intel.com>
1 parent ac3e816 commit 34a4689

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

sycl/source/detail/scheduler/commands.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <CL/sycl/access/access.hpp>
2020
#include <CL/sycl/detail/accessor_impl.hpp>
2121
#include <CL/sycl/detail/cg.hpp>
22+
#include <detail/event_impl.hpp>
2223
#include <detail/program_manager/program_manager.hpp>
2324

2425
__SYCL_INLINE_NAMESPACE(cl) {
@@ -187,7 +188,7 @@ class Command {
187188
return nullptr;
188189
}
189190

190-
virtual ~Command() = default;
191+
virtual ~Command() { MEvent->cleanupDependencyEvents(); }
191192

192193
const char *getBlockReason() const;
193194

sycl/source/detail/scheduler/graph_builder.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ static void handleVisitedNodes(std::vector<Command *> &Visited) {
129129
for (Command *Cmd : Visited) {
130130
if (Cmd->MMarks.MToBeDeleted) {
131131
Cmd->getEvent()->setCommand(nullptr);
132-
Cmd->getEvent()->cleanupDependencyEvents();
133132
delete Cmd;
134133
} else
135134
Cmd->MMarks.MVisited = false;
@@ -1187,7 +1186,6 @@ void Scheduler::GraphBuilder::cleanupCommand(Command *Cmd) {
11871186
}
11881187

11891188
Cmd->getEvent()->setCommand(nullptr);
1190-
Cmd->getEvent()->cleanupDependencyEvents();
11911189
delete Cmd;
11921190
}
11931191

0 commit comments

Comments
 (0)