[flang-commits] [clang-tools-extra] [lldb] [libc] [libcxx] [clang] [compiler-rt] [lld] [flang] [llvm] [AMDGPU] Use alias info to relax waitcounts for LDS DMA (PR #74537)

Stanislav Mekhanoshin via flang-commits flang-commits at lists.llvm.org
Wed Jan 17 09:40:51 PST 2024


================
@@ -707,7 +723,40 @@ void WaitcntBrackets::updateByEvent(const SIInstrInfo *TII,
         (TII->isDS(Inst) || TII->mayWriteLDSThroughDMA(Inst))) {
       // MUBUF and FLAT LDS DMA operations need a wait on vmcnt before LDS
       // written can be accessed. A load from LDS to VMEM does not need a wait.
-      setRegScore(SQ_MAX_PGM_VGPRS + EXTRA_VGPR_LDS, T, CurrScore);
+      unsigned Slot = 0;
+      for (const auto *MemOp : Inst.memoperands()) {
+        if (!MemOp->isStore() ||
+            MemOp->getAddrSpace() != AMDGPUAS::LOCAL_ADDRESS)
+          continue;
+        // Comparing just AA info does not guarantee memoperands are equal
+        // in general, but this is so for LDS DMA in practice.
+        auto AAI = MemOp->getAAInfo();
+        // Alias scope information gives a way to definitely identify an
+        // original memory object and practically produced in the module LDS
+        // lowering pass. If there is no scope available we will not be able
+        // to disambiguate LDS aliasing as after the module lowering all LDS
+        // is squashed into a single big object. Do not attemt to use one of
----------------
rampitec wrote:

Done

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


More information about the flang-commits mailing list