From 44c74209eda9f8da26cfd6af37f7018101a84f85 Mon Sep 17 00:00:00 2001 From: sdashmiz Date: Fri, 12 Aug 2022 11:56:27 -0400 Subject: [PATCH] SWDEV-351274 - add proper checks for set attribute Signed-off-by: sdashmiz Change-Id: I9243e6180f3040341396b7159622f2b96e143ac2 [ROCm/clr commit: 39fc6605ec1ed38ef98b82dde66a9ac17074e333] --- projects/clr/hipamd/src/hip_graph_internal.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/projects/clr/hipamd/src/hip_graph_internal.hpp b/projects/clr/hipamd/src/hip_graph_internal.hpp index 80f976aff8..2437ec5333 100644 --- a/projects/clr/hipamd/src/hip_graph_internal.hpp +++ b/projects/clr/hipamd/src/hip_graph_internal.hpp @@ -771,6 +771,15 @@ class hipGraphKernelNode : public hipGraphNode { hipError_t SetAttrParams(hipKernelNodeAttrID attr, const hipKernelNodeAttrValue* params) { // updates kernel attr params if (attr == hipKernelNodeAttributeAccessPolicyWindow) { + if (params->accessPolicyWindow.hitRatio > 1) { + return hipErrorInvalidValue; + } + if (params->accessPolicyWindow.missProp == hipAccessPropertyPersisting) { + return hipErrorInvalidValue; + } + if (params->accessPolicyWindow.num_bytes > 0 && params->accessPolicyWindow.hitRatio == 0) { + return hipErrorInvalidValue; + } kernelAttr_.accessPolicyWindow.base_ptr = params->accessPolicyWindow.base_ptr; kernelAttr_.accessPolicyWindow.hitProp = params->accessPolicyWindow.hitProp; kernelAttr_.accessPolicyWindow.hitRatio = params->accessPolicyWindow.hitRatio;