[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:15:59 PST 2025


================
@@ -97,7 +97,32 @@ auto inst_counter_types(InstCounterType MaxCounter = NUM_INST_CNTS) {
   return enum_seq(LOAD_CNT, MaxCounter);
 }
 
-using RegInterval = std::pair<int, int>;
+/// Integer IDs used to track vector memory locations we may have to wait on.
+/// Encoded as u16 chunks:
+///
+///   [0,            MAX_REGUNITS ): MCRegUnit
+///   [FIRST_LDSDMA, LAST_LDSDMA  ): LDS DMA IDs
+using VMEMID = uint32_t;
+
+enum : VMEMID {
+  TRACKINGID_RANGE_LEN = (1 << 16),
+
+  REGUNITS_BEGIN = 0,
+  REGUNITS_END = REGUNITS_BEGIN + TRACKINGID_RANGE_LEN,
+
+  // Note for LDSDMA: LDSDMA_BEGIN corresponds to the "common"
+  // entry, which is updated for all LDS DMA operations encountered.
+  // Specific LDS DMA IDs start at LDSDMA_BEGIN + 1.
+  LDSDMA_BEGIN = REGUNITS_END,
+  LDSDMA_END = LDSDMA_BEGIN + TRACKINGID_RANGE_LEN,
+
+  NUM_LDSDMA = TRACKINGID_RANGE_LEN
----------------
Pierre-vh wrote:

Yes, it's a u32 and each "slice" is u16 so we can store 65535 slices and we only use 2.
It's a bit overkill, we can always re-partition the VMEMID if we ever have an issue with it. It's an implementation detail

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


More information about the llvm-commits mailing list