gem5 v24.0.0.0
|
#include <simple_indirect.hh>
Classes | |
struct | HistoryEntry |
struct | IndirectHistory |
Indirect branch history information Used for prediction, update and recovery. More... | |
struct | IndirectStats |
struct | IPredEntry |
struct | ThreadInfo |
Per thread path and global history registers. More... | |
Public Member Functions | |
SimpleIndirectPredictor (const SimpleIndirectPredictorParams ¶ms) | |
void | reset () override |
Indirect predictor interface. | |
const PCStateBase * | lookup (ThreadID tid, InstSeqNum sn, Addr pc, void *&iHistory) override |
Predicts the indirect target of an indirect branch. | |
void | update (ThreadID tid, InstSeqNum sn, Addr pc, bool squash, bool taken, const PCStateBase &target, BranchType br_type, void *&iHistory) override |
Updates the indirect predictor with history information of a branch. | |
void | squash (ThreadID tid, InstSeqNum sn, void *&iHistory) override |
Squashes a branch. | |
void | commit (ThreadID tid, InstSeqNum sn, void *&iHistory) override |
A branch gets finally commited. | |
Public Member Functions inherited from gem5::branch_prediction::IndirectPredictor | |
IndirectPredictor (const Params ¶ms) | |
Public Member Functions inherited from gem5::SimObject | |
const Params & | params () const |
SimObject (const Params &p) | |
virtual | ~SimObject () |
virtual void | init () |
init() is called after all C++ SimObjects have been created and all ports are connected. | |
virtual void | loadState (CheckpointIn &cp) |
loadState() is called on each SimObject when restoring from a checkpoint. | |
virtual void | initState () |
initState() is called on each SimObject when not restoring from a checkpoint. | |
virtual void | regProbePoints () |
Register probe points for this object. | |
virtual void | regProbeListeners () |
Register probe listeners for this object. | |
ProbeManager * | getProbeManager () |
Get the probe manager for this object. | |
virtual Port & | getPort (const std::string &if_name, PortID idx=InvalidPortID) |
Get a port with a given name and index. | |
virtual void | startup () |
startup() is the final initialization call before simulation. | |
DrainState | drain () override |
Provide a default implementation of the drain interface for objects that don't need draining. | |
virtual void | memWriteback () |
Write back dirty buffers to memory using functional writes. | |
virtual void | memInvalidate () |
Invalidate the contents of memory buffers. | |
void | serialize (CheckpointOut &cp) const override |
Serialize an object. | |
void | unserialize (CheckpointIn &cp) override |
Unserialize an object. | |
Public Member Functions inherited from gem5::EventManager | |
EventQueue * | eventQueue () const |
void | schedule (Event &event, Tick when) |
void | deschedule (Event &event) |
void | reschedule (Event &event, Tick when, bool always=false) |
void | schedule (Event *event, Tick when) |
void | deschedule (Event *event) |
void | reschedule (Event *event, Tick when, bool always=false) |
void | wakeupEventQueue (Tick when=(Tick) -1) |
This function is not needed by the usual gem5 event loop but may be necessary in derived EventQueues which host gem5 on other schedulers. | |
void | setCurTick (Tick newVal) |
EventManager (EventManager &em) | |
Event manger manages events in the event queue. | |
EventManager (EventManager *em) | |
EventManager (EventQueue *eq) | |
Public Member Functions inherited from gem5::Serializable | |
Serializable () | |
virtual | ~Serializable () |
void | serializeSection (CheckpointOut &cp, const char *name) const |
Serialize an object into a new section. | |
void | serializeSection (CheckpointOut &cp, const std::string &name) const |
void | unserializeSection (CheckpointIn &cp, const char *name) |
Unserialize an a child object. | |
void | unserializeSection (CheckpointIn &cp, const std::string &name) |
Public Member Functions inherited from gem5::Drainable | |
DrainState | drainState () const |
Return the current drain state of an object. | |
virtual void | notifyFork () |
Notify a child process of a fork. | |
Public Member Functions inherited from gem5::statistics::Group | |
Group (Group *parent, const char *name=nullptr) | |
Construct a new statistics group. | |
virtual | ~Group () |
virtual void | regStats () |
Callback to set stat parameters. | |
virtual void | resetStats () |
Callback to reset stats. | |
virtual void | preDumpStats () |
Callback before stats are dumped. | |
void | addStat (statistics::Info *info) |
Register a stat with this group. | |
const std::map< std::string, Group * > & | getStatGroups () const |
Get all child groups associated with this object. | |
const std::vector< Info * > & | getStats () const |
Get all stats associated with this object. | |
void | addStatGroup (const char *name, Group *block) |
Add a stat block as a child of this block. | |
const Info * | resolveStat (std::string name) const |
Resolve a stat by its name within this group. | |
void | mergeStatGroup (Group *block) |
Merge the contents (stats & children) of a block to this block. | |
Group ()=delete | |
Group (const Group &)=delete | |
Group & | operator= (const Group &)=delete |
Public Member Functions inherited from gem5::Named | |
Named (const std::string &name_) | |
virtual | ~Named ()=default |
virtual std::string | name () const |
Protected Attributes | |
gem5::branch_prediction::SimpleIndirectPredictor::IndirectStats | stats |
Protected Attributes inherited from gem5::SimObject | |
const SimObjectParams & | _params |
Cached copy of the object parameters. | |
Protected Attributes inherited from gem5::EventManager | |
EventQueue * | eventq |
A pointer to this object's event queue. | |
Private Member Functions | |
bool | lookup (ThreadID tid, Addr br_addr, PCStateBase *&target, IndirectHistory *&history) |
void | recordTarget (ThreadID tid, InstSeqNum sn, const PCStateBase &target, IndirectHistory *&history) |
void | genIndirectInfo (ThreadID tid, void *&iHistory) |
void | updateDirectionInfo (ThreadID tid, bool taken, Addr pc, Addr target) |
Addr | getSetIndex (Addr br_addr, ThreadID tid) |
Addr | getTag (Addr br_addr) |
bool | isIndirectNoReturn (BranchType type) |
Private Attributes | |
const bool | hashGHR |
const bool | hashTargets |
const unsigned | numSets |
const unsigned | numWays |
const unsigned | tagBits |
const unsigned | pathLength |
const unsigned | speculativePathLength |
const unsigned | instShift |
const unsigned | ghrNumBits |
const unsigned | ghrMask |
std::vector< std::vector< IPredEntry > > | targetCache |
std::vector< ThreadInfo > | threadInfo |
Additional Inherited Members | |
Public Types inherited from gem5::branch_prediction::IndirectPredictor | |
typedef IndirectPredictorParams | Params |
Public Types inherited from gem5::SimObject | |
typedef SimObjectParams | Params |
Static Public Member Functions inherited from gem5::SimObject | |
static void | serializeAll (const std::string &cpt_dir) |
Create a checkpoint by serializing all SimObjects in the system. | |
static SimObject * | find (const char *name) |
Find the SimObject with the given name and return a pointer to it. | |
static void | setSimObjectResolver (SimObjectResolver *resolver) |
There is a single object name resolver, and it is only set when simulation is restoring from checkpoints. | |
static SimObjectResolver * | getSimObjectResolver () |
There is a single object name resolver, and it is only set when simulation is restoring from checkpoints. | |
Static Public Member Functions inherited from gem5::Serializable | |
static const std::string & | currentSection () |
Gets the fully-qualified name of the active section. | |
static void | generateCheckpointOut (const std::string &cpt_dir, std::ofstream &outstream) |
Generate a checkpoint file so that the serialization can be routed to it. | |
Protected Member Functions inherited from gem5::Drainable | |
Drainable () | |
virtual | ~Drainable () |
virtual void | drainResume () |
Resume execution after a successful drain. | |
void | signalDrainDone () const |
Signal that an object is drained. | |
Definition at line 55 of file simple_indirect.hh.
gem5::branch_prediction::SimpleIndirectPredictor::SimpleIndirectPredictor | ( | const SimpleIndirectPredictorParams & | params | ) |
Definition at line 50 of file simple_indirect.cc.
References fatal_if, gem5::branch_prediction::SimpleIndirectPredictor::ThreadInfo::ghr, ghrNumBits, gem5::ArmISA::i, gem5::isPowerOf2(), numSets, numWays, panic, gem5::SimObject::params(), targetCache, and threadInfo.
|
overridevirtual |
A branch gets finally commited.
Updates the internal state of the indirect predictor (counter and target information).
tid | Thread ID |
sn | The sequence number of the branch. |
i_history | The pointer to the history object. |
Delete histories if the history grows to much
Implements gem5::branch_prediction::IndirectPredictor.
Definition at line 176 of file simple_indirect.cc.
References DPRINTF, gem5::branch_prediction::SimpleIndirectPredictor::IndirectHistory::ghr, gem5::branch_prediction::SimpleIndirectPredictor::IndirectHistory::pathHist, pathLength, gem5::branch_prediction::SimpleIndirectPredictor::IndirectHistory::pcAddr, speculativePathLength, and threadInfo.
|
private |
Definition at line 99 of file simple_indirect.cc.
References gem5::branch_prediction::SimpleIndirectPredictor::IndirectHistory::ghr, and threadInfo.
|
inlineprivate |
Definition at line 354 of file simple_indirect.cc.
References gem5::floorLog2(), hashGHR, hashTargets, gem5::ArmISA::i, instShift, numSets, gem5::MipsISA::p, pathLength, and threadInfo.
|
inlineprivate |
Definition at line 161 of file simple_indirect.hh.
References gem5::X86ISA::type.
Referenced by update().
|
private |
Definition at line 141 of file simple_indirect.cc.
References DPRINTF, getSetIndex(), getTag(), gem5::branch_prediction::SimpleIndirectPredictor::IndirectHistory::ghr, gem5::branch_prediction::SimpleIndirectPredictor::IndirectHistory::hit, gem5::branch_prediction::SimpleIndirectPredictor::IndirectStats::hits, gem5::branch_prediction::SimpleIndirectPredictor::IndirectStats::lookups, gem5::branch_prediction::SimpleIndirectPredictor::IndirectStats::misses, numSets, gem5::branch_prediction::SimpleIndirectPredictor::IndirectHistory::pcAddr, gem5::ArmISA::set, gem5::branch_prediction::SimpleIndirectPredictor::IndirectHistory::set_index, stats, gem5::branch_prediction::SimpleIndirectPredictor::IndirectHistory::tag, targetCache, and threadInfo.
|
overridevirtual |
Predicts the indirect target of an indirect branch.
tid | Thread ID of the branch. |
sn | The sequence number of the branch. |
pc | The branch PC address. |
i_history | The pointer to the history object. |
Do the prediction for indirect branches (no returns)
Implements gem5::branch_prediction::IndirectPredictor.
Definition at line 123 of file simple_indirect.cc.
References genIndirectInfo(), gem5::branch_prediction::SimpleIndirectPredictor::IndirectHistory::hit, lookup(), gem5::MipsISA::pc, gem5::branch_prediction::SimpleIndirectPredictor::IndirectHistory::pcAddr, and gem5::branch_prediction::SimpleIndirectPredictor::IndirectHistory::was_indirect.
Referenced by lookup().
|
private |
Definition at line 307 of file simple_indirect.cc.
References DPRINTF, gem5::branch_prediction::SimpleIndirectPredictor::IndirectHistory::ghr, gem5::PCStateBase::instAddr(), numSets, numWays, gem5::branch_prediction::SimpleIndirectPredictor::IndirectHistory::pcAddr, gem5::ArmISA::set, gem5::branch_prediction::SimpleIndirectPredictor::IndirectHistory::set_index, stats, gem5::branch_prediction::SimpleIndirectPredictor::IndirectHistory::tag, targetCache, gem5::branch_prediction::SimpleIndirectPredictor::IndirectStats::targetRecords, threadInfo, and gem5::branch_prediction::SimpleIndirectPredictor::IndirectHistory::was_indirect.
Referenced by update().
|
overridevirtual |
Indirect predictor interface.
Reimplemented from gem5::branch_prediction::IndirectPredictor.
Definition at line 81 of file simple_indirect.cc.
References DPRINTF, gem5::ArmISA::i, numSets, numWays, targetCache, threadInfo, and gem5::MipsISA::ti.
|
overridevirtual |
Squashes a branch.
If the branch modified the history reverts the modification.
tid | Thread ID |
sn | The sequence number of the branch. |
i_history | The pointer to the history object. |
Implements gem5::branch_prediction::IndirectPredictor.
Definition at line 263 of file simple_indirect.cc.
References DPRINTF, gem5::branch_prediction::SimpleIndirectPredictor::IndirectHistory::ghr, pathLength, gem5::branch_prediction::SimpleIndirectPredictor::IndirectHistory::pcAddr, gem5::branch_prediction::SimpleIndirectPredictor::IndirectStats::speculativeOverflows, stats, threadInfo, and gem5::branch_prediction::SimpleIndirectPredictor::IndirectHistory::was_indirect.
Referenced by update().
|
overridevirtual |
Updates the indirect predictor with history information of a branch.
Is called right after the prediction which updates the state speculatively. In case the branch was mispredicted the function is called again with the corrected information. The function is called for ALL branches as some predictors incooperate all branches in their history.
tid | Thread ID |
sn | The sequence number of the branch. |
pc | The branch PC address. |
squash | Whether the update is called at a misprediction |
taken | Whether a conditional branch was taken |
target | The target address if this branch. |
br_type | The branch instruction type. |
i_history | The pointer to the history object. |
If update was called during squash we need to fix the indirect path history and the global path history. We restore the state before this branch incorrectly updated it and perform the update afterwards again.
restore global history
For indirect branches recalculate index and tag
Implements gem5::branch_prediction::IndirectPredictor.
Definition at line 198 of file simple_indirect.cc.
References DPRINTF, genIndirectInfo(), getSetIndex(), getTag(), gem5::branch_prediction::SimpleIndirectPredictor::IndirectHistory::ghr, gem5::branch_prediction::SimpleIndirectPredictor::IndirectStats::indirectRecords, gem5::PCStateBase::instAddr(), isIndirectNoReturn(), gem5::MipsISA::pc, gem5::branch_prediction::SimpleIndirectPredictor::IndirectHistory::pcAddr, recordTarget(), gem5::branch_prediction::SimpleIndirectPredictor::IndirectHistory::set_index, squash(), stats, gem5::branch_prediction::SimpleIndirectPredictor::IndirectHistory::tag, threadInfo, updateDirectionInfo(), and gem5::branch_prediction::SimpleIndirectPredictor::IndirectHistory::was_indirect.
|
private |
Definition at line 110 of file simple_indirect.cc.
References ghrMask, and threadInfo.
Referenced by update().
|
private |
Definition at line 87 of file simple_indirect.hh.
Referenced by updateDirectionInfo().
|
private |
Definition at line 86 of file simple_indirect.hh.
Referenced by SimpleIndirectPredictor().
|
private |
|
private |
Definition at line 79 of file simple_indirect.hh.
Referenced by getSetIndex().
|
private |
Definition at line 85 of file simple_indirect.hh.
Referenced by getSetIndex(), and getTag().
|
private |
Definition at line 80 of file simple_indirect.hh.
Referenced by getSetIndex(), lookup(), recordTarget(), reset(), and SimpleIndirectPredictor().
|
private |
Definition at line 81 of file simple_indirect.hh.
Referenced by recordTarget(), reset(), and SimpleIndirectPredictor().
|
private |
Definition at line 83 of file simple_indirect.hh.
Referenced by commit(), getSetIndex(), and squash().
|
private |
Definition at line 84 of file simple_indirect.hh.
Referenced by commit().
|
protected |
Referenced by lookup(), recordTarget(), squash(), and update().
|
private |
Definition at line 82 of file simple_indirect.hh.
Referenced by getTag().
|
private |
Definition at line 95 of file simple_indirect.hh.
Referenced by lookup(), recordTarget(), reset(), and SimpleIndirectPredictor().
|
private |
Definition at line 143 of file simple_indirect.hh.
Referenced by commit(), genIndirectInfo(), getSetIndex(), lookup(), recordTarget(), reset(), SimpleIndirectPredictor(), squash(), update(), and updateDirectionInfo().