[PATCH] D24985: [AMDGPU] Ask subtarget if waitcnt instruction is needed before barrier instruction

Konstantin Zhuravlyov via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 30 09:59:29 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL282875: [AMDGPU] Ask subtarget if waitcnt instruction is needed before barrier… (authored by kzhuravl).

Changed prior to commit:
  https://reviews.llvm.org/D24985?vs=72700&id=73078#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D24985

Files:
  llvm/trunk/lib/Target/AMDGPU/AMDGPUSubtarget.h
  llvm/trunk/lib/Target/AMDGPU/SIInsertWaits.cpp


Index: llvm/trunk/lib/Target/AMDGPU/AMDGPUSubtarget.h
===================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPUSubtarget.h
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPUSubtarget.h
@@ -540,6 +540,12 @@
 
   /// Return the maximum number of waves per SIMD for kernels using \p VGPRs VGPRs
   unsigned getOccupancyWithNumVGPRs(unsigned VGPRs) const;
+
+  /// \returns True if waitcnt instruction is needed before barrier instruction,
+  /// false otherwise.
+  bool needWaitcntBeforeBarrier() const {
+    return true;
+  }
 };
 
 } // End namespace llvm
Index: llvm/trunk/lib/Target/AMDGPU/SIInsertWaits.cpp
===================================================================
--- llvm/trunk/lib/Target/AMDGPU/SIInsertWaits.cpp
+++ llvm/trunk/lib/Target/AMDGPU/SIInsertWaits.cpp
@@ -590,8 +590,9 @@
       // S_SENDMSG implicitly waits for all outstanding LGKM transfers to finish,
       // but we also want to wait for any other outstanding transfers before
       // signalling other hardware blocks
-      if (I->getOpcode() == AMDGPU::S_BARRIER ||
-          I->getOpcode() == AMDGPU::S_SENDMSG)
+      if ((I->getOpcode() == AMDGPU::S_BARRIER &&
+               ST->needWaitcntBeforeBarrier()) ||
+           I->getOpcode() == AMDGPU::S_SENDMSG)
         Required = LastIssued;
       else
         Required = handleOperands(*I);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24985.73078.patch
Type: text/x-patch
Size: 1377 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160930/62355cd2/attachment.bin>


More information about the llvm-commits mailing list