[vdi] Fix calculation of MaxWaves

- Consider the case where `usedVGPRs` is zero.
- This fixes [SWDEV-228537](http://ontrack-internal.amd.com/browse/SWDEV-228537)

Change-Id: I8675311f5fe24fb59c5d45bada122afefb55b128


[ROCm/clr commit: 55d869df99]
This commit is contained in:
Michael LIAO
2020-03-30 09:10:16 -04:00
parent eba4688437
commit 9c361faab3
+5 -6
View File
@@ -700,17 +700,16 @@ hipError_t ihipOccupancyMaxActiveBlocksPerMultiprocessor(int* numBlocks, int* nu
} }
// Find threads accupancy per CU => simd_per_cu * GPR usage // Find threads accupancy per CU => simd_per_cu * GPR usage
constexpr size_t MaxWavesPerSimd = 8; // Limited by SPI 32 per CU, hence 8 per SIMD constexpr size_t MaxWavesPerSimd = 8; // Limited by SPI 32 per CU, hence 8 per SIMD
size_t VgprWaves = wrkGrpInfo->availableVGPRs_ / amd::alignUp(wrkGrpInfo->usedVGPRs_, 4); size_t VgprWaves = MaxWavesPerSimd;
if (wrkGrpInfo->usedVGPRs_ > 0) {
size_t GprWaves; VgprWaves = wrkGrpInfo->availableVGPRs_ / amd::alignUp(wrkGrpInfo->usedVGPRs_, 4);
}
size_t GprWaves = VgprWaves;
if (wrkGrpInfo->usedSGPRs_ > 0) { if (wrkGrpInfo->usedSGPRs_ > 0) {
const size_t maxSGPRs = (device->info().gfxipVersion_ < 800) ? 512 : 800; const size_t maxSGPRs = (device->info().gfxipVersion_ < 800) ? 512 : 800;
size_t SgprWaves = maxSGPRs / amd::alignUp(wrkGrpInfo->usedSGPRs_, 16); size_t SgprWaves = maxSGPRs / amd::alignUp(wrkGrpInfo->usedSGPRs_, 16);
GprWaves = std::min(VgprWaves, SgprWaves); GprWaves = std::min(VgprWaves, SgprWaves);
} }
else {
GprWaves = VgprWaves;
}
size_t alu_accupancy = device->info().simdPerCU_ * std::min(MaxWavesPerSimd, GprWaves); size_t alu_accupancy = device->info().simdPerCU_ * std::min(MaxWavesPerSimd, GprWaves);
alu_accupancy *= wrkGrpInfo->wavefrontSize_; alu_accupancy *= wrkGrpInfo->wavefrontSize_;