[clang] [llvm] [AMDGPU] Emit a waitcnt instruction after each memory instruction (PR #68932)

Jun Wang via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 22 10:24:24 PST 2023


================
@@ -1708,6 +1710,19 @@ bool SIInsertWaitcnts::insertWaitcntInBlock(MachineFunction &MF,
     }
 
     ++Iter;
+    if (ST->isPreciseMemoryEnabled() && Inst.mayLoadOrStore()) {
+      auto Builder =
+          BuildMI(Block, Iter, DebugLoc(), TII->get(AMDGPU::S_WAITCNT))
+              .addImm(0);
+      if (IsGFX10Plus) {
----------------
jwanggit86 wrote:

S_waitcnt(0) is inserted after each mem op, both stores and loads.

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


More information about the llvm-commits mailing list