[llvm] [AMDGPU][SIInsertWaitCnts] Use RegUnits-based tracking (PR #162077)

Pierre van Houtryve via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 28 02:14:26 PST 2025


================
@@ -771,26 +792,43 @@ class WaitcntBrackets {
   unsigned LastFlat[NUM_INST_CNTS] = {0};
   // Remember the last GDS operation.
   unsigned LastGDS = 0;
-  // wait_cnt scores for every vgpr.
-  // Keep track of the VgprUB and SgprUB to make merge at join efficient.
-  int VgprUB = -1;
-  int SgprUB = -1;
-  unsigned VgprScores[NUM_INST_CNTS][NUM_ALL_VGPRS] = {{0}};
-  // Wait cnt scores for every sgpr, the DS_CNT (corresponding to LGKMcnt
-  // pre-gfx12) or KM_CNT (gfx12+ only), and X_CNT (gfx1250) are relevant.
-  // Row 0 represents the score for either DS_CNT or KM_CNT and row 1 keeps the
-  // X_CNT score.
-  unsigned SgprScores[2][SQ_MAX_PGM_SGPRS] = {{0}};
+
+  // The score tracking logic is fragmented as follows:
+  // - VMem: VGPR RegUnits and LDS DMA IDs, see the VMEMID encoding.
+  // - SGPRs: SGPR RegUnits
+  // - SCC
----------------
Pierre-vh wrote:

IIRC, SCC is not a SGPR. At least it's not part of the SGPR reg classes.

This patch aims to be NFCI, so I didn't try hard to fix things like these because I didn't want to bloat the patch too much. I want to come back to the pass and take another look once this lands so I added a TODO.

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


More information about the llvm-commits mailing list