From 64cb0cf96de28bfd495e577b4dd46c26dbb6b197 Mon Sep 17 00:00:00 2001 From: Ben Tracy Date: Tue, 7 May 2024 11:03:53 +0100 Subject: [PATCH] [SYCL][Graph] Fix minor issues in graph update code (#13660) - Check for empty cmd group when updating node reqs - Fix nullptr deref in reqs check --- sycl/source/detail/graph_impl.cpp | 2 ++ sycl/source/detail/graph_impl.hpp | 3 +++ 2 files changed, 5 insertions(+) diff --git a/sycl/source/detail/graph_impl.cpp b/sycl/source/detail/graph_impl.cpp index 025fde4904a9..3da1864dd241 100644 --- a/sycl/source/detail/graph_impl.cpp +++ b/sycl/source/detail/graph_impl.cpp @@ -1281,6 +1281,8 @@ void exec_graph_impl::update( // Rebuild cached requirements for this graph with updated nodes MRequirements.clear(); for (auto &Node : MNodeStorage) { + if (!Node->MCommandGroup) + continue; MRequirements.insert(MRequirements.end(), Node->MCommandGroup->getRequirements().begin(), Node->MCommandGroup->getRequirements().end()); diff --git a/sycl/source/detail/graph_impl.hpp b/sycl/source/detail/graph_impl.hpp index a1057517c912..f9a7d1865834 100644 --- a/sycl/source/detail/graph_impl.hpp +++ b/sycl/source/detail/graph_impl.hpp @@ -181,6 +181,9 @@ class node_impl { /// @param IncomingReq Incoming requirement. /// @return True if a dependency is needed, false if not. bool hasRequirementDependency(sycl::detail::AccessorImplHost *IncomingReq) { + if (!MCommandGroup) + return false; + access_mode InMode = IncomingReq->MAccessMode; switch (InMode) { case access_mode::read: