From 4258d1680c7dad735f48180fab062b8e96100188 Mon Sep 17 00:00:00 2001 From: Ajay Date: Thu, 3 Feb 2022 18:27:42 +0000 Subject: [PATCH] SWDEV-314665 - hipGraphInstantiateWithFlags negative scenarios Change-Id: Ic44333332a98a525a07c9911bda1c2e930eb9e3c [ROCm/clr commit: ab8c30cf78bd76975b64a3acbbd2ee6669941fff] --- projects/clr/hipamd/src/hip_graph.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/projects/clr/hipamd/src/hip_graph.cpp b/projects/clr/hipamd/src/hip_graph.cpp index 354b6e1bf6..1b254f3029 100644 --- a/projects/clr/hipamd/src/hip_graph.cpp +++ b/projects/clr/hipamd/src/hip_graph.cpp @@ -934,6 +934,15 @@ hipError_t hipGraphInstantiate(hipGraphExec_t* pGraphExec, hipGraph_t graph, hipError_t hipGraphInstantiateWithFlags(hipGraphExec_t* pGraphExec, hipGraph_t graph, unsigned long long flags) { HIP_INIT_API(hipGraphInstantiateWithFlags, pGraphExec, graph, flags); + if (pGraphExec == nullptr || graph == nullptr) { + HIP_RETURN(hipErrorInvalidValue); + } + + //invalid flag check + if (flags != hipGraphInstantiateFlagAutoFreeOnLaunch){ + HIP_RETURN(hipErrorInvalidValue); + } + // enable when change is merged to hip // if (flags == hipGraphInstantiateFlagAutoFreeOnLaunch) { // Free any unfreed memory allocations before the graph is relaunched