From 671fe75c2684ab84b92969cdc26f6d355aa5663f Mon Sep 17 00:00:00 2001 From: anusha GodavarthySurya Date: Fri, 19 Nov 2021 08:45:45 -0800 Subject: [PATCH] SWDEV-240806 - Added Implementation for hipGraphInstantiateWithFlags and hipGraphExecMemsetNodeSetParams Change-Id: I71683abb25234bf4e73be52a717d792c32e9aaa6 --- hipamd/src/amdhip.def | 2 ++ hipamd/src/hip_graph.cpp | 28 +++++++++++++++++++++++++--- hipamd/src/hip_hcc.def.in | 2 ++ hipamd/src/hip_hcc.map.in | 2 ++ 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/hipamd/src/amdhip.def b/hipamd/src/amdhip.def index b2fcb01274..4f58c0562e 100644 --- a/hipamd/src/amdhip.def +++ b/hipamd/src/amdhip.def @@ -345,3 +345,5 @@ hipGraphHostNodeGetParams hipGraphHostNodeSetParams hipGraphExecHostNodeSetParams hipGraphExecUpdate +hipGraphInstantiateWithFlags +hipGraphExecMemsetNodeSetParams diff --git a/hipamd/src/hip_graph.cpp b/hipamd/src/hip_graph.cpp index 760773a1ce..e861951ced 100644 --- a/hipamd/src/hip_graph.cpp +++ b/hipamd/src/hip_graph.cpp @@ -848,8 +848,7 @@ hipError_t hipGraphAddChildGraphNode(hipGraphNode_t* pGraphNode, hipGraph_t grap HIP_RETURN(hipSuccess); } -hipError_t ihipGraphInstantiate(hipGraphExec_t* pGraphExec, hipGraph_t graph, - hipGraphNode_t* pErrorNode, char* pLogBuffer, size_t bufferSize) { +hipError_t ihipGraphInstantiate(hipGraphExec_t* pGraphExec, hipGraph_t graph) { std::unordered_map clonedNodes; hipGraph_t clonedGraph = graph->clone(clonedNodes); std::vector> parallelLists; @@ -868,7 +867,17 @@ hipError_t ihipGraphInstantiate(hipGraphExec_t* pGraphExec, hipGraph_t graph, hipError_t hipGraphInstantiate(hipGraphExec_t* pGraphExec, hipGraph_t graph, hipGraphNode_t* pErrorNode, char* pLogBuffer, size_t bufferSize) { HIP_INIT_API(hipGraphInstantiate, pGraphExec, graph); - HIP_RETURN_DURATION(ihipGraphInstantiate(pGraphExec, graph, pErrorNode, pLogBuffer, bufferSize)); + HIP_RETURN_DURATION(ihipGraphInstantiate(pGraphExec, graph)); +} + +hipError_t hipGraphInstantiateWithFlags(hipGraphExec_t* pGraphExec, hipGraph_t graph, + unsigned long long flags) { + HIP_INIT_API(hipGraphInstantiateWithFlags, pGraphExec, graph, flags); + // enable when change is merged to hip + // if (flags == hipGraphInstantiateFlagAutoFreeOnLaunch) { + // Free any unfreed memory allocations before the graph is relaunched + //} + HIP_RETURN_DURATION(ihipGraphInstantiate(pGraphExec, graph)); } hipError_t hipGraphExecDestroy(hipGraphExec_t pGraphExec) { @@ -1009,6 +1018,19 @@ hipError_t hipGraphMemsetNodeSetParams(hipGraphNode_t node, const hipMemsetParam HIP_RETURN(reinterpret_cast(node)->SetParams(pNodeParams)); } +hipError_t hipGraphExecMemsetNodeSetParams(hipGraphExec_t hGraphExec, hipGraphNode_t node, + const hipMemsetParams* pNodeParams) { + HIP_INIT_API(hipGraphExecMemsetNodeSetParams, hGraphExec, node, pNodeParams); + if (hGraphExec == nullptr || node == nullptr || pNodeParams == nullptr) { + HIP_RETURN(hipErrorInvalidValue); + } + hipGraphNode_t clonedNode = hGraphExec->GetClonedNode(node); + if (clonedNode == nullptr) { + HIP_RETURN(hipErrorInvalidValue); + } + HIP_RETURN(reinterpret_cast(clonedNode)->SetParams(pNodeParams)); +} + hipError_t hipGraphAddDependencies(hipGraph_t graph, const hipGraphNode_t* from, const hipGraphNode_t* to, size_t numDependencies) { HIP_INIT_API(hipGraphAddDependencies, graph, from, to, numDependencies); diff --git a/hipamd/src/hip_hcc.def.in b/hipamd/src/hip_hcc.def.in index 7cf574c407..bb0c794215 100644 --- a/hipamd/src/hip_hcc.def.in +++ b/hipamd/src/hip_hcc.def.in @@ -343,3 +343,5 @@ hipGraphHostNodeGetParams hipGraphHostNodeSetParams hipGraphExecHostNodeSetParams hipGraphExecUpdate +hipGraphInstantiateWithFlags +hipGraphExecMemsetNodeSetParams diff --git a/hipamd/src/hip_hcc.map.in b/hipamd/src/hip_hcc.map.in index fd37af7036..fe3393dd96 100644 --- a/hipamd/src/hip_hcc.map.in +++ b/hipamd/src/hip_hcc.map.in @@ -375,6 +375,8 @@ global: hipGraphHostNodeSetParams; hipGraphExecHostNodeSetParams; hipGraphExecUpdate; + hipGraphInstantiateWithFlags; + hipGraphExecMemsetNodeSetParams; local: *; } hip_4.4;