diff --git a/hipamd/src/hip_graph.cpp b/hipamd/src/hip_graph.cpp index 132b7d8817..8367d54e1e 100644 --- a/hipamd/src/hip_graph.cpp +++ b/hipamd/src/hip_graph.cpp @@ -1279,13 +1279,23 @@ hipError_t hipGraphExecChildGraphNodeSetParams(hipGraphExec_t hGraphExec, hipGra HIP_RETURN(hipErrorUnknown); } - hipGraphNode_t hipErrorNode_out; - hipGraphExecUpdateResult updateResult_out; - // Check if this instantiated graph is updatable. All restrictions in hipGraphExecUpdate() apply. - hipError_t status = - hipGraphExecUpdate(hGraphExec, childGraph, &hipErrorNode_out, &updateResult_out); - if (status != hipSuccess) { - HIP_RETURN(status); +// Validate whether the topology of node and childGraph matches + std::vector childGraphNodes1; + node->LevelOrder(childGraphNodes1); + + std::vector childGraphNodes2; + childGraph->LevelOrder(childGraphNodes2); + + if (childGraphNodes1.size() != childGraphNodes2.size()) { + HIP_RETURN(hipErrorUnknown); + } + // Validate if the node insertion order matches + else { + for (std::vector::size_type i = 0; i != childGraphNodes1.size(); i++) { + if (childGraphNodes1[i]->GetType() != childGraphNodes2[i]->GetType()) { + HIP_RETURN(hipErrorUnknown); + } + } } hipGraphNode_t clonedNode = hGraphExec->GetClonedNode(node);