From 2c9c07aaa848c9296fe8f26fc67830e624abdd76 Mon Sep 17 00:00:00 2001 From: Sourabh Betigeri Date: Thu, 26 May 2022 17:52:24 -0700 Subject: [PATCH] SWDEV-331301 - Fixes to return error if the childGraph topologies of instantiated childGraphNode and to-be updated childGraphNode do not match Change-Id: I372317a4df13e5cd352f46525d820246fe4ca8f2 [ROCm/clr commit: c3db564e94efcb5d57d170df2b78925320f08905] --- projects/clr/hipamd/src/hip_graph.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/projects/clr/hipamd/src/hip_graph.cpp b/projects/clr/hipamd/src/hip_graph.cpp index 132b7d8817..8367d54e1e 100644 --- a/projects/clr/hipamd/src/hip_graph.cpp +++ b/projects/clr/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);