[llvm] [AMDGPU][GFX1250] Insert S_WAIT_XCNT for SMEM and VMEM load-stores (PR #145566)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 25 04:54:12 PDT 2025
================
@@ -1207,11 +1248,29 @@ void WaitcntBrackets::applyWaitcnt(InstCounterType T, unsigned Count) {
}
}
+void WaitcntBrackets::applyXcnt(const AMDGPU::Waitcnt &Wait) {
+ // Wait on XCNT is redundant if we are already waiting for a load to complete.
+ // SMEM can return out of order, so only omit XCNT wait if we are waiting till
+ // zero.
+ if (Wait.KmCnt == 0 && hasPendingEvent(SMEM_GROUP))
+ return applyWaitcnt(X_CNT, 0);
----------------
jayfoad wrote:
I don't understand the logic here. What if there is also an pending VMEM? Then it is not safe to assume that waiting for SMEM to complete will also imply a wait for XCNT. See #145681 for examples that I think are miscompiled because of this.
Maybe you intended that there would never be pending SMEM_GROUP and VMEM_GROUP at the same time?
https://github.com/llvm/llvm-project/pull/145566
More information about the llvm-commits
mailing list