]> granicus.if.org Git - llvm/commitdiff
[AMDGPU] Distinguish between S/VGPR allocation and encoding granularities
authorKonstantin Zhuravlyov <kzhuravl_dev@outlook.com>
Wed, 8 Feb 2017 13:18:40 +0000 (13:18 +0000)
committerKonstantin Zhuravlyov <kzhuravl_dev@outlook.com>
Wed, 8 Feb 2017 13:18:40 +0000 (13:18 +0000)
Differential Revision: https://reviews.llvm.org/D29633

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294441 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
lib/Target/AMDGPU/AMDGPUSubtarget.h

index 331f915b7ec4f63d432d755090ab5b9030500386..0f48dfdb0a0bc22f41c368306e40597d0b6e9126 100644 (file)
@@ -546,13 +546,13 @@ void AMDGPUAsmPrinter::getSIProgramInfo(SIProgramInfo &ProgInfo,
 
   // SGPRBlocks is actual number of SGPR blocks minus 1.
   ProgInfo.SGPRBlocks = alignTo(ProgInfo.NumSGPRsForWavesPerEU,
-                                STM.getSGPRAllocGranule());
-  ProgInfo.SGPRBlocks = ProgInfo.SGPRBlocks / STM.getSGPRAllocGranule() - 1;
+                                STM.getSGPREncodingGranule());
+  ProgInfo.SGPRBlocks = ProgInfo.SGPRBlocks / STM.getSGPREncodingGranule() - 1;
 
   // VGPRBlocks is actual number of VGPR blocks minus 1.
   ProgInfo.VGPRBlocks = alignTo(ProgInfo.NumVGPRsForWavesPerEU,
-                                STM.getVGPRAllocGranule());
-  ProgInfo.VGPRBlocks = ProgInfo.VGPRBlocks / STM.getVGPRAllocGranule() - 1;
+                                STM.getVGPREncodingGranule());
+  ProgInfo.VGPRBlocks = ProgInfo.VGPRBlocks / STM.getVGPREncodingGranule() - 1;
 
   // Record first reserved register and reserved register count fields, and
   // update max register counts if "amdgpu-debugger-reserve-regs" attribute was
index 9f825b9dd9de1ff75115b2142eb4df13e9eb54af..d776c985700252ab2d3c209bf0c6c6a994a778e4 100644 (file)
@@ -644,6 +644,13 @@ public:
 
   /// \returns SGPR allocation granularity supported by the subtarget.
   unsigned getSGPRAllocGranule() const {
+    if (getGeneration() >= AMDGPUSubtarget::VOLCANIC_ISLANDS)
+      return 16;
+    return 8;
+  }
+
+  /// \returns SGPR encoding granularity supported by the subtarget.
+  unsigned getSGPREncodingGranule() const {
     return 8;
   }
 
@@ -689,6 +696,11 @@ public:
     return 4;
   }
 
+  /// \returns VGPR encoding granularity supported by the subtarget.
+  unsigned getVGPREncodingGranule() const {
+    return getVGPRAllocGranule();
+  }
+
   /// \returns Total number of VGPRs supported by the subtarget.
   unsigned getTotalNumVGPRs() const {
     return 256;