[PATCH] D89618: [AMDGPU] Optimize waitcnt insertion for flat memory operations

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 19 11:55:18 PDT 2020


rampitec added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp:1202
+bool SIInsertWaitcnts::mayAccessVMEMThroughFlat(const MachineInstr &MI) const {
+  if (MI.memoperands_empty())
+    return true;
----------------
Could you add assert (TII->isFLAT(MI)) at the top of the function?


================
Comment at: llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp:1248
+
+    if (TII->usesVM_CNT(Inst) && mayAccessVMEMThroughFlat(Inst)) {
+      ++FlatASCount;
----------------
nhaehnle wrote:
> arsenm wrote:
> > When is usesVM_CNT false and isFLAT true?
> I'd like to know as well. It may be better to make this an `assert(TII->usesVM_CNT(Inst))` instead.
Second to that, turn the check into assert. There are no such instructions at least so far.


================
Comment at: llvm/test/CodeGen/AMDGPU/waitcnt.mir:66
 # CHECK: FLAT_LOAD_DWORD
-# GFX89: S_WAITCNT 112
+# GFX89: S_WAITCNT 3952
 # CHECK: FLAT_LOAD_DWORDX4
----------------
That one was not supposed to change? The pointer is flat here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89618



More information about the llvm-commits mailing list