std::vector<InstRef> ReadySet;
std::vector<InstRef> IssuedSet;
+ // A mask of busy resource units. It defaults to the empty set (i.e. a zero
+ // mask), and it is cleared at the beginning of every cycle.
+ // It is updated every time the scheduler fails to issue an instruction from
+ // the ready set due to unavailable pipeline resources.
+ // Each bit of the mask represents an unavailable resource.
+ uint64_t BusyResourceUnits;
+
/// Verify the given selection strategy and set the Strategy member
/// accordingly. If no strategy is provided, the DefaultSchedulerStrategy is
/// used.
Scheduler(std::unique_ptr<ResourceManager> RM, LSUnit &Lsu,
std::unique_ptr<SchedulerStrategy> SelectStrategy)
- : LSU(Lsu), Resources(std::move(RM)) {
+ : LSU(Lsu), Resources(std::move(RM)), BusyResourceUnits(0) {
initializeStrategy(std::move(SelectStrategy));
}
/// resources are not available.
InstRef select();
+ /// Returns a mask of busy resources. Each bit of the mask identifies a unique
+ /// processor resource unit. In the absence of bottlenecks caused by resource
+ /// pressure, the mask value returned by this method is always zero.
+ uint64_t getBusyResourceUnits() const { return BusyResourceUnits; }
bool arePipelinesFullyUsed() const {
return !Resources->getAvailableProcResUnits();
}
Strategy->compare(IR, ReadySet[QueueIndex])) {
const InstrDesc &D = IR.getInstruction()->getDesc();
uint64_t BusyResourceMask = Resources->checkAvailability(D);
+ BusyResourceUnits |= BusyResourceMask;
if (!BusyResourceMask)
QueueIndex = I;
}
IR.getInstruction()->cycleEvent();
promoteToReadySet(Ready);
+
+ BusyResourceUnits = 0;
}
bool Scheduler::mustIssueImmediately(const InstRef &IR) const {