SWDEV-367877 - Detect cycle in graph
- detect cycle when graph is instantiated - remove level calculation from add/remove node Signed-off-by: sdashmiz <shadi.dashmiz@amd.com> Change-Id: I3f7432f91f70aec8e4fd866b2766256f8a9a0cfe graph-cycle-corrections Signed-off-by: sdashmiz <shadi.dashmiz@amd.com> Change-Id: I8a3cec9a5a503aac6ea1e85ff3dd2b972790fb1d
Esse commit está contido em:
@@ -1242,11 +1242,13 @@ hipError_t ihipGraphInstantiate(hipGraphExec_t* pGraphExec, hipGraph_t graph,
|
||||
std::unordered_map<Node, std::vector<Node>> nodeWaitLists;
|
||||
std::unordered_set<hipUserObject*> graphExeUserObj;
|
||||
clonedGraph->GetRunList(parallelLists, nodeWaitLists);
|
||||
std::vector<Node> levelOrder;
|
||||
clonedGraph->LevelOrder(levelOrder);
|
||||
std::vector<hipGraphNode_t> graphNodes;
|
||||
if (false == clonedGraph->TopologicalOrder(graphNodes)) {
|
||||
return hipErrorInvalidValue;
|
||||
}
|
||||
clonedGraph->GetUserObjs(graphExeUserObj);
|
||||
*pGraphExec =
|
||||
new hipGraphExec(levelOrder, parallelLists, nodeWaitLists, clonedNodes,
|
||||
new hipGraphExec(graphNodes, parallelLists, nodeWaitLists, clonedNodes,
|
||||
graphExeUserObj, flags);
|
||||
if (*pGraphExec != nullptr) {
|
||||
graph->SetGraphInstantiated(true);
|
||||
@@ -1320,7 +1322,9 @@ hipError_t hipGraphGetNodes(hipGraph_t graph, hipGraphNode_t* nodes, size_t* num
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
std::vector<hipGraphNode_t> graphNodes;
|
||||
graph->LevelOrder(graphNodes);
|
||||
if (false == graph->TopologicalOrder(graphNodes)) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
if (nodes == nullptr) {
|
||||
*numNodes = graphNodes.size();
|
||||
HIP_RETURN(hipSuccess);
|
||||
@@ -1561,10 +1565,10 @@ hipError_t hipGraphExecChildGraphNodeSetParams(hipGraphExec_t hGraphExec, hipGra
|
||||
|
||||
// Validate whether the topology of node and childGraph matches
|
||||
std::vector<Node> childGraphNodes1;
|
||||
node->LevelOrder(childGraphNodes1);
|
||||
node->TopologicalOrder(childGraphNodes1);
|
||||
|
||||
std::vector<Node> childGraphNodes2;
|
||||
childGraph->LevelOrder(childGraphNodes2);
|
||||
childGraph->TopologicalOrder(childGraphNodes2);
|
||||
|
||||
if (childGraphNodes1.size() != childGraphNodes2.size()) {
|
||||
HIP_RETURN(hipErrorUnknown);
|
||||
@@ -2148,7 +2152,7 @@ hipError_t hipGraphExecUpdate(hipGraphExec_t hGraphExec, hipGraph_t hGraph,
|
||||
}
|
||||
|
||||
std::vector<Node> newGraphNodes;
|
||||
hGraph->LevelOrder(newGraphNodes);
|
||||
hGraph->TopologicalOrder(newGraphNodes);
|
||||
std::vector<Node>& oldGraphExecNodes = hGraphExec->GetNodes();
|
||||
if (newGraphNodes.size() != oldGraphExecNodes.size()) {
|
||||
*updateResult_out = hipGraphExecUpdateErrorTopologyChanged;
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário