[PATCH] D29741: [AMDGPU] Calculate number of min/max SGPRs/VGPRs for WavesPerEU instead of using switch statement

Konstantin Zhuravlyov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 8 22:46:41 PST 2017


kzhuravl added inline comments.


================
Comment at: lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp:211-233
 unsigned getMinNumSGPRs(const FeatureBitset &Features, unsigned WavesPerEU) {
   IsaVersion Version = getIsaVersion(Features);
   if (Version.Major >= 8) {
     switch (WavesPerEU) {
       case 0:  return 0;
       case 10: return 0;
       case 9:  return 0;
----------------
tony-tye wrote:
> Should this also have a calculation that takes into account if a trap handler is present?
I do not think so. `getMinNumSGPRs` is used to bump up granulated sgpr count in pgm rsrc1 register to match maximum number of requested waves per execution unit.


================
Comment at: lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp:243
+    AddressableNumSGPRs = 112;
+  return std::min(MaxNumSGPRs, AddressableNumSGPRs);
 }
----------------
tony-tye wrote:
> Shouldn't this take into account the presence of a trap handler?
> 
>   return std::min(MaxNumSGPRs - (TRAP_ENABLED ? TRAP_NUM_SGPRS : 0),
>                   AddressableNumSGPRs);
It should. But it depends on trap handler subtarget feature from D26010, which has not landed yet.


https://reviews.llvm.org/D29741





More information about the llvm-commits mailing list