[llvm] [AMDGPU] More accurately account for AVGPR pressure (PR #150711)

Lucas Ramirez via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 28 16:52:44 PDT 2025


================
@@ -61,44 +62,73 @@ struct GCNRegPressure {
   /// VGPR file.
   inline static unsigned getUnifiedVGPRNum(unsigned NumArchVGPRs,
                                            unsigned NumAGPRs,
-                                           unsigned NumAVGPRs) {
-
-    // Assume AVGPRs will be assigned as VGPRs.
-    return alignTo(NumArchVGPRs + NumAVGPRs,
+                                           unsigned NumAVGPRs,
+                                           unsigned AddressableArchVGPR) {
+
+    // Until we hit the VGPRThreshold, we will assign AV as VGPR. After that
+    // point, we will assign as AGPR.
+    unsigned AVGPRsAsVGPRs =
----------------
lucas-rami wrote:

Can you factor out the formulas for `AVGPRsAsVGPRs` and `AVGPRsAsAGPRs` to their own functions to avoid repetition across `getUnifiedVGPRNum`/`getAGPRNum`/`getVGPRTUplesWeight`?

https://github.com/llvm/llvm-project/pull/150711


More information about the llvm-commits mailing list