[PATCH] D20556: AMDGPU: Skip waiting on lgkmcnt for global flat loads

Tony Tye via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 18 09:39:43 PST 2020


t-tye added inline comments.


================
Comment at: lib/Target/AMDGPU/SIInsertWaits.cpp:221-225
+    } else if (TII->isFLAT(MI)) {
+      // If we know the pointer is not accessing a flat address, we don't need
+      // to wait for lgkm.
+      if (!hasGlobalMemOperand(MI))
+        Result.Named.LGKM = 1;
----------------
arsenm wrote:
> tstellarAMD wrote:
> > I'm not really sure exactly what this is doing, but as long as this accounts for the fact that the hw LGKM counter is always incremented even if the operation  accesses global memory than this is fine.
> > 
> > Though, I think you should add some tests that have lds operations before and after  a flat instruction that accesses global memory.
> I don't think this is accounting for the hardware increase
But does the hardware increasing the LGKM counter matter? The hardware will increase it, then decrease it once it determines the FLT address is targeting LDS. So all that that can effect is another memory operation waiting for LGKM, causing them to wait a bit longer. It cannot make any other memory operation satisfy their WAITCNT early so cannot break correctness.

The completion of a FLAT operation that is known to only target VMEM only needs to wait on the vmem counter.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D20556/new/

https://reviews.llvm.org/D20556





More information about the llvm-commits mailing list