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
Tento commit je obsažen v:
sdashmiz
2023-03-16 16:44:54 -04:00
odevzdal Maneesh Gupta
rodič f6c36be185
revize 8c62a616a2
+10
Zobrazit soubor
@@ -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);
}