gem5
|
DefaultRename handles both single threaded and SMT rename. More...
#include <rename.hh>
Classes | |
struct | FreeEntries |
Structures whose free entries impact the amount of instructions that can be renamed. More... | |
struct | RenameHistory |
Holds the information for each destination register rename. More... | |
struct | Stalls |
Source of possible stalls. More... | |
Public Types | |
enum | RenameStatus { Active, Inactive } |
Overall rename status. More... | |
enum | ThreadStatus { Running, Idle, StartSquash, Squashing, Blocked, Unblocking, SerializeStall } |
Individual thread status. More... | |
typedef Impl::CPUPol | CPUPol |
typedef Impl::DynInstPtr | DynInstPtr |
typedef Impl::O3CPU | O3CPU |
typedef CPUPol::DecodeStruct | DecodeStruct |
typedef CPUPol::RenameStruct | RenameStruct |
typedef CPUPol::TimeStruct | TimeStruct |
typedef CPUPol::FreeList | FreeList |
typedef CPUPol::RenameMap | RenameMap |
typedef CPUPol::IEW | IEW |
typedef CPUPol::Commit | Commit |
typedef TheISA::RegIndex | RegIndex |
typedef std::deque< DynInstPtr > | InstQueue |
Public Member Functions | |
DefaultRename (O3CPU *_cpu, DerivO3CPUParams *params) | |
DefaultRename constructor. More... | |
std::string | name () const |
Returns the name of rename. More... | |
void | regStats () |
Registers statistics. More... | |
void | regProbePoints () |
Registers probes. More... | |
void | setTimeBuffer (TimeBuffer< TimeStruct > *tb_ptr) |
Sets the main backwards communication time buffer pointer. More... | |
void | setRenameQueue (TimeBuffer< RenameStruct > *rq_ptr) |
Sets pointer to time buffer used to communicate to the next stage. More... | |
void | setDecodeQueue (TimeBuffer< DecodeStruct > *dq_ptr) |
Sets pointer to time buffer coming from decode. More... | |
void | setIEWStage (IEW *iew_stage) |
Sets pointer to IEW stage. More... | |
void | setCommitStage (Commit *commit_stage) |
Sets pointer to commit stage. More... | |
void | startupStage () |
Initializes variables for the stage. More... | |
void | setActiveThreads (std::list< ThreadID > *at_ptr) |
Sets pointer to list of active threads. More... | |
void | setRenameMap (RenameMap rm_ptr[Impl::MaxThreads]) |
Sets pointer to rename maps (per-thread structures). More... | |
void | setFreeList (FreeList *fl_ptr) |
Sets pointer to the free list. More... | |
void | setScoreboard (Scoreboard *_scoreboard) |
Sets pointer to the scoreboard. More... | |
void | drainSanityCheck () const |
Perform sanity checks after a drain. More... | |
bool | isDrained () const |
Has the stage drained? More... | |
void | takeOverFrom () |
Takes over from another CPU's thread. More... | |
void | squash (const InstSeqNum &squash_seq_num, ThreadID tid) |
Squashes all instructions in a thread. More... | |
void | tick () |
Ticks rename, which processes all input signals and attempts to rename as many instructions as possible. More... | |
void | dumpHistory () |
Debugging function used to dump history buffer of renamings. More... | |
Private Types | |
enum | FullSource { ROB, IQ, LQ, SQ, NONE } |
Enum to record the source of a structure full stall. More... | |
typedef std::pair< InstSeqNum, short int > | SeqNumRegPair |
Probe points. More... | |
Private Member Functions | |
void | resetStage () |
Reset this pipeline stage. More... | |
void | rename (bool &status_change, ThreadID tid) |
Determines what to do based on rename's current status. More... | |
void | renameInsts (ThreadID tid) |
Renames instructions for the given thread. More... | |
void | skidInsert (ThreadID tid) |
Inserts unused instructions from a given thread into the skid buffer, to be renamed once rename unblocks. More... | |
void | sortInsts () |
Separates instructions from decode into individual lists of instructions sorted by thread. More... | |
bool | skidsEmpty () |
Returns if all of the skid buffers are empty. More... | |
void | updateStatus () |
Updates overall rename status based on all of the threads' statuses. More... | |
bool | block (ThreadID tid) |
Switches rename to blocking, and signals back that rename has become blocked. More... | |
bool | unblock (ThreadID tid) |
Switches rename to unblocking if the skid buffer is empty, and signals back that rename has unblocked. More... | |
void | doSquash (const InstSeqNum &squash_seq_num, ThreadID tid) |
Executes actual squash, removing squashed instructions. More... | |
void | removeFromHistory (InstSeqNum inst_seq_num, ThreadID tid) |
Removes a committed instruction's rename history. More... | |
void | renameSrcRegs (DynInstPtr &inst, ThreadID tid) |
Renames the source registers of an instruction. More... | |
void | renameDestRegs (DynInstPtr &inst, ThreadID tid) |
Renames the destination registers of an instruction. More... | |
int | calcFreeROBEntries (ThreadID tid) |
Calculates the number of free ROB entries for a specific thread. More... | |
int | calcFreeIQEntries (ThreadID tid) |
Calculates the number of free IQ entries for a specific thread. More... | |
int | calcFreeLQEntries (ThreadID tid) |
Calculates the number of free LQ entries for a specific thread. More... | |
int | calcFreeSQEntries (ThreadID tid) |
Calculates the number of free SQ entries for a specific thread. More... | |
unsigned | validInsts () |
Returns the number of valid instructions coming from decode. More... | |
void | readStallSignals (ThreadID tid) |
Reads signals telling rename to block/unblock. More... | |
bool | checkStall (ThreadID tid) |
Checks if any stages are telling rename to block. More... | |
void | readFreeEntries (ThreadID tid) |
Gets the number of free entries for a specific thread. More... | |
bool | checkSignalsAndUpdate (ThreadID tid) |
Checks the signals and updates the status. More... | |
void | serializeAfter (InstQueue &inst_list, ThreadID tid) |
Either serializes on the next instruction available in the InstQueue, or records that it must serialize on the next instruction to enter rename. More... | |
void | incrFullStat (const FullSource &source) |
Function used to increment the stat that corresponds to the source of the stall. More... | |
Private Attributes | |
RenameStatus | _status |
Rename status. More... | |
ThreadStatus | renameStatus [Impl::MaxThreads] |
Per-thread status. More... | |
ProbePointArg< DynInstPtr > * | ppRename |
To probe when register renaming for an instruction is complete. More... | |
ProbePointArg< SeqNumRegPair > * | ppSquashInRename |
To probe when an instruction is squashed and the register mapping for it needs to be undone. More... | |
IEW * | iew_ptr |
Pointer to IEW stage. More... | |
Commit * | commit_ptr |
Pointer to commit stage. More... | |
std::list< RenameHistory > | historyBuffer [Impl::MaxThreads] |
A per-thread list of all destination register renames, used to either undo rename mappings or free old physical registers. More... | |
O3CPU * | cpu |
Pointer to CPU. More... | |
TimeBuffer< TimeStruct > * | timeBuffer |
Pointer to main time buffer used for backwards communication. More... | |
TimeBuffer< TimeStruct >::wire | fromIEW |
Wire to get IEW's output from backwards time buffer. More... | |
TimeBuffer< TimeStruct >::wire | fromCommit |
Wire to get commit's output from backwards time buffer. More... | |
TimeBuffer< TimeStruct >::wire | toDecode |
Wire to write infromation heading to previous stages. More... | |
TimeBuffer< RenameStruct > * | renameQueue |
Rename instruction queue. More... | |
TimeBuffer< RenameStruct >::wire | toIEW |
Wire to write any information heading to IEW. More... | |
TimeBuffer< DecodeStruct > * | decodeQueue |
Decode instruction queue interface. More... | |
TimeBuffer< DecodeStruct >::wire | fromDecode |
Wire to get decode's output from decode queue. More... | |
InstQueue | insts [Impl::MaxThreads] |
Queue of all instructions coming from decode this cycle. More... | |
InstQueue | skidBuffer [Impl::MaxThreads] |
Skid buffer between rename and decode. More... | |
RenameMap * | renameMap [Impl::MaxThreads] |
Rename map interface. More... | |
FreeList * | freeList |
Free list interface. More... | |
std::list< ThreadID > * | activeThreads |
Pointer to the list of active threads. More... | |
Scoreboard * | scoreboard |
Pointer to the scoreboard. More... | |
int | instsInProgress [Impl::MaxThreads] |
Count of instructions in progress that have been sent off to the IQ and ROB, but are not yet included in their occupancy counts. More... | |
int | loadsInProgress [Impl::MaxThreads] |
Count of Load instructions in progress that have been sent off to the IQ and ROB, but are not yet included in their occupancy counts. More... | |
int | storesInProgress [Impl::MaxThreads] |
Count of Store instructions in progress that have been sent off to the IQ and ROB, but are not yet included in their occupancy counts. More... | |
bool | wroteToTimeBuffer |
Variable that tracks if decode has written to the time buffer this cycle. More... | |
FreeEntries | freeEntries [Impl::MaxThreads] |
Per-thread tracking of the number of free entries of back-end structures. More... | |
bool | emptyROB [Impl::MaxThreads] |
Records if the ROB is empty. More... | |
Stalls | stalls [Impl::MaxThreads] |
Tracks which stages are telling decode to stall. More... | |
DynInstPtr | serializeInst [Impl::MaxThreads] |
The serialize instruction that rename has stalled on. More... | |
bool | serializeOnNextInst [Impl::MaxThreads] |
Records if rename needs to serialize on the next instruction for any thread. More... | |
int | iewToRenameDelay |
Delay between iew and rename, in ticks. More... | |
int | decodeToRenameDelay |
Delay between decode and rename, in ticks. More... | |
unsigned | commitToRenameDelay |
Delay between commit and rename, in ticks. More... | |
unsigned | renameWidth |
Rename width, in instructions. More... | |
unsigned | commitWidth |
Commit width, in instructions. More... | |
unsigned | toIEWIndex |
The index of the instruction in the time buffer to IEW that rename is currently using. More... | |
bool | blockThisCycle |
Whether or not rename needs to block this cycle. More... | |
bool | resumeSerialize |
Whether or not rename needs to resume a serialize instruction after squashing. More... | |
bool | resumeUnblocking |
Whether or not rename needs to resume clearing out the skidbuffer after squashing. More... | |
ThreadID | numThreads |
The number of threads active in rename. More... | |
unsigned | skidBufferMax |
The maximum skid buffer size. More... | |
PhysRegIndex | maxPhysicalRegs |
Stats::Scalar | renameSquashCycles |
Stat for total number of cycles spent squashing. More... | |
Stats::Scalar | renameIdleCycles |
Stat for total number of cycles spent idle. More... | |
Stats::Scalar | renameBlockCycles |
Stat for total number of cycles spent blocking. More... | |
Stats::Scalar | renameSerializeStallCycles |
Stat for total number of cycles spent stalling for a serializing inst. More... | |
Stats::Scalar | renameRunCycles |
Stat for total number of cycles spent running normally. More... | |
Stats::Scalar | renameUnblockCycles |
Stat for total number of cycles spent unblocking. More... | |
Stats::Scalar | renameRenamedInsts |
Stat for total number of renamed instructions. More... | |
Stats::Scalar | renameSquashedInsts |
Stat for total number of squashed instructions that rename discards. More... | |
Stats::Scalar | renameROBFullEvents |
Stat for total number of times that the ROB starts a stall in rename. More... | |
Stats::Scalar | renameIQFullEvents |
Stat for total number of times that the IQ starts a stall in rename. More... | |
Stats::Scalar | renameLQFullEvents |
Stat for total number of times that the LQ starts a stall in rename. More... | |
Stats::Scalar | renameSQFullEvents |
Stat for total number of times that the SQ starts a stall in rename. More... | |
Stats::Scalar | renameFullRegistersEvents |
Stat for total number of times that rename runs out of free registers to use to rename. More... | |
Stats::Scalar | renameRenamedOperands |
Stat for total number of renamed destination registers. More... | |
Stats::Scalar | renameRenameLookups |
Stat for total number of source register rename lookups. More... | |
Stats::Scalar | intRenameLookups |
Stats::Scalar | fpRenameLookups |
Stats::Scalar | renameCommittedMaps |
Stat for total number of committed renaming mappings. More... | |
Stats::Scalar | renameUndoneMaps |
Stat for total number of mappings that were undone due to a squash. More... | |
Stats::Scalar | renamedSerializing |
Number of serialize instructions handled. More... | |
Stats::Scalar | renamedTempSerializing |
Number of instructions marked as temporarily serializing. More... | |
Stats::Scalar | renameSkidInsts |
Number of instructions inserted into skid buffers. More... | |
DefaultRename handles both single threaded and SMT rename.
Its width is specified by the parameters; each cycle it tries to rename that many instructions. It holds onto the rename history of all instructions with destination registers, storing the arch. register, the new physical register, and the old physical register, to allow for undoing of mappings if squashing happens, or freeing up registers upon commit. Rename handles blocking if the ROB, IQ, or LSQ is going to be full. Rename also handles barriers, and does so by stalling on the instruction until the ROB is empty and there are no instructions in flight to the ROB.
typedef CPUPol::Commit DefaultRename< Impl >::Commit |
typedef Impl::CPUPol DefaultRename< Impl >::CPUPol |
typedef CPUPol::DecodeStruct DefaultRename< Impl >::DecodeStruct |
typedef Impl::DynInstPtr DefaultRename< Impl >::DynInstPtr |
typedef CPUPol::FreeList DefaultRename< Impl >::FreeList |
typedef CPUPol::IEW DefaultRename< Impl >::IEW |
typedef std::deque<DynInstPtr> DefaultRename< Impl >::InstQueue |
typedef Impl::O3CPU DefaultRename< Impl >::O3CPU |
typedef TheISA::RegIndex DefaultRename< Impl >::RegIndex |
typedef CPUPol::RenameMap DefaultRename< Impl >::RenameMap |
typedef CPUPol::RenameStruct DefaultRename< Impl >::RenameStruct |
|
private |
typedef CPUPol::TimeStruct DefaultRename< Impl >::TimeStruct |
|
private |
enum DefaultRename::RenameStatus |
enum DefaultRename::ThreadStatus |
DefaultRename< Impl >::DefaultRename | ( | O3CPU * | _cpu, |
DerivO3CPUParams * | params | ||
) |
DefaultRename constructor.
Definition at line 63 of file rename_impl.hh.
References DefaultRename< Impl >::decodeToRenameDelay, fatal, DefaultRename< Impl >::renameWidth, and DefaultRename< Impl >::skidBufferMax.
|
private |
Switches rename to blocking, and signals back that rename has become blocked.
Definition at line 854 of file rename_impl.hh.
References DPRINTF.
|
inlineprivate |
Calculates the number of free IQ entries for a specific thread.
Definition at line 1162 of file rename_impl.hh.
|
inlineprivate |
Calculates the number of free LQ entries for a specific thread.
Definition at line 1174 of file rename_impl.hh.
References DPRINTF.
|
inlineprivate |
Calculates the number of free ROB entries for a specific thread.
Definition at line 1150 of file rename_impl.hh.
|
inlineprivate |
Calculates the number of free SQ entries for a specific thread.
Definition at line 1186 of file rename_impl.hh.
References DPRINTF.
|
private |
Checks the signals and updates the status.
Definition at line 1288 of file rename_impl.hh.
|
private |
Checks if any stages are telling rename to block.
Definition at line 1226 of file rename_impl.hh.
References DPRINTF.
|
private |
Executes actual squash, removing squashed instructions.
Definition at line 909 of file rename_impl.hh.
References DPRINTF.
void DefaultRename< Impl >::drainSanityCheck | ( | ) | const |
Perform sanity checks after a drain.
Definition at line 323 of file rename_impl.hh.
void DefaultRename< Impl >::dumpHistory | ( | ) |
Debugging function used to dump history buffer of renamings.
Definition at line 1425 of file rename_impl.hh.
References cprintf().
|
inlineprivate |
Function used to increment the stat that corresponds to the source of the stall.
Definition at line 1402 of file rename_impl.hh.
References panic.
bool DefaultRename< Impl >::isDrained | ( | ) | const |
std::string DefaultRename< Impl >::name | ( | ) | const |
Returns the name of rename.
Definition at line 85 of file rename_impl.hh.
|
private |
Gets the number of free entries for a specific thread.
Definition at line 1258 of file rename_impl.hh.
References DPRINTF.
|
private |
Reads signals telling rename to block/unblock.
Definition at line 1212 of file rename_impl.hh.
void DefaultRename< Impl >::regProbePoints | ( | ) |
Registers probes.
Definition at line 189 of file rename_impl.hh.
void DefaultRename< Impl >::regStats | ( | ) |
Registers statistics.
Definition at line 92 of file rename_impl.hh.
References name(), and Stats::total.
|
private |
Removes a committed instruction's rename history.
Definition at line 958 of file rename_impl.hh.
References DPRINTF, and X86ISA::size().
|
private |
Determines what to do based on rename's current status.
status_change | rename() sets this variable if there was a status change (ie switching from blocking to unblocking). |
tid | Thread id to rename instructions from. |
Definition at line 450 of file rename_impl.hh.
|
inlineprivate |
Renames the destination registers of an instruction.
Definition at line 1070 of file rename_impl.hh.
References AlphaISA::CC_Reg_Base, CCRegClass, DPRINTF, ThreadContext::flattenCCIndex(), ThreadContext::flattenFloatIndex(), ThreadContext::flattenIntIndex(), FloatRegClass, AlphaISA::FP_Reg_Base, IntRegClass, AlphaISA::Misc_Reg_Base, MiscRegClass, panic, regIdxToClass(), and X86ISA::size().
|
private |
Renames instructions for the given thread.
Also handles serializing instructions.
Definition at line 504 of file rename_impl.hh.
|
inlineprivate |
Renames the source registers of an instruction.
Definition at line 1005 of file rename_impl.hh.
References CCRegClass, DPRINTF, ThreadContext::flattenCCIndex(), ThreadContext::flattenFloatIndex(), ThreadContext::flattenIntIndex(), FloatRegClass, IntRegClass, MiscRegClass, panic, RegClassStrings, and regIdxToClass().
|
private |
Reset this pipeline stage.
Definition at line 241 of file rename_impl.hh.
|
private |
Either serializes on the next instruction available in the InstQueue, or records that it must serialize on the next instruction to enter rename.
inst_list | The list of younger, unprocessed instructions for the thread that has the serializeAfter instruction. |
tid | The thread id. |
Definition at line 1388 of file rename_impl.hh.
void DefaultRename< Impl >::setActiveThreads | ( | std::list< ThreadID > * | at_ptr | ) |
Sets pointer to list of active threads.
Definition at line 271 of file rename_impl.hh.
|
inline |
Sets pointer to commit stage.
Used only for initialization.
Definition at line 161 of file rename.hh.
References DefaultRename< Impl >::commit_ptr.
void DefaultRename< Impl >::setDecodeQueue | ( | TimeBuffer< DecodeStruct > * | dq_ptr | ) |
Sets pointer to time buffer coming from decode.
Definition at line 224 of file rename_impl.hh.
References TimeBuffer< T >::getWire().
void DefaultRename< Impl >::setFreeList | ( | FreeList * | fl_ptr | ) |
Sets pointer to the free list.
Definition at line 287 of file rename_impl.hh.
|
inline |
Sets pointer to IEW stage.
Used only for initialization.
Definition at line 157 of file rename.hh.
References DefaultRename< Impl >::iew_ptr.
void DefaultRename< Impl >::setRenameMap | ( | RenameMap | rm_ptr[Impl::MaxThreads] | ) |
Sets pointer to rename maps (per-thread structures).
Definition at line 279 of file rename_impl.hh.
void DefaultRename< Impl >::setRenameQueue | ( | TimeBuffer< RenameStruct > * | rq_ptr | ) |
Sets pointer to time buffer used to communicate to the next stage.
Definition at line 214 of file rename_impl.hh.
References TimeBuffer< T >::getWire().
void DefaultRename< Impl >::setScoreboard | ( | Scoreboard * | _scoreboard | ) |
Sets pointer to the scoreboard.
Definition at line 294 of file rename_impl.hh.
void DefaultRename< Impl >::setTimeBuffer | ( | TimeBuffer< TimeStruct > * | tb_ptr | ) |
Sets the main backwards communication time buffer pointer.
Definition at line 198 of file rename_impl.hh.
References TimeBuffer< T >::getWire().
|
private |
Inserts unused instructions from a given thread into the skid buffer, to be renamed once rename unblocks.
Definition at line 747 of file rename_impl.hh.
References DPRINTF, panic, X86ISA::size(), and warn.
|
private |
Returns if all of the skid buffers are empty.
Definition at line 798 of file rename_impl.hh.
|
private |
Separates instructions from decode into individual lists of instructions sorted by thread.
Definition at line 782 of file rename_impl.hh.
void DefaultRename< Impl >::squash | ( | const InstSeqNum & | squash_seq_num, |
ThreadID | tid | ||
) |
Squashes all instructions in a thread.
Definition at line 335 of file rename_impl.hh.
void DefaultRename< Impl >::startupStage | ( | ) |
Initializes variables for the stage.
Definition at line 234 of file rename_impl.hh.
void DefaultRename< Impl >::takeOverFrom | ( | ) |
Takes over from another CPU's thread.
Definition at line 316 of file rename_impl.hh.
void DefaultRename< Impl >::tick | ( | ) |
Ticks rename, which processes all input signals and attempts to rename as many instructions as possible.
Definition at line 386 of file rename_impl.hh.
References DPRINTF.
|
private |
Switches rename to unblocking if the skid buffer is empty, and signals back that rename has unblocked.
Definition at line 888 of file rename_impl.hh.
|
private |
Updates overall rename status based on all of the threads' statuses.
Definition at line 815 of file rename_impl.hh.
References DPRINTF.
|
private |
Returns the number of valid instructions coming from decode.
Definition at line 1198 of file rename_impl.hh.
References ArmISA::i.
|
private |
|
private |
|
private |
|
private |
Pointer to commit stage.
Used only for initialization.
Definition at line 169 of file rename.hh.
Referenced by DefaultRename< Impl >::setCommitStage().
|
private |
|
private |
|
private |
|
private |
|
private |
Delay between decode and rename, in ticks.
Definition at line 433 of file rename.hh.
Referenced by DefaultRename< Impl >::DefaultRename().
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Pointer to IEW stage.
Used only for initialization.
Definition at line 166 of file rename.hh.
Referenced by DefaultRename< Impl >::setIEWStage().
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Rename width, in instructions.
Definition at line 439 of file rename.hh.
Referenced by DefaultRename< Impl >::DefaultRename().
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
The maximum skid buffer size.
Definition at line 466 of file rename.hh.
Referenced by DefaultRename< Impl >::DefaultRename().
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |