SWDEV-388937 - fix removing a node

- before removing node from graph all edges should be removed and rest
  of graph updated

Signed-off-by: sdashmiz <shadi.dashmiz@amd.com>
Change-Id: Ide0afcc964f87f13cf407c971e22497433e3b1ed


[ROCm/clr commit: 8c62a616a2]
This commit is contained in:
sdashmiz
2023-03-16 16:44:54 -04:00
committed by Maneesh Gupta
parent ddf76371e6
commit a2e1a1b4aa
+10
View File
@@ -1829,6 +1829,16 @@ hipError_t hipGraphDestroyNode(hipGraphNode_t node) {
if (!hipGraphNode::isNodeValid(node)) {
HIP_RETURN(hipErrorInvalidValue);
}
// First remove all the edges both incoming and outgoing from node.
for(auto& edge : node->GetEdges()) {
node->RemoveUpdateEdge(edge);
}
const std::vector<Node>& dependencies = node->GetDependencies();
for(auto& parent: dependencies) {
parent->RemoveEdge(node);
parent->SetOutDegree(parent->GetOutDegree() - 1);
}
// Remove the node from graph.
node->GetParentGraph()->RemoveNode(node);
HIP_RETURN(hipSuccess);
}