17 #define DEBUG_TYPE "llvm-mca" 23 : NextAvailableSlotIdx(0), CurrentInstructionSlotIdx(0),
24 NumROBEntries(SM.MicroOpBufferSize),
25 AvailableEntries(SM.MicroOpBufferSize), MaxRetirePerCycle(0) {
35 NumROBEntries = AvailableEntries;
36 assert(NumROBEntries &&
"Invalid reorder buffer size!");
37 Queue.resize(2 * NumROBEntries);
44 assert((AvailableEntries >= Entries) &&
"Reorder Buffer unavailable!");
46 unsigned TokenID = NextAvailableSlotIdx;
47 Queue[NextAvailableSlotIdx] = {
IR, Entries,
false};
48 NextAvailableSlotIdx +=
std::max(1U, Entries);
49 NextAvailableSlotIdx %= Queue.size();
51 AvailableEntries -= Entries;
59 assert(Inst &&
"Invalid RUToken in the RCU queue.");
64 unsigned RetireControlUnit::computeNextSlotIdx()
const {
66 unsigned NextSlotIdx = CurrentInstructionSlotIdx +
std::max(1U, Current.
NumSlots);
67 return NextSlotIdx % Queue.size();
71 return Queue[computeNextSlotIdx()];
80 CurrentInstructionSlotIdx %= Queue.size();
81 AvailableEntries += Current.
NumSlots;
82 Current = {
InstRef(), 0U,
false };
86 assert(Queue.size() > TokenID);
87 assert(Queue[TokenID].
IR.getInstruction() &&
"Instruction was not dispatched!");
88 assert(Queue[TokenID].Executed ==
false &&
"Instruction already executed!");
89 Queue[TokenID].Executed =
true;
94 dbgs() <<
"Retire Unit: { Total ROB Entries =" << NumROBEntries
95 <<
", Available ROB entries=" << AvailableEntries <<
" }\n";
Instruction * getInstruction()
An instruction propagated through the simulated instruction pipeline.
This class represents lattice values for constants.
This file simulates the hardware responsible for retiring instructions.
An InstRef contains both a SourceMgr index and Instruction pair.
void consumeCurrentToken()
unsigned getNumMicroOps() const
void onInstructionExecuted(unsigned TokenID)
bool hasExtraProcessorInfo() const
unsigned dispatch(const InstRef &IS)
Align max(MaybeAlign Lhs, Align Rhs)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
const RUToken & getCurrentToken() const
const RUToken & peekNextToken() const
const MCExtraProcessorInfo & getExtraProcessorInfo() const
RetireControlUnit(const MCSchedModel &SM)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Machine model for scheduling, bundling, and heuristics.
Statically lint checks LLVM IR