[clang] [llvm] [AMDGPU][SIInsertWaitcnt] Implement Waitcnt Expansion for Profiling (PR #169345)

Pankaj Dwivedi via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 12 02:31:53 PST 2026


================
@@ -297,6 +302,34 @@ class WaitcntGenerator {
   // optimization.
   bool isOptNone() const { return OptNone; }
 
+  // Get the maximum wait count value for a given counter type.
+  // For pre-GFX12, LOAD_CNT uses vmcnt and DS_CNT uses lgkmcnt.
+  // For GFX12+, LOAD_CNT uses loadcnt and DS_CNT uses dscnt.
+  unsigned getWaitCountMax(InstCounterType T) const {
----------------
PankajDwivedi-25 wrote:

Right, `WaitcntGenerator` does not have a pointer back to `SIInsertWaitcnts`, so it couldn't call Context->getWaitCountMax().

I have made it a free function that both can use.

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


More information about the cfe-commits mailing list