From 636464ff5fb9fa48fa9aa531a704404fde27ab93 Mon Sep 17 00:00:00 2001 From: Sourabh Betigeri Date: Mon, 21 Mar 2022 16:31:49 -0700 Subject: [PATCH] SWDEV-316991 - Returns hipErrorInvalidValue when a wrong node type is passed to hipGraphExecEventWaitNodeSetEvent and hipGraphExecEventRecordNodeSetEvent APIs Change-Id: Ic80b0b2b154e017b41af617f5049e037a1b66183 [ROCm/clr commit: f73ff54fda1857ec1ce465e9f572c89eaa678f88] --- projects/clr/hipamd/src/hip_graph.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/projects/clr/hipamd/src/hip_graph.cpp b/projects/clr/hipamd/src/hip_graph.cpp index 1a8181a9e2..b4723282f3 100644 --- a/projects/clr/hipamd/src/hip_graph.cpp +++ b/projects/clr/hipamd/src/hip_graph.cpp @@ -1638,7 +1638,8 @@ hipError_t hipGraphEventRecordNodeSetEvent(hipGraphNode_t node, hipEvent_t event hipError_t hipGraphExecEventRecordNodeSetEvent(hipGraphExec_t hGraphExec, hipGraphNode_t hNode, hipEvent_t event) { HIP_INIT_API(hipGraphExecEventRecordNodeSetEvent, hGraphExec, hNode, event); - if (hGraphExec == nullptr || hNode == nullptr || event == nullptr) { + if (hGraphExec == nullptr || hNode == nullptr || event == nullptr || + hNode->GetType() != hipGraphNodeTypeEventRecord) { HIP_RETURN(hipErrorInvalidValue); } hipGraphNode_t clonedNode = hGraphExec->GetClonedNode(hNode); @@ -1683,7 +1684,8 @@ hipError_t hipGraphEventWaitNodeSetEvent(hipGraphNode_t node, hipEvent_t event) hipError_t hipGraphExecEventWaitNodeSetEvent(hipGraphExec_t hGraphExec, hipGraphNode_t hNode, hipEvent_t event) { HIP_INIT_API(hipGraphExecEventWaitNodeSetEvent, hGraphExec, hNode, event); - if (hGraphExec == nullptr || hNode == nullptr || event == nullptr) { + if (hGraphExec == nullptr || hNode == nullptr || event == nullptr || + (hNode->GetType() != hipGraphNodeTypeWaitEvent)) { HIP_RETURN(hipErrorInvalidValue); } hipGraphNode_t clonedNode = hGraphExec->GetClonedNode(hNode);