[PATCH] D47213: [llvm-mca] Move DispatchStage::cycleEvent to preExecute. NFC.
Matt Davis via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 22 12:00:46 PDT 2018
mattd created this revision.
mattd added reviewers: andreadb, RKSimon, courbet.
Herald added subscribers: gbedwell, tschuett.
This is an intermediate change, it moves the non-notification logic from
Backend::notifyCycleBegin to runCycle().
Once the scheduler becomes part of the Execution stage
the explicit call to Scheduler::cycleEvent will disappear.
The logic for Dispatch::cycleEvent() can be in
the preExecute phase, which this patch addresses.
https://reviews.llvm.org/D47213
Files:
tools/llvm-mca/Backend.cpp
tools/llvm-mca/DispatchStage.cpp
tools/llvm-mca/DispatchStage.h
Index: tools/llvm-mca/DispatchStage.h
===================================================================
--- tools/llvm-mca/DispatchStage.h
+++ tools/llvm-mca/DispatchStage.h
@@ -98,14 +98,8 @@
this)),
Owner(B), STI(Subtarget) {}
- void cycleEvent() {
- RCU->cycleEvent();
- AvailableEntries =
- CarryOver >= DispatchWidth ? 0 : DispatchWidth - CarryOver;
- CarryOver = CarryOver >= DispatchWidth ? CarryOver - DispatchWidth : 0U;
- }
-
virtual bool isReady() const override final { return isRCUEmpty(); }
+ virtual void preExecute(const InstRef &IR) override final;
virtual bool execute(InstRef &IR) override final;
void notifyInstructionRetired(const InstRef &IR);
void notifyDispatchStall(const InstRef &IR, unsigned EventType);
Index: tools/llvm-mca/DispatchStage.cpp
===================================================================
--- tools/llvm-mca/DispatchStage.cpp
+++ tools/llvm-mca/DispatchStage.cpp
@@ -142,6 +142,12 @@
SC->scheduleInstruction(IR);
}
+void DispatchStage::preExecute(const InstRef &IR) {
+ RCU->cycleEvent();
+ AvailableEntries = CarryOver >= DispatchWidth ? 0 : DispatchWidth - CarryOver;
+ CarryOver = CarryOver >= DispatchWidth ? CarryOver - DispatchWidth : 0U;
+}
+
bool DispatchStage::execute(InstRef &IR) {
const InstrDesc &Desc = IR.getInstruction()->getDesc();
if (!isAvailable(Desc.NumMicroOps) || !canDispatch(IR))
Index: tools/llvm-mca/Backend.cpp
===================================================================
--- tools/llvm-mca/Backend.cpp
+++ tools/llvm-mca/Backend.cpp
@@ -38,6 +38,9 @@
notifyCycleBegin(Cycle);
InstRef IR;
+ Dispatch->preExecute(IR);
+ HWS->cycleEvent(); // TODO: This will eventually be stage-ified.
+
while (Fetch->execute(IR)) {
if (!Dispatch->execute(IR))
break;
@@ -51,9 +54,6 @@
LLVM_DEBUG(dbgs() << "[E] Cycle begin: " << Cycle << '\n');
for (HWEventListener *Listener : Listeners)
Listener->onCycleBegin();
-
- Dispatch->cycleEvent();
- HWS->cycleEvent();
}
void Backend::notifyInstructionEvent(const HWInstructionEvent &Event) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47213.148064.patch
Type: text/x-patch
Size: 2158 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180522/0ee7b559/attachment.bin>
More information about the llvm-commits
mailing list