[llvm-branch-commits] [llvm] [AMDGPU] Take the VGPR and AVGPR maximum pressure from one point (PR #236175)

Valery Pykhtin via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Oct 28 04:13:56 PDT 2026


================
@@ -186,10 +186,23 @@ struct GCNRegPressure {
                          unsigned DynamicVGPRBlockSize);
 };
 
+/// \returns the maximum of \p P1 and \p P2 for each register file. The VGPR and
+/// AVGPR components are queried as one sum, so both come from the operand with
+/// the larger sum. The AGPR maximum stays separate also for a unified VGPR
+/// file: ArchVGPRs and AGPRs use separate ranges of it, so the unified pressure
+/// is the sum of both peaks even when they are at different points.
 inline GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2) {
   GCNRegPressure Res;
   for (unsigned I = 0; I < GCNRegPressure::ValueArraySize; ++I)
     Res.Value[I] = std::max(P1.Value[I], P2.Value[I]);
+  for (unsigned Base : {0u, unsigned(GCNRegPressure::TOTAL_KINDS)}) {
+    unsigned V = Base + GCNRegPressure::VGPR;
+    unsigned AV = Base + GCNRegPressure::AVGPR;
----------------
vpykhtin wrote:

why add Base?

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


More information about the llvm-branch-commits mailing list