summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MCA
diff options
context:
space:
mode:
authorAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>2019-05-26 19:50:31 +0000
committerAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>2019-05-26 19:50:31 +0000
commitc2493ce4a40be025054087fde59dd0f339baf6c0 (patch)
tree2e12f295708675fd649d011f4dfaea1bfbe20ad0 /llvm/lib/MCA
parent06e02856ab5f9e6ce2a4173b4df6736e6cc8f969 (diff)
downloadbcm5719-llvm-c2493ce4a40be025054087fde59dd0f339baf6c0.tar.gz
bcm5719-llvm-c2493ce4a40be025054087fde59dd0f339baf6c0.zip
[MCA][Scheduler] Improved critical memory dependency computation.
This fixes a problem where back-pressure increases caused by register dependencies were not correctly notified if execution was also delayed by memory dependencies. llvm-svn: 361740
Diffstat (limited to 'llvm/lib/MCA')
-rw-r--r--llvm/lib/MCA/HardwareUnits/Scheduler.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/llvm/lib/MCA/HardwareUnits/Scheduler.cpp b/llvm/lib/MCA/HardwareUnits/Scheduler.cpp
index b2928ed1b12..6b3448fbe82 100644
--- a/llvm/lib/MCA/HardwareUnits/Scheduler.cpp
+++ b/llvm/lib/MCA/HardwareUnits/Scheduler.cpp
@@ -105,7 +105,13 @@ void Scheduler::issueInstruction(
// other dependent instructions. Dependent instructions may be issued during
// this same cycle if operands have ReadAdvance entries. Promote those
// instructions to the ReadySet and notify the caller that those are ready.
- if (HasDependentUsers && promoteToPendingSet(PendingInstructions))
+ // If IR is a memory operation, then always call method `promoteToReadySet()`
+ // to notify any dependent memory operations that IR started execution.
+ bool ShouldPromoteInstructions = Inst.isMemOp();
+ if (HasDependentUsers)
+ ShouldPromoteInstructions |= promoteToPendingSet(PendingInstructions);
+
+ if (ShouldPromoteInstructions)
promoteToReadySet(ReadyInstructions);
}
@@ -287,15 +293,19 @@ uint64_t Scheduler::analyzeResourcePressure(SmallVectorImpl<InstRef> &Insts) {
void Scheduler::analyzeDataDependencies(SmallVectorImpl<InstRef> &RegDeps,
SmallVectorImpl<InstRef> &MemDeps) {
const auto EndIt = PendingSet.end() - NumDispatchedToThePendingSet;
- for (InstRef &IR : make_range(PendingSet.begin(), EndIt)) {
- Instruction &IS = *IR.getInstruction();
+ for (const InstRef &IR : make_range(PendingSet.begin(), EndIt)) {
+ const Instruction &IS = *IR.getInstruction();
if (Resources->checkAvailability(IS.getDesc()))
continue;
- if (IS.isReady() || (IS.isMemOp() && LSU.isReady(IR) != IR))
- MemDeps.emplace_back(IR);
- else
+ const CriticalDependency &CMD = IS.getCriticalMemDep();
+ if (IS.isMemOp() && IS.getCurrentMemDep() != &IS && !CMD.Cycles)
+ continue;
+
+ if (IS.isPending())
RegDeps.emplace_back(IR);
+ if (CMD.Cycles)
+ MemDeps.emplace_back(IR);
}
}
OpenPOWER on IntegriCloud