summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
authorAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>2019-02-20 18:01:49 +0000
committerAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>2019-02-20 18:01:49 +0000
commit3316eb5bb8025e67415796f657bfae5e5374afae (patch)
treed9c2094ef185ae5e4c7606cdd7c6c8658d4e2da1 /llvm/include
parentdca47c659ce24413fc6fed5054c05d519a7e9a82 (diff)
downloadbcm5719-llvm-3316eb5bb8025e67415796f657bfae5e5374afae.tar.gz
bcm5719-llvm-3316eb5bb8025e67415796f657bfae5e5374afae.zip
[MCA][Scheduler] Collect resource pressure and memory dependency bottlenecks.
Every cycle, the Scheduler checks if instructions in the ReadySet can be issued to the underlying pipelines. If an instruction cannot be issued because one or more pipeline resources are unavailable, then field Instruction::CriticalResourceMask is updated with the resource identifier of the unavailable resources. If an instruction cannot be promoted from the PendingSet to the ReadySet because of a memory dependency, then field Instruction::CriticalMemDep is updated with the identifier of the dependending memory instruction. Bottleneck information is collected after every cycle for instructions that are waiting to execute. The idea is to help identify causes of bottlenecks; this information can be used in future to implement a bottleneck analysis. llvm-svn: 354490
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/MCA/HardwareUnits/Scheduler.h11
-rw-r--r--llvm/include/llvm/MCA/Instruction.h13
2 files changed, 18 insertions, 6 deletions
diff --git a/llvm/include/llvm/MCA/HardwareUnits/Scheduler.h b/llvm/include/llvm/MCA/HardwareUnits/Scheduler.h
index dc630eea5b6..38fe796c56c 100644
--- a/llvm/include/llvm/MCA/HardwareUnits/Scheduler.h
+++ b/llvm/include/llvm/MCA/HardwareUnits/Scheduler.h
@@ -120,6 +120,11 @@ class Scheduler : public HardwareUnit {
// Each bit of the mask represents an unavailable resource.
uint64_t BusyResourceUnits;
+ // Counts the number of instructions dispatched during this cycle that are
+ // added to the pending set. This information is used by the bottleneck
+ // analysis when analyzing instructions in the pending set.
+ unsigned NumDispatchedToThePendingSet;
+
/// Verify the given selection strategy and set the Strategy member
/// accordingly. If no strategy is provided, the DefaultSchedulerStrategy is
/// used.
@@ -184,11 +189,7 @@ public:
/// Returns true if instruction IR is ready to be issued to the underlying
/// pipelines. Note that this operation cannot fail; it assumes that a
/// previous call to method `isAvailable(IR)` returned `SC_AVAILABLE`.
- void dispatch(const InstRef &IR);
-
- /// Returns true if IR is ready to be executed by the underlying pipelines.
- /// This method assumes that IR has been previously dispatched.
- bool isReady(const InstRef &IR) const;
+ bool dispatch(const InstRef &IR);
/// Issue an instruction and populates a vector of used pipeline resources,
/// and a vector of instructions that transitioned to the ready state as a
diff --git a/llvm/include/llvm/MCA/Instruction.h b/llvm/include/llvm/MCA/Instruction.h
index d9bf3b7fa82..e6ee783ca49 100644
--- a/llvm/include/llvm/MCA/Instruction.h
+++ b/llvm/include/llvm/MCA/Instruction.h
@@ -420,6 +420,7 @@ public:
// Returns true if this instruction is a candidate for move elimination.
bool isOptimizableMove() const { return IsOptimizableMove; }
void setOptimizableMove() { IsOptimizableMove = true; }
+ bool isMemOp() const { return Desc.MayLoad || Desc.MayStore; }
};
/// An instruction propagated through the simulated instruction pipeline.
@@ -447,10 +448,13 @@ class Instruction : public InstructionBase {
// Retire Unit token ID for this instruction.
unsigned RCUTokenID;
+ uint64_t CriticalResourceMask;
+ unsigned CriticalMemDep;
+
public:
Instruction(const InstrDesc &D)
: InstructionBase(D), Stage(IS_INVALID), CyclesLeft(UNKNOWN_CYCLES),
- RCUTokenID(0) {}
+ RCUTokenID(0), CriticalResourceMask(0), CriticalMemDep(0) {}
unsigned getRCUTokenID() const { return RCUTokenID; }
int getCyclesLeft() const { return CyclesLeft; }
@@ -495,6 +499,13 @@ public:
Stage = IS_RETIRED;
}
+ void updateCriticalResourceMask(uint64_t BusyResourceUnits) {
+ CriticalResourceMask |= BusyResourceUnits;
+ }
+ uint64_t getCriticalResourceMask() const { return CriticalResourceMask; }
+ void setCriticalMemDep(unsigned IID) { CriticalMemDep = IID; }
+ unsigned getCriticalMemDep() const { return CriticalMemDep; }
+
void cycleEvent();
};
OpenPOWER on IntegriCloud