]> granicus.if.org Git - llvm/commitdiff
[AMDGPU] Ask subtarget if waitcnt instruction is needed before barrier instruction
authorKonstantin Zhuravlyov <kzhuravl_dev@outlook.com>
Fri, 30 Sep 2016 16:50:36 +0000 (16:50 +0000)
committerKonstantin Zhuravlyov <kzhuravl_dev@outlook.com>
Fri, 30 Sep 2016 16:50:36 +0000 (16:50 +0000)
Differential Revision: https://reviews.llvm.org/D24985

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282875 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/AMDGPU/AMDGPUSubtarget.h
lib/Target/AMDGPU/SIInsertWaits.cpp

index c278cc55a028ba81a1c03cc40459d8faa179fc86..3298a4bd5825e93336bda1284cd31630cf713331 100644 (file)
@@ -540,6 +540,12 @@ public:
 
   /// 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 d24588d6c1439eb31def53c5638472f92fa8684e..b9551bed2562ebfbafac95828cb59f69afbd36b4 100644 (file)
@@ -590,8 +590,9 @@ bool SIInsertWaits::runOnMachineFunction(MachineFunction &MF) {
       // 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);