From 5837d83e46409b211c93c2571d0dfdafbafd478b Mon Sep 17 00:00:00 2001 From: Ioannis Assiouras Date: Mon, 6 Mar 2023 13:58:04 +0000 Subject: [PATCH] SWDEV-373630 - Added checks for invalid flags in hipOccupancy query functions Change-Id: Ice1df4d3722354f40c8b02ba35ed122f9b2e2f2d --- hipamd/src/hip_platform.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hipamd/src/hip_platform.cpp b/hipamd/src/hip_platform.cpp index 10b8d3f894..1624e080b0 100644 --- a/hipamd/src/hip_platform.cpp +++ b/hipamd/src/hip_platform.cpp @@ -443,6 +443,9 @@ hipError_t hipModuleOccupancyMaxPotentialBlockSizeWithFlags(int* gridSize, int* if ((gridSize == nullptr) || (blockSize == nullptr)) { HIP_RETURN(hipErrorInvalidValue); } + if (flags != hipOccupancyDefault && flags != hipOccupancyDisableCachingOverride) { + HIP_RETURN(hipErrorInvalidValue); + } const amd::Device& device = *hip::getCurrentDevice()->devices()[0]; int max_blocks_per_grid = 0; int num_blocks = 0; @@ -484,6 +487,9 @@ hipError_t hipModuleOccupancyMaxActiveBlocksPerMultiprocessorWithFlags( if (numBlocks == nullptr) { HIP_RETURN(hipErrorInvalidValue); } + if (flags != hipOccupancyDefault && flags != hipOccupancyDisableCachingOverride) { + HIP_RETURN(hipErrorInvalidValue); + } const amd::Device& device = *hip::getCurrentDevice()->devices()[0]; int num_blocks = 0;