From fcfe2ec88be5eab1f18717f6c7cbb408e3f8118b Mon Sep 17 00:00:00 2001 From: Sourabh Betigeri Date: Tue, 2 Apr 2024 18:11:35 -0700 Subject: [PATCH] SWDEV-453577 - Fixes to account for right CU count based on WGP or CU mode Change-Id: Ib9739f9917bc6ff69cc76f444d909311922ebc1e --- hipamd/src/hip_platform.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hipamd/src/hip_platform.cpp b/hipamd/src/hip_platform.cpp index ef64c0882b..fcad87b020 100644 --- a/hipamd/src/hip_platform.cpp +++ b/hipamd/src/hip_platform.cpp @@ -420,8 +420,14 @@ hipError_t ihipOccupancyMaxActiveBlocksPerMultiprocessor( // If the best block size is smaller than the block size used to fit the maximum, // then we need to make the grid bigger for full occupancy. const int bestBlocksPerCU = alu_limited_threads / (*bestBlockSize); + uint32_t maxCUs = device.info().maxComputeUnits_; + if (wrkGrpInfo->isWGPMode_ == false && device.settings().enableWgpMode_ == true) { + maxCUs *= 2; + } else if ((wrkGrpInfo->isWGPMode_ == true && device.settings().enableWgpMode_ == false)) { + maxCUs /= 2; + } // Unless those blocks are further constrained by LDS size. - *numBlocksPerGrid = device.info().maxComputeUnits_ * std::min(bestBlocksPerCU, lds_occupancy_wgs); + *numBlocksPerGrid = (maxCUs * std::min(bestBlocksPerCU, lds_occupancy_wgs)); return hipSuccess; }