From c603d5004aac9d9d210b8b7d8545a3b10eceaf80 Mon Sep 17 00:00:00 2001 From: Ajay Date: Tue, 21 Feb 2023 01:33:14 +0000 Subject: [PATCH] SWDEV-384184 - hipGraphKernelNodeSetAttribute negative scenarios Hardcoding check for accessPolicyMaxWindowSize since its returned from Hardware thats not available yet Change-Id: I3a09fc9ace3027c7d5533bbbc7da5e18f43591ec --- hipamd/src/hip_graph_internal.hpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/hipamd/src/hip_graph_internal.hpp b/hipamd/src/hip_graph_internal.hpp index 0918f4fce8..e5c03eb2e9 100644 --- a/hipamd/src/hip_graph_internal.hpp +++ b/hipamd/src/hip_graph_internal.hpp @@ -986,17 +986,27 @@ class hipGraphKernelNode : public hipGraphNode { } hipError_t SetAttrParams(hipKernelNodeAttrID attr, const hipKernelNodeAttrValue* params) { + constexpr int accessPolicyMaxWindowSize = 1024; // updates kernel attr params if (attr == hipKernelNodeAttributeAccessPolicyWindow) { - if (params->accessPolicyWindow.hitRatio > 1) { + if (params->accessPolicyWindow.hitRatio > 1 || + params->accessPolicyWindow.hitRatio < 0) { return hipErrorInvalidValue; } + if (params->accessPolicyWindow.missProp == hipAccessPropertyPersisting) { return hipErrorInvalidValue; } if (params->accessPolicyWindow.num_bytes > 0 && params->accessPolicyWindow.hitRatio == 0) { return hipErrorInvalidValue; } + + // need to check against accessPolicyMaxWindowSize from device + // accessPolicyMaxWindowSize not implemented on the device side yet + if (params->accessPolicyWindow.num_bytes >= accessPolicyMaxWindowSize) { + return hipErrorInvalidValue; + } + kernelAttr_.accessPolicyWindow.base_ptr = params->accessPolicyWindow.base_ptr; kernelAttr_.accessPolicyWindow.hitProp = params->accessPolicyWindow.hitProp; kernelAttr_.accessPolicyWindow.hitRatio = params->accessPolicyWindow.hitRatio;