[llvm] 4f5ba46 - [AMDGPU] Set wait state for meta instructions to zero
Christudasan Devadasan via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 17 22:50:43 PDT 2021
Author: Christudasan Devadasan
Date: 2021-08-18T01:46:59-04:00
New Revision: 4f5ba46e162eec32a9f9e2a725e6422281913043
URL: https://github.com/llvm/llvm-project/commit/4f5ba46e162eec32a9f9e2a725e6422281913043
DIFF: https://github.com/llvm/llvm-project/commit/4f5ba46e162eec32a9f9e2a725e6422281913043.diff
LOG: [AMDGPU] Set wait state for meta instructions to zero
It looked more reasonable to set the wait state to
zero for all non-instructions. With that we can avoid
the special handling for them in `getWaitStatesSince`
and `AdvanceCycle`. This NFC patch makes the handling
more generic.
Added:
Modified:
llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp b/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp
index 7b5ced3ff3a5..aca8b533d7dc 100644
--- a/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp
+++ b/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp
@@ -349,14 +349,6 @@ void GCNHazardRecognizer::AdvanceCycle() {
return;
}
- // Do not track non-instructions which do not affect the wait states.
- // If included, these instructions can lead to buffer overflow such that
- // detectable hazards are missed.
- if (CurrCycleInstr->isMetaInstruction()) {
- CurrCycleInstr = nullptr;
- return;
- }
-
if (CurrCycleInstr->isBundle()) {
processBundle();
return;
@@ -413,7 +405,7 @@ static int getWaitStatesSince(GCNHazardRecognizer::IsHazardFn IsHazard,
if (IsHazard(*I))
return WaitStates;
- if (I->isInlineAsm() || I->isMetaInstruction())
+ if (I->isInlineAsm())
continue;
WaitStates += SIInstrInfo::getNumWaitStates(*I);
diff --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
index 2cdd98fe0060..809da5d425b7 100644
--- a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
@@ -1637,7 +1637,10 @@ void SIInstrInfo::insertReturn(MachineBasicBlock &MBB) const {
unsigned SIInstrInfo::getNumWaitStates(const MachineInstr &MI) {
switch (MI.getOpcode()) {
- default: return 1; // FIXME: Do wait states equal cycles?
+ default:
+ if (MI.isMetaInstruction())
+ return 0;
+ return 1; // FIXME: Do wait states equal cycles?
case AMDGPU::S_NOP:
return MI.getOperand(0).getImm() + 1;
More information about the llvm-commits
mailing list