diff options
author | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2019-02-26 14:19:00 +0000 |
---|---|---|
committer | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2019-02-26 14:19:00 +0000 |
commit | c032e2ab7cda80a2b68345801162746eb48770c0 (patch) | |
tree | e7dc94027a3d9f165509d2ac1770455eaf44d98a /llvm/lib/MCA | |
parent | b75bf8784eb83cf92e6670aba614c3968972960f (diff) | |
download | bcm5719-llvm-c032e2ab7cda80a2b68345801162746eb48770c0.tar.gz bcm5719-llvm-c032e2ab7cda80a2b68345801162746eb48770c0.zip |
[MCA] Always check if scheduler resources are unavailable when reporting dispatch stalls.
Dispatch stall cycles may be associated to multiple dispatch stall events.
Before this patch, each stall cycle was associated with a single stall event.
This patch also improves a couple of code comments, and adds a helper method to
query the Scheduler for dispatch stalls.
llvm-svn: 354877
Diffstat (limited to 'llvm/lib/MCA')
-rw-r--r-- | llvm/lib/MCA/HardwareUnits/Scheduler.cpp | 12 | ||||
-rw-r--r-- | llvm/lib/MCA/Stages/DispatchStage.cpp | 5 |
2 files changed, 13 insertions, 4 deletions
diff --git a/llvm/lib/MCA/HardwareUnits/Scheduler.cpp b/llvm/lib/MCA/HardwareUnits/Scheduler.cpp index d3d7234c611..1a428ac10a0 100644 --- a/llvm/lib/MCA/HardwareUnits/Scheduler.cpp +++ b/llvm/lib/MCA/HardwareUnits/Scheduler.cpp @@ -37,10 +37,13 @@ void Scheduler::dump() const { } #endif -Scheduler::Status Scheduler::isAvailable(const InstRef &IR) const { +Scheduler::Status Scheduler::isAvailable(const InstRef &IR) { const InstrDesc &Desc = IR.getInstruction()->getDesc(); - switch (Resources->canBeDispatched(Desc.Buffers)) { + ResourceStateEvent RSE = Resources->canBeDispatched(Desc.Buffers); + HadTokenStall = RSE != RS_BUFFER_AVAILABLE; + + switch (RSE) { case ResourceStateEvent::RS_BUFFER_UNAVAILABLE: return Scheduler::SC_BUFFERS_FULL; case ResourceStateEvent::RS_RESERVED: @@ -50,7 +53,10 @@ Scheduler::Status Scheduler::isAvailable(const InstRef &IR) const { } // Give lower priority to LSUnit stall events. - switch (LSU.isAvailable(IR)) { + LSUnit::Status LSS = LSU.isAvailable(IR); + HadTokenStall = LSS != LSUnit::LSU_AVAILABLE; + + switch (LSS) { case LSUnit::LSU_LQUEUE_FULL: return Scheduler::SC_LOAD_QUEUE_FULL; case LSUnit::LSU_SQUEUE_FULL: diff --git a/llvm/lib/MCA/Stages/DispatchStage.cpp b/llvm/lib/MCA/Stages/DispatchStage.cpp index ade20aba018..ae3d3fd6743 100644 --- a/llvm/lib/MCA/Stages/DispatchStage.cpp +++ b/llvm/lib/MCA/Stages/DispatchStage.cpp @@ -59,7 +59,10 @@ bool DispatchStage::checkRCU(const InstRef &IR) const { } bool DispatchStage::canDispatch(const InstRef &IR) const { - return checkRCU(IR) && checkPRF(IR) && checkNextStage(IR); + bool CanDispatch = checkRCU(IR); + CanDispatch &= checkPRF(IR); + CanDispatch &= checkNextStage(IR); + return CanDispatch; } Error DispatchStage::dispatch(InstRef IR) { |