gem5 v24.0.0.0
|
#include <loop_predictor.hh>
Classes | |
struct | BranchInfo |
struct | LoopEntry |
struct | LoopPredictorStats |
Public Member Functions | |
int | lindex (Addr pc_in, unsigned instShiftAmt) const |
Computes the index used to access the loop predictor. | |
int | finallindex (int lindex, int lowPcBits, int way) const |
Computes the index used to access the ltable structures. | |
bool | getLoop (Addr pc, BranchInfo *bi, bool speculative, unsigned instShiftAmt) const |
Get a branch prediction from the loop predictor. | |
void | loopUpdate (Addr pc, bool Taken, BranchInfo *bi, bool tage_pred) |
Updates the loop predictor. | |
void | specLoopUpdate (bool taken, BranchInfo *bi) |
Speculatively updates the loop predictor iteration count (only for useSpeculation). | |
void | condBranchUpdate (ThreadID tid, Addr branch_pc, bool taken, bool tage_pred, BranchInfo *bi, unsigned instShiftAmt) |
Update LTAGE for conditional branches. | |
bool | loopPredict (ThreadID tid, Addr branch_pc, bool cond_branch, BranchInfo *bi, bool prev_pred_taken, unsigned instShiftAmt) |
Get the loop prediction. | |
void | updateStats (bool taken, BranchInfo *bi) |
Update the stats. | |
void | squashLoop (BranchInfo *bi) |
void | squash (ThreadID tid, BranchInfo *bi) |
virtual bool | calcConf (int index) const |
virtual bool | optionalAgeInc () const |
virtual BranchInfo * | makeBranchInfo () |
int8_t | getLoopUseCounter () const |
Gets the value of the loop use counter. | |
void | init () override |
Initialize the loop predictor. | |
LoopPredictor (const LoopPredictorParams &p) | |
size_t | getSizeInBits () const |
Public Member Functions inherited from gem5::SimObject | |
const Params & | params () const |
SimObject (const Params &p) | |
virtual | ~SimObject () |
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 |
Static Protected Member Functions | |
static void | unsignedCtrUpdate (uint8_t &ctr, bool up, unsigned nbits) |
Updates an unsigned counter based on up/down parameter. | |
static void | signedCtrUpdate (int8_t &ctr, bool up, unsigned nbits) |
Protected Attributes | |
const unsigned | logSizeLoopPred |
const unsigned | loopTableAgeBits |
const unsigned | loopTableConfidenceBits |
const unsigned | loopTableTagBits |
const unsigned | loopTableIterBits |
const unsigned | logLoopTableAssoc |
const uint8_t | confidenceThreshold |
const uint16_t | loopTagMask |
const uint16_t | loopNumIterMask |
const int | loopSetMask |
LoopEntry * | ltable |
int8_t | loopUseCounter |
unsigned | withLoopBits |
const bool | useDirectionBit |
const bool | useSpeculation |
const bool | useHashing |
const bool | restrictAllocation |
const unsigned | initialLoopIter |
const unsigned | initialLoopAge |
const bool | optionalAgeReset |
gem5::branch_prediction::LoopPredictor::LoopPredictorStats | 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. | |
Additional Inherited Members | |
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 59 of file loop_predictor.hh.
gem5::branch_prediction::LoopPredictor::LoopPredictor | ( | const LoopPredictorParams & | p | ) |
Definition at line 59 of file loop_predictor.cc.
References initialLoopAge, and loopTableAgeBits.
|
virtual |
Reimplemented in gem5::branch_prediction::MPP_LoopPredictor, and gem5::branch_prediction::TAGE_SC_L_LoopPredictor.
Definition at line 168 of file loop_predictor.cc.
References gem5::branch_prediction::LoopPredictor::LoopEntry::confidence, confidenceThreshold, gem5::MipsISA::index, and ltable.
Referenced by gem5::branch_prediction::MPP_LoopPredictor::calcConf(), gem5::branch_prediction::TAGE_SC_L_LoopPredictor::calcConf(), and getLoop().
void gem5::branch_prediction::LoopPredictor::condBranchUpdate | ( | ThreadID | tid, |
Addr | branch_pc, | ||
bool | taken, | ||
bool | tage_pred, | ||
BranchInfo * | bi, | ||
unsigned | instShiftAmt ) |
Update LTAGE for conditional branches.
branch_pc | The unshifted branch PC. |
taken | Actual branch outcome. |
tage_pred | Prediction from TAGE |
bi | Pointer to information on the prediction recorded at prediction time. |
instShiftAmt | Number of bits to shift instructions |
Definition at line 346 of file loop_predictor.cc.
References gem5::PowerISA::bi, getLoop(), loopUpdate(), loopUseCounter, signedCtrUpdate(), useSpeculation, and withLoopBits.
Referenced by gem5::branch_prediction::LTAGE::update(), gem5::branch_prediction::MultiperspectivePerceptronTAGE::update(), and gem5::branch_prediction::TAGE_SC_L::update().
int gem5::branch_prediction::LoopPredictor::finallindex | ( | int | lindex, |
int | lowPcBits, | ||
int | way ) const |
Computes the index used to access the ltable structures.
It may take hashing into account
index | Result of lindex function |
lowPcBits | PC bits masked with set size |
way | Way to be used |
Definition at line 121 of file loop_predictor.cc.
References gem5::MipsISA::index, logLoopTableAssoc, and useHashing.
Referenced by getLoop(), loopUpdate(), specLoopUpdate(), squash(), and squashLoop().
bool gem5::branch_prediction::LoopPredictor::getLoop | ( | Addr | pc, |
BranchInfo * | bi, | ||
bool | speculative, | ||
unsigned | instShiftAmt ) const |
Get a branch prediction from the loop predictor.
pc | The unshifted branch PC. |
bi | Pointer to information on the prediction. |
speculative | Use speculative number of iterations |
instShiftAmt | Shift the pc by as many bits (if hashing is not used) |
Definition at line 130 of file loop_predictor.cc.
References gem5::PowerISA::bi, calcConf(), gem5::branch_prediction::LoopPredictor::LoopEntry::currentIter, gem5::branch_prediction::LoopPredictor::LoopEntry::currentIterSpec, gem5::branch_prediction::LoopPredictor::LoopEntry::dir, finallindex(), gem5::ArmISA::i, lindex(), logLoopTableAssoc, logSizeLoopPred, loopSetMask, loopTableTagBits, loopTagMask, ltable, gem5::MipsISA::pc, useDirectionBit, and useHashing.
Referenced by condBranchUpdate(), and loopPredict().
|
inline |
Gets the value of the loop use counter.
Definition at line 263 of file loop_predictor.hh.
References loopUseCounter.
Referenced by gem5::branch_prediction::LTAGE::predict().
size_t gem5::branch_prediction::LoopPredictor::getSizeInBits | ( | ) | const |
Definition at line 384 of file loop_predictor.cc.
References logSizeLoopPred, loopTableAgeBits, loopTableConfidenceBits, loopTableIterBits, loopTableTagBits, useDirectionBit, and useSpeculation.
Referenced by gem5::branch_prediction::MultiperspectivePerceptronTAGE::init().
|
overridevirtual |
Initialize the loop predictor.
Reimplemented from gem5::SimObject.
Definition at line 85 of file loop_predictor.cc.
References logLoopTableAssoc, logSizeLoopPred, loopTableIterBits, loopTableTagBits, and ltable.
int gem5::branch_prediction::LoopPredictor::lindex | ( | Addr | pc_in, |
unsigned | instShiftAmt ) const |
Computes the index used to access the loop predictor.
pc_in | The unshifted branch PC. |
instShiftAmt | Shift the pc by as many bits |
Definition at line 104 of file loop_predictor.cc.
References logLoopTableAssoc, loopSetMask, gem5::MipsISA::pc, and useHashing.
Referenced by getLoop().
bool gem5::branch_prediction::LoopPredictor::loopPredict | ( | ThreadID | tid, |
Addr | branch_pc, | ||
bool | cond_branch, | ||
BranchInfo * | bi, | ||
bool | prev_pred_taken, | ||
unsigned | instShiftAmt ) |
Get the loop prediction.
tid | The thread ID to select the global histories to use. |
branch_pc | The unshifted branch PC. |
cond_branch | True if the branch is conditional. |
bi | Reference to wrapping pointer to allow storing derived class prediction information in the base class. |
prev_pred_taken | Result of the TAGE prediction |
instShiftAmt | Shift the pc by as many bits |
instShiftAmt | Shift the pc by as many bits |
Definition at line 289 of file loop_predictor.cc.
References gem5::PowerISA::bi, getLoop(), loopUseCounter, specLoopUpdate(), and useSpeculation.
Referenced by gem5::branch_prediction::MultiperspectivePerceptronTAGE::lookup(), gem5::branch_prediction::LTAGE::predict(), and gem5::branch_prediction::TAGE_SC_L::predict().
void gem5::branch_prediction::LoopPredictor::loopUpdate | ( | Addr | pc, |
bool | Taken, | ||
BranchInfo * | bi, | ||
bool | tage_pred ) |
Updates the loop predictor.
pc | The unshifted branch PC. |
taken | The actual branch outcome. |
bi | Pointer to information on the prediction recorded at prediction time. |
tage_pred | tage prediction of the branch |
Definition at line 194 of file loop_predictor.cc.
References gem5::branch_prediction::LoopPredictor::LoopEntry::age, gem5::PowerISA::bi, gem5::branch_prediction::LoopPredictor::LoopEntry::confidence, gem5::branch_prediction::LoopPredictor::LoopEntry::currentIter, gem5::branch_prediction::LoopPredictor::LoopEntry::dir, DPRINTF, finallindex(), gem5::ArmISA::i, initialLoopAge, initialLoopIter, logLoopTableAssoc, loopNumIterMask, loopTableAgeBits, loopTableConfidenceBits, ltable, gem5::branch_prediction::LoopPredictor::LoopEntry::numIter, optionalAgeInc(), optionalAgeReset, gem5::MipsISA::pc, gem5::Random::random(), gem5::random_mt, restrictAllocation, gem5::branch_prediction::LoopPredictor::LoopEntry::tag, unsignedCtrUpdate(), and useDirectionBit.
Referenced by condBranchUpdate().
|
virtual |
Definition at line 98 of file loop_predictor.cc.
|
virtual |
Reimplemented in gem5::branch_prediction::MPP_LoopPredictor, and gem5::branch_prediction::TAGE_SC_L_LoopPredictor.
Definition at line 188 of file loop_predictor.cc.
Referenced by loopUpdate().
|
inlinestaticprotected |
Definition at line 128 of file loop_predictor.hh.
References gem5::ArmISA::up.
Referenced by condBranchUpdate().
void gem5::branch_prediction::LoopPredictor::specLoopUpdate | ( | bool | taken, |
BranchInfo * | bi ) |
Speculatively updates the loop predictor iteration count (only for useSpeculation).
taken | The predicted branch outcome. |
bi | Pointer to information on the prediction recorded at prediction time. |
Definition at line 174 of file loop_predictor.cc.
References gem5::PowerISA::bi, gem5::branch_prediction::LoopPredictor::LoopEntry::currentIterSpec, finallindex(), gem5::MipsISA::index, loopNumIterMask, and ltable.
Referenced by loopPredict().
void gem5::branch_prediction::LoopPredictor::squash | ( | ThreadID | tid, |
BranchInfo * | bi ) |
Definition at line 311 of file loop_predictor.cc.
References gem5::PowerISA::bi, gem5::branch_prediction::LoopPredictor::LoopEntry::currentIterSpec, finallindex(), and ltable.
Referenced by gem5::branch_prediction::LTAGE::squash().
void gem5::branch_prediction::LoopPredictor::squashLoop | ( | BranchInfo * | bi | ) |
Definition at line 322 of file loop_predictor.cc.
References gem5::PowerISA::bi, gem5::branch_prediction::LoopPredictor::LoopEntry::currentIterSpec, finallindex(), and ltable.
Referenced by gem5::branch_prediction::LTAGE::update(), gem5::branch_prediction::MultiperspectivePerceptronTAGE::update(), and gem5::branch_prediction::TAGE_SC_L::update().
|
inlinestaticprotected |
Updates an unsigned counter based on up/down parameter.
ctr | Reference to counter to update. |
up | Boolean indicating if the counter is incremented/decremented If true it is incremented, if false it is decremented |
nbits | Counter width. |
Definition at line 117 of file loop_predictor.hh.
References gem5::ArmISA::up.
Referenced by loopUpdate().
void gem5::branch_prediction::LoopPredictor::updateStats | ( | bool | taken, |
BranchInfo * | bi ) |
Update the stats.
taken | Actual branch outcome |
bi | Pointer to information on the prediction recorded at prediction time. |
Definition at line 333 of file loop_predictor.cc.
References gem5::PowerISA::bi, gem5::branch_prediction::LoopPredictor::LoopPredictorStats::correct, stats, gem5::branch_prediction::LoopPredictor::LoopPredictorStats::used, and gem5::branch_prediction::LoopPredictor::LoopPredictorStats::wrong.
Referenced by gem5::branch_prediction::LTAGE::update(), gem5::branch_prediction::MultiperspectivePerceptronTAGE::update(), and gem5::branch_prediction::TAGE_SC_L::update().
|
protected |
Definition at line 68 of file loop_predictor.hh.
Referenced by calcConf().
|
protected |
Definition at line 99 of file loop_predictor.hh.
Referenced by LoopPredictor(), and loopUpdate().
|
protected |
Definition at line 98 of file loop_predictor.hh.
Referenced by loopUpdate().
|
protected |
Definition at line 67 of file loop_predictor.hh.
Referenced by finallindex(), getLoop(), init(), lindex(), and loopUpdate().
|
protected |
Definition at line 62 of file loop_predictor.hh.
Referenced by getLoop(), getSizeInBits(), and init().
|
protected |
Definition at line 70 of file loop_predictor.hh.
Referenced by loopUpdate(), and specLoopUpdate().
|
protected |
Definition at line 71 of file loop_predictor.hh.
|
protected |
Definition at line 63 of file loop_predictor.hh.
Referenced by getSizeInBits(), LoopPredictor(), and loopUpdate().
|
protected |
Definition at line 64 of file loop_predictor.hh.
Referenced by getSizeInBits(), and loopUpdate().
|
protected |
Definition at line 66 of file loop_predictor.hh.
Referenced by getSizeInBits(), and init().
|
protected |
Definition at line 65 of file loop_predictor.hh.
Referenced by getLoop(), getSizeInBits(), and init().
|
protected |
Definition at line 69 of file loop_predictor.hh.
Referenced by getLoop().
|
protected |
Definition at line 91 of file loop_predictor.hh.
Referenced by condBranchUpdate(), getLoopUseCounter(), and loopPredict().
|
protected |
Definition at line 89 of file loop_predictor.hh.
Referenced by calcConf(), gem5::branch_prediction::MPP_LoopPredictor::calcConf(), gem5::branch_prediction::TAGE_SC_L_LoopPredictor::calcConf(), getLoop(), init(), loopUpdate(), specLoopUpdate(), squash(), and squashLoop().
|
protected |
Definition at line 100 of file loop_predictor.hh.
Referenced by loopUpdate().
|
protected |
Definition at line 97 of file loop_predictor.hh.
Referenced by loopUpdate().
|
protected |
Referenced by updateStats().
|
protected |
Definition at line 94 of file loop_predictor.hh.
Referenced by getLoop(), getSizeInBits(), and loopUpdate().
|
protected |
Definition at line 96 of file loop_predictor.hh.
Referenced by finallindex(), getLoop(), and lindex().
|
protected |
Definition at line 95 of file loop_predictor.hh.
Referenced by condBranchUpdate(), getSizeInBits(), and loopPredict().
|
protected |
Definition at line 92 of file loop_predictor.hh.
Referenced by condBranchUpdate().