Skip to content

Commit

Permalink
[SYCL][Graph] Fix minor issues in graph update code (#13660)
Browse files Browse the repository at this point in the history
- Check for empty cmd group when updating node reqs
- Fix nullptr deref in reqs check
  • Loading branch information
Bensuo authored May 7, 2024
1 parent c6be822 commit 64cb0cf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sycl/source/detail/graph_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
3 changes: 3 additions & 0 deletions sycl/source/detail/graph_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 64cb0cf

Please sign in to comment.