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

Tony Tye via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 8 17:53:11 PST 2017


tony-tye 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;
----------------
Should this also have a calculation that takes into account if a trap handler is present?


================
Comment at: lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp:243
+    AddressableNumSGPRs = 112;
+  return std::min(MaxNumSGPRs, AddressableNumSGPRs);
 }
----------------
Shouldn't this take into account the presence of a trap handler?

  return std::min(MaxNumSGPRs - (TRAP_ENABLED ? TRAP_NUM_SGPRS : 0),
                  AddressableNumSGPRs);


================
Comment at: lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp:262-276
 unsigned getMinNumVGPRs(const FeatureBitset &Features, unsigned WavesPerEU) {
   switch (WavesPerEU) {
     case 0:  return 0;
     case 10: return 0;
     case 9:  return 25;
     case 8:  return 29;
     case 7:  return 33;
----------------
Since getMaxNumVGPRs() was updated to use a calculation should this one too?


https://reviews.llvm.org/D29741





More information about the llvm-commits mailing list