[PATCH] D67771: [AMDGPU] fixed underflow in getOccupancyWithNumVGPRs

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 19 13:10:55 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL372350: [AMDGPU] fixed underflow in getOccupancyWithNumVGPRs (authored by rampitec, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D67771?vs=220893&id=220903#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67771/new/

https://reviews.llvm.org/D67771

Files:
  llvm/trunk/lib/Target/AMDGPU/AMDGPUSubtarget.cpp


Index: llvm/trunk/lib/Target/AMDGPU/AMDGPUSubtarget.cpp
===================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPUSubtarget.cpp
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPUSubtarget.cpp
@@ -599,7 +599,7 @@
   if (VGPRs < Granule)
     return MaxWaves;
   unsigned RoundedRegs = ((VGPRs + Granule - 1) / Granule) * Granule;
-  return std::min(getTotalNumVGPRs() / RoundedRegs, MaxWaves);
+  return std::min(std::max(getTotalNumVGPRs() / RoundedRegs, 1u), MaxWaves);
 }
 
 unsigned GCNSubtarget::getReservedNumSGPRs(const MachineFunction &MF) const {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67771.220903.patch
Type: text/x-patch
Size: 593 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190919/9a555595/attachment.bin>


More information about the llvm-commits mailing list