From e333f99dec32f4975442bef41a7b4904c5ff214a Mon Sep 17 00:00:00 2001 From: Anusha GodavarthySurya Date: Mon, 2 Jan 2023 12:26:12 +0000 Subject: [PATCH] SWDEV-373173 - Handle kernel compilation WGP/cumode in occupancy calculation Change-Id: Id0225683a578c3275a35f8f807a57b6379746392 [ROCm/clr commit: ce8f441c1483f0f3077b8e9f54c0560ec5a859c5] --- projects/clr/hipamd/src/hip_platform.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/projects/clr/hipamd/src/hip_platform.cpp b/projects/clr/hipamd/src/hip_platform.cpp index cfa3370d1e..aebd7f9990 100644 --- a/projects/clr/hipamd/src/hip_platform.cpp +++ b/projects/clr/hipamd/src/hip_platform.cpp @@ -352,8 +352,9 @@ hipError_t ihipOccupancyMaxActiveBlocksPerMultiprocessor( const size_t SgprWaves = maxSGPRs / amd::alignUp(wrkGrpInfo->usedSGPRs_, 16); GprWaves = std::min(VgprWaves, SgprWaves); } - - const size_t alu_occupancy = device.info().simdPerCU_ * std::min(MaxWavesPerSimd, GprWaves); + uint32_t simdPerCU = (device.isa().versionMajor() <= 9) ? device.info().simdPerCU_ + : (wrkGrpInfo->isWGPMode_ ? 4 : 2); + const size_t alu_occupancy = simdPerCU * std::min(MaxWavesPerSimd, GprWaves); const int alu_limited_threads = alu_occupancy * wrkGrpInfo->wavefrontSize_; int lds_occupancy_wgs = INT_MAX;