[llvm] [AMDGPU] NFC: Add helper to query archVGPR (PR #102690)

Jeffrey Byrnes via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 12 10:22:57 PDT 2024


https://github.com/jrbyrnes updated https://github.com/llvm/llvm-project/pull/102690

>From 51d8ce47e287bbe991dfa3cadbb25dfe43cfb2b1 Mon Sep 17 00:00:00 2001
From: Jeffrey Byrnes <Jeffrey.Byrnes at amd.com>
Date: Fri, 9 Aug 2024 15:24:46 -0700
Subject: [PATCH 1/2] [AMDGPU] NFC: Add helper to query archVGPR

Change-Id: Ie7d10498c0b1bb2d00a54fa17fd978752a9f1d52
---
 llvm/lib/Target/AMDGPU/GCNRegPressure.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/llvm/lib/Target/AMDGPU/GCNRegPressure.h b/llvm/lib/Target/AMDGPU/GCNRegPressure.h
index 98f9b3bc6aadad..08102a3524a7a4 100644
--- a/llvm/lib/Target/AMDGPU/GCNRegPressure.h
+++ b/llvm/lib/Target/AMDGPU/GCNRegPressure.h
@@ -54,6 +54,8 @@ struct GCNRegPressure {
     }
     return std::max(Value[VGPR32], Value[AGPR32]);
   }
+  unsigned getArchVGPRNum() const { return Value[VGPR32];}
+
   unsigned getAGPRNum() const { return Value[AGPR32]; }
 
   unsigned getVGPRTuplesWeight() const { return std::max(Value[VGPR_TUPLE],

>From 8c932480a769914ffafc12a5aa4345e685af9051 Mon Sep 17 00:00:00 2001
From: Jeffrey Byrnes <Jeffrey.Byrnes at amd.com>
Date: Mon, 12 Aug 2024 10:12:12 -0700
Subject: [PATCH 2/2] Comments

Change-Id: I4d7cc3128724afa4bb6c19468d1b04f9a7b2e886
---
 llvm/lib/Target/AMDGPU/GCNRegPressure.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/Target/AMDGPU/GCNRegPressure.h b/llvm/lib/Target/AMDGPU/GCNRegPressure.h
index 08102a3524a7a4..54dc1972d27619 100644
--- a/llvm/lib/Target/AMDGPU/GCNRegPressure.h
+++ b/llvm/lib/Target/AMDGPU/GCNRegPressure.h
@@ -46,7 +46,10 @@ struct GCNRegPressure {
 
   void clear() { std::fill(&Value[0], &Value[TOTAL_KINDS], 0); }
 
+  /// \returns the SGPR32 pressure
   unsigned getSGPRNum() const { return Value[SGPR32]; }
+  /// \returns the aggregated ArchVGPR32, AccVGPR32 pressure dependent upon \p
+  /// UnifiedVGPRFile
   unsigned getVGPRNum(bool UnifiedVGPRFile) const {
     if (UnifiedVGPRFile) {
       return Value[AGPR32] ? alignTo(Value[VGPR32], 4) + Value[AGPR32]
@@ -54,8 +57,9 @@ struct GCNRegPressure {
     }
     return std::max(Value[VGPR32], Value[AGPR32]);
   }
-  unsigned getArchVGPRNum() const { return Value[VGPR32];}
-
+  /// \returns the ArchVGPR32 pressure
+  unsigned getArchVGPRNum() const { return Value[VGPR32]; }
+  /// \returns the AccVGPR32 pressure
   unsigned getAGPRNum() const { return Value[AGPR32]; }
 
   unsigned getVGPRTuplesWeight() const { return std::max(Value[VGPR_TUPLE],



More information about the llvm-commits mailing list