SWDEV-453577 - Fixes to account for right CU count based on WGP or CU mode

Change-Id: Ib9739f9917bc6ff69cc76f444d909311922ebc1e
This commit is contained in:
Sourabh Betigeri
2024-04-02 18:11:35 -07:00
کامیت شده توسط Sourabh Betigeri
والد 00ddc3e284
کامیت fcfe2ec88b
+7 -1
مشاهده پرونده
@@ -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;
}