|
gem5 [DEVELOP-FOR-25.0]
|
#include <tage_base.hh>
Classes | |
| struct | BranchInfo |
| struct | FoldedHistory |
| struct | TAGEBaseStats |
| struct | TageEntry |
| struct | ThreadHistory |
Public Types | |
| enum | { BIMODAL_ONLY = 0 , TAGE_LONGEST_MATCH , BIMODAL_ALT_MATCH , TAGE_ALT_MATCH , LAST_TAGE_PROVIDER_TYPE = TAGE_ALT_MATCH } |
Public Types inherited from gem5::SimObject | |
| typedef SimObjectParams | Params |
Public Member Functions | |
| TAGEBase (const TAGEBaseParams &p) | |
| void | init () override |
| init() is called after all C++ SimObjects have been created and all ports are connected. | |
| virtual BranchInfo * | makeBranchInfo (Addr pc, bool conditional) |
| virtual int | bindex (Addr pc_in) const |
| Computes the index used to access the bimodal table. | |
| virtual int | gindex (ThreadID tid, Addr pc, int bank) const |
| Computes the index used to access a partially tagged table. | |
| virtual int | F (int phist, int size, int bank) const |
| Utility function to shuffle the path history depending on which tagged table we are accessing. | |
| virtual uint16_t | gtag (ThreadID tid, Addr pc, int bank) const |
| Computes the partial tag of a tagged table. | |
| virtual bool | getBimodePred (Addr pc, BranchInfo *bi) const |
| Get a branch prediction from the bimodal predictor. | |
| void | baseUpdate (Addr pc, bool taken, BranchInfo *bi) |
| Updates the bimodal predictor. | |
| void | updateGHist (ThreadID tid, uint64_t bv, uint8_t n) |
| Internal history update function. | |
| void | update (ThreadID tid, Addr branch_pc, bool taken, BranchInfo *bi) |
| Update TAGE. | |
| virtual void | updateHistories (ThreadID tid, Addr branch_pc, bool speculative, bool taken, Addr target, const StaticInstPtr &inst, BranchInfo *bi) |
| (Speculatively) updates global histories (path and direction). | |
| void | recordHistState (ThreadID tid, BranchInfo *bi) |
| Records the current state of the histories to be able to restore it in case of a mispredicted speculative update. | |
| void | restoreHistState (ThreadID tid, BranchInfo *bi) |
| Restore the state of the histories in case of detecting a mispredicted speculative update. | |
| virtual void | updatePathAndGlobalHistory (ThreadID tid, int brtype, bool taken, Addr branch_pc, Addr target, BranchInfo *bi) |
| Does the actual update of path and global history. | |
| virtual int | branchTypeExtra (const StaticInstPtr &inst) |
| This function acts as a hook for other TAGE implementations to adjust the branch type. | |
| virtual void | squash (ThreadID tid, bool taken, Addr target, const StaticInstPtr &inst, BranchInfo *bi) |
| Restores speculatively updated path and direction histories. | |
| virtual void | condBranchUpdate (ThreadID tid, Addr branch_pc, bool taken, BranchInfo *bi, int nrand, Addr corrTarget, bool pred, bool preAdjustAlloc=false) |
| Update TAGE for conditional branches. | |
| bool | tagePredict (ThreadID tid, Addr branch_pc, bool cond_branch, BranchInfo *bi) |
| TAGE prediction called from TAGE::predict. | |
| virtual void | updateStats (bool taken, BranchInfo *bi) |
| Update the stats. | |
| virtual void | buildTageTables () |
| Instantiates the TAGE table entries. | |
| virtual void | calculateParameters () |
| Calculates the history lengths and some other paramters in derived classes. | |
| virtual void | calculateIndicesAndTags (ThreadID tid, Addr branch_pc, BranchInfo *bi) |
| On a prediction, calculates the TAGE indices and tags for all the different history lengths. | |
| virtual unsigned | getUseAltIdx (BranchInfo *bi, Addr branch_pc) |
| Calculation of the index for useAltPredForNewlyAllocated On this base TAGE implementation it is always 0. | |
| virtual void | adjustAlloc (bool &alloc, bool taken, bool pred_taken) |
| Extra calculation to tell whether TAGE allocaitons may happen or not on an update For this base TAGE implementation it does nothing. | |
| virtual void | handleAllocAndUReset (bool alloc, bool taken, BranchInfo *bi, int nrand) |
| Handles Allocation and U bits reset on an update. | |
| virtual void | handleUReset () |
| Handles the U bits reset. | |
| virtual void | handleTAGEUpdate (Addr branch_pc, bool taken, BranchInfo *bi) |
| Handles the update of the TAGE entries. | |
| virtual void | resetUctr (uint8_t &u) |
| Algorithm for resetting a single U counter. | |
| virtual void | extraAltCalc (BranchInfo *bi) |
| Extra steps for calculating altTaken For this base TAGE class it does nothing. | |
| virtual bool | isHighConfidence (BranchInfo *bi) const |
| unsigned | getGHR (ThreadID tid) const |
| int8_t | getCtr (int hitBank, int hitBankIndex) const |
| unsigned | getTageCtrBits () const |
| int | getPathHist (ThreadID tid, bool speculative=true) const |
| int | calcNewPathHist (ThreadID tid, Addr pc, int cur_phist) const |
| bool | isSpeculativeUpdateEnabled () const |
| 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 (std::string_view name_) | |
| virtual | ~Named ()=default |
| virtual std::string | name () const |
Static Public Member Functions | |
| template<typename T> | |
| static void | ctrUpdate (T &ctr, bool taken, int nbits) |
| Updates a direction counter based on the actual branch outcome. | |
| static void | unsignedCtrUpdate (uint8_t &ctr, bool up, unsigned nbits) |
| Updates an unsigned counter based on up/down parameter. | |
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 | |
| virtual void | initFoldedHistories (ThreadHistory &history) |
| Initialization of the folded histories. | |
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 66 of file tage_base.hh.
| anonymous enum |
| Enumerator | |
|---|---|
| BIMODAL_ONLY | |
| TAGE_LONGEST_MATCH | |
| BIMODAL_ALT_MATCH | |
| TAGE_ALT_MATCH | |
| LAST_TAGE_PROVIDER_TYPE | |
Definition at line 126 of file tage_base.hh.
| gem5::branch_prediction::TAGEBase::TAGEBase | ( | const TAGEBaseParams & | p | ) |
Definition at line 52 of file tage_base.cc.
References histBufferSize, initialized, initialTCounterValue, instShiftAmt, logRatioBiModalHystEntries, logTagTableSizes, logUResetPeriod, maxHist, maxNumAlloc, minHist, nHistoryTables, noSkip, numUseAltOnNa, gem5::MipsISA::p, pathHistBits, gem5::SimObject::SimObject(), speculativeHistUpdate, stats, tagTableCounterBits, tagTableTagWidths, tagTableUBits, threadHistory, and useAltOnNaBits.
Referenced by gem5::branch_prediction::MPP_TAGE::BranchInfo::BranchInfo(), gem5::branch_prediction::TAGE_SC_L_TAGE::BranchInfo::BranchInfo(), gem5::branch_prediction::TAGEBase::BranchInfo::BranchInfo(), gem5::branch_prediction::MPP_TAGE::MPP_TAGE(), and gem5::branch_prediction::TAGE_SC_L_TAGE::TAGE_SC_L_TAGE().
|
virtual |
Extra calculation to tell whether TAGE allocaitons may happen or not on an update For this base TAGE implementation it does nothing.
Reimplemented in gem5::branch_prediction::MPP_TAGE, and gem5::branch_prediction::TAGE_SC_L_TAGE.
Definition at line 440 of file tage_base.cc.
Referenced by condBranchUpdate().
| void gem5::branch_prediction::TAGEBase::baseUpdate | ( | Addr | pc, |
| bool | taken, | ||
| BranchInfo * | bi ) |
Updates the bimodal predictor.
| pc | The unshifted branch PC. |
| taken | The actual branch outcome. |
| bi | Pointer to information on the prediction recorded at prediction time. |
Definition at line 285 of file tage_base.cc.
References gem5::PowerISA::bi, btableHysteresis, btablePrediction, DPRINTF, logRatioBiModalHystEntries, gem5::MipsISA::pc, and gem5::RiscvISA::pred.
Referenced by gem5::branch_prediction::MPP_TAGE::handleTAGEUpdate(), gem5::branch_prediction::TAGE_SC_L_TAGE_64KB::handleTAGEUpdate(), gem5::branch_prediction::TAGE_SC_L_TAGE_8KB::handleTAGEUpdate(), and handleTAGEUpdate().
|
virtual |
Computes the index used to access the bimodal table.
| pc_in | The unshifted branch PC. |
Reimplemented in gem5::branch_prediction::MPP_TAGE, and gem5::branch_prediction::TAGE_SC_L_TAGE.
Definition at line 190 of file tage_base.cc.
References instShiftAmt, and logTagTableSizes.
Referenced by tagePredict().
|
inlinevirtual |
This function acts as a hook for other TAGE implementations to adjust the branch type.
Reimplemented in gem5::branch_prediction::TAGE_SC_L_TAGE.
Definition at line 357 of file tage_base.hh.
Referenced by updateHistories().
|
virtual |
Instantiates the TAGE table entries.
Reimplemented in gem5::branch_prediction::TAGE_SC_L_TAGE.
Definition at line 168 of file tage_base.cc.
References gtable, gem5::ArmISA::i, logTagTableSizes, and nHistoryTables.
Referenced by init().
| int gem5::branch_prediction::TAGEBase::calcNewPathHist | ( | ThreadID | tid, |
| Addr | pc, | ||
| int | cur_phist ) const |
Definition at line 711 of file tage_base.cc.
References instShiftAmt, pathHistBits, and gem5::MipsISA::pc.
Referenced by updateHistories(), and updatePathAndGlobalHistory().
|
virtual |
On a prediction, calculates the TAGE indices and tags for all the different history lengths.
Reimplemented in gem5::branch_prediction::TAGE_SC_L_TAGE.
Definition at line 344 of file tage_base.cc.
References gem5::PowerISA::bi, gindex(), gtag(), gem5::ArmISA::i, nHistoryTables, tableIndices, and tableTags.
Referenced by tagePredict(), and updateHistories().
|
virtual |
Calculates the history lengths and some other paramters in derived classes.
Reimplemented in gem5::branch_prediction::MPP_TAGE, and gem5::branch_prediction::TAGE_SC_L_TAGE.
Definition at line 176 of file tage_base.cc.
References histLengths, gem5::ArmISA::i, maxHist, minHist, and nHistoryTables.
Referenced by init().
|
virtual |
Update TAGE for conditional branches.
| branch_pc | The unshifted branch PC. |
| taken | Actual branch outcome. |
| bi | Pointer to information on the prediction recorded at prediction time. @nrand Random int number from 0 to 3 |
| corrTarget | The correct branch target |
| pred | Final prediction for this branch |
| preAdjustAlloc | call adjustAlloc before checking pseudo newly allocated entries |
Definition at line 516 of file tage_base.cc.
References adjustAlloc(), gem5::PowerISA::bi, ctrUpdate(), getUseAltIdx(), handleAllocAndUReset(), handleTAGEUpdate(), nHistoryTables, gem5::RiscvISA::pred, useAltOnNaBits, and useAltPredForNewlyAllocated.
|
static |
Updates a direction counter based on the actual branch outcome.
| ctr | Reference to counter to update. |
| taken | Actual branch outcome. |
| nbits | Counter width. |
Definition at line 244 of file tage_base.cc.
Referenced by condBranchUpdate(), gem5::branch_prediction::MPP_TAGE::handleTAGEUpdate(), gem5::branch_prediction::TAGE_SC_L_TAGE_64KB::handleTAGEUpdate(), gem5::branch_prediction::TAGE_SC_L_TAGE_8KB::handleTAGEUpdate(), and handleTAGEUpdate().
|
virtual |
Extra steps for calculating altTaken For this base TAGE class it does nothing.
Reimplemented in gem5::branch_prediction::TAGE_SC_L_TAGE.
Definition at line 727 of file tage_base.cc.
References gem5::PowerISA::bi.
Referenced by tagePredict().
|
virtual |
Utility function to shuffle the path history depending on which tagged table we are accessing.
| phist | The path history. |
| size | Number of path history bits to use. |
| bank | The partially tagged table to access. |
Reimplemented in gem5::branch_prediction::TAGE_SC_L_TAGE.
Definition at line 196 of file tage_base.cc.
References logTagTableSizes.
Referenced by gindex().
|
virtual |
Get a branch prediction from the bimodal predictor.
| pc | The unshifted branch PC. |
| bi | Pointer to information on the prediction. |
Reimplemented in gem5::branch_prediction::TAGE_SC_L_TAGE.
Definition at line 276 of file tage_base.cc.
References gem5::PowerISA::bi, btablePrediction, and gem5::MipsISA::pc.
Referenced by gem5::branch_prediction::TAGE_SC_L_TAGE::getBimodePred(), and tagePredict().
| int8_t gem5::branch_prediction::TAGEBase::getCtr | ( | int | hitBank, |
| int | hitBankIndex ) const |
Definition at line 840 of file tage_base.cc.
References gtable.
| unsigned gem5::branch_prediction::TAGEBase::getGHR | ( | ThreadID | tid | ) | const |
Definition at line 783 of file tage_base.cc.
References histBufferSize, gem5::ArmISA::i, threadHistory, and gem5::X86ISA::val.
| int gem5::branch_prediction::TAGEBase::getPathHist | ( | ThreadID | tid, |
| bool | speculative = true ) const |
Definition at line 852 of file tage_base.cc.
References threadHistory.
| size_t gem5::branch_prediction::TAGEBase::getSizeInBits | ( | ) | const |
Definition at line 865 of file tage_base.cc.
References gem5::bits(), histLengths, gem5::ArmISA::i, logRatioBiModalHystEntries, logTagTableSizes, logUResetPeriod, nHistoryTables, numUseAltOnNa, pathHistBits, tagTableCounterBits, tagTableTagWidths, tagTableUBits, and useAltOnNaBits.
| unsigned gem5::branch_prediction::TAGEBase::getTageCtrBits | ( | ) | const |
Definition at line 846 of file tage_base.cc.
References tagTableCounterBits.
|
virtual |
Calculation of the index for useAltPredForNewlyAllocated On this base TAGE implementation it is always 0.
Reimplemented in gem5::branch_prediction::MPP_TAGE, and gem5::branch_prediction::TAGE_SC_L_TAGE.
Definition at line 358 of file tage_base.cc.
References gem5::PowerISA::bi.
Referenced by condBranchUpdate(), and tagePredict().
Computes the index used to access a partially tagged table.
| tid | The thread ID used to select the global histories to use. |
| pc | The unshifted branch PC. |
| bank | The partially tagged table to access. |
Reimplemented in gem5::branch_prediction::TAGE_SC_L_TAGE.
Definition at line 213 of file tage_base.cc.
References F(), histLengths, gem5::MipsISA::index, instShiftAmt, logTagTableSizes, pathHistBits, gem5::MipsISA::pc, and threadHistory.
Referenced by calculateIndicesAndTags().
Computes the partial tag of a tagged table.
| tid | the thread ID used to select the global histories to use. |
| pc | The unshifted branch PC. |
| bank | The partially tagged table to access. |
Reimplemented in gem5::branch_prediction::TAGE_SC_L_TAGE, gem5::branch_prediction::TAGE_SC_L_TAGE_64KB, and gem5::branch_prediction::TAGE_SC_L_TAGE_8KB.
Definition at line 231 of file tage_base.cc.
References instShiftAmt, gem5::MipsISA::pc, tagTableTagWidths, and threadHistory.
Referenced by calculateIndicesAndTags().
|
virtual |
Handles Allocation and U bits reset on an update.
Reimplemented in gem5::branch_prediction::MPP_TAGE, gem5::branch_prediction::TAGE_SC_L_TAGE, gem5::branch_prediction::TAGE_SC_L_TAGE_64KB, and gem5::branch_prediction::TAGE_SC_L_TAGE_8KB.
Definition at line 446 of file tage_base.cc.
References gem5::PowerISA::bi, gtable, handleUReset(), gem5::ArmISA::i, maxNumAlloc, nHistoryTables, tCounter, and gem5::X86ISA::X.
Referenced by condBranchUpdate().
|
virtual |
Handles the update of the TAGE entries.
Reimplemented in gem5::branch_prediction::MPP_TAGE, gem5::branch_prediction::TAGE_SC_L_TAGE, gem5::branch_prediction::TAGE_SC_L_TAGE_64KB, and gem5::branch_prediction::TAGE_SC_L_TAGE_8KB.
Definition at line 557 of file tage_base.cc.
References baseUpdate(), gem5::PowerISA::bi, ctrUpdate(), DPRINTF, gtable, tagTableCounterBits, tagTableUBits, and unsignedCtrUpdate().
Referenced by condBranchUpdate().
|
virtual |
Handles the U bits reset.
Reimplemented in gem5::branch_prediction::MPP_TAGE, and gem5::branch_prediction::TAGE_SC_L_TAGE.
Definition at line 495 of file tage_base.cc.
References gtable, gem5::ArmISA::i, logTagTableSizes, logUResetPeriod, nHistoryTables, resetUctr(), tCounter, and gem5::ArmISA::u.
Referenced by handleAllocAndUReset().
|
overridevirtual |
init() is called after all C++ SimObjects have been created and all ports are connected.
Initializations that are independent of unserialization but rely on a fully instantiated and connected SimObject graph should be done here.
Reimplemented from gem5::SimObject.
Definition at line 88 of file tage_base.cc.
References btableHysteresis, btablePrediction, buildTageTables(), calculateParameters(), gtable, histBufferSize, histLengths, initFoldedHistories(), initialized, initialTCounterValue, logRatioBiModalHystEntries, logTagTableSizes, logUResetPeriod, maxHist, nHistoryTables, numUseAltOnNa, pathHistBits, tableIndices, tableTags, tagTableTagWidths, tagTableUBits, tCounter, threadHistory, and useAltPredForNewlyAllocated.
|
protectedvirtual |
Initialization of the folded histories.
Reimplemented in gem5::branch_prediction::TAGE_SC_L_TAGE_8KB.
Definition at line 153 of file tage_base.cc.
References gem5::branch_prediction::TAGEBase::ThreadHistory::computeIndices, gem5::branch_prediction::TAGEBase::ThreadHistory::computeTags, DPRINTF, histLengths, gem5::ArmISA::i, gem5::branch_prediction::TAGEBase::FoldedHistory::init(), logTagTableSizes, nHistoryTables, gem5::branch_prediction::TAGEBase::FoldedHistory::origLength, and tagTableTagWidths.
Referenced by init().
|
inlinevirtual |
Reimplemented in gem5::branch_prediction::MPP_TAGE.
Definition at line 470 of file tage_base.hh.
References gem5::PowerISA::bi.
| bool gem5::branch_prediction::TAGEBase::isSpeculativeUpdateEnabled | ( | ) | const |
Definition at line 859 of file tage_base.cc.
References speculativeHistUpdate.
|
virtual |
Reimplemented in gem5::branch_prediction::TAGE_SC_L_TAGE.
Definition at line 83 of file tage_base.cc.
References gem5::MipsISA::pc.
| void gem5::branch_prediction::TAGEBase::recordHistState | ( | ThreadID | tid, |
| BranchInfo * | bi ) |
Records the current state of the histories to be able to restore it in case of a mispredicted speculative update.
| tid | The thread ID to select the histories to record. |
| bi | Pointer to the branch associated with the state |
Definition at line 663 of file tage_base.cc.
References gem5::PowerISA::bi, gem5::branch_prediction::TAGEBase::FoldedHistory::comp, gem5::branch_prediction::TAGEBase::ThreadHistory::computeIndices, gem5::branch_prediction::TAGEBase::ThreadHistory::computeTags, gem5::ArmISA::i, nHistoryTables, gem5::branch_prediction::TAGEBase::ThreadHistory::pathHist, gem5::branch_prediction::TAGEBase::ThreadHistory::ptGhist, and threadHistory.
Referenced by updateHistories().
|
virtual |
Algorithm for resetting a single U counter.
Reimplemented in gem5::branch_prediction::MPP_TAGE, and gem5::branch_prediction::TAGE_SC_L_TAGE_8KB.
Definition at line 510 of file tage_base.cc.
References gem5::ArmISA::u.
Referenced by gem5::branch_prediction::TAGE_SC_L_TAGE::handleUReset(), and handleUReset().
| void gem5::branch_prediction::TAGEBase::restoreHistState | ( | ThreadID | tid, |
| BranchInfo * | bi ) |
Restore the state of the histories in case of detecting a mispredicted speculative update.
| tid | The thread ID to select the histories to restore. |
| bi | Pointer to the branch associated with the state |
Definition at line 677 of file tage_base.cc.
References gem5::PowerISA::bi, gem5::branch_prediction::TAGEBase::ThreadHistory::computeIndices, gem5::branch_prediction::TAGEBase::ThreadHistory::computeTags, gem5::branch_prediction::TAGEBase::ThreadHistory::gHist, gem5::ArmISA::i, gem5::ArmISA::n, nHistoryTables, gem5::branch_prediction::TAGEBase::ThreadHistory::pathHist, gem5::branch_prediction::TAGEBase::ThreadHistory::ptGhist, gem5::branch_prediction::TAGEBase::FoldedHistory::restore(), speculativeHistUpdate, and threadHistory.
Referenced by updateHistories().
|
virtual |
Restores speculatively updated path and direction histories.
Also recomputes compressed (folded) histories based on the correct branch outcome. This version of squash() is called once on a branch misprediction.
| tid | The Thread ID to select the histories to rollback. |
| taken | The correct branch outcome. |
| target | The correct branch target |
| inst | The branch instruction. |
| bi | Wrapping pointer to BranchInfo (to allow storing derived class prediction information in the base class). |
Definition at line 720 of file tage_base.cc.
References gem5::PowerISA::bi, and updateHistories().
| bool gem5::branch_prediction::TAGEBase::tagePredict | ( | ThreadID | tid, |
| Addr | branch_pc, | ||
| bool | cond_branch, | ||
| BranchInfo * | bi ) |
TAGE prediction called from TAGE::predict.
| 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 | Pointer to the BranchInfo |
Definition at line 365 of file tage_base.cc.
References gem5::PowerISA::bi, BIMODAL_ALT_MATCH, BIMODAL_ONLY, bindex(), calculateIndicesAndTags(), DPRINTF, extraAltCalc(), getBimodePred(), getUseAltIdx(), gtable, gem5::ArmISA::i, nHistoryTables, noSkip, tableIndices, tableTags, TAGE_ALT_MATCH, TAGE_LONGEST_MATCH, and useAltPredForNewlyAllocated.
|
static |
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 262 of file tage_base.cc.
References gem5::ArmISA::up.
Referenced by handleTAGEUpdate().
| void gem5::branch_prediction::TAGEBase::update | ( | ThreadID | tid, |
| Addr | branch_pc, | ||
| bool | taken, | ||
| BranchInfo * | bi ) |
Update TAGE.
Called at execute to repair histories on a misprediction and at commit to update the tables.
| tid | The thread ID to select the global histories to use. |
| branch_pc | The unshifted branch PC. |
| taken | Actual branch outcome. |
| bi | Pointer to information on the prediction recorded at prediction time. |
References gem5::PowerISA::bi.
| void gem5::branch_prediction::TAGEBase::updateGHist | ( | ThreadID | tid, |
| uint64_t | bv, | ||
| uint8_t | n ) |
Internal history update function.
This function shifts nBits into the global history vector. If the update is speculative the functions makes a copy of the GHR to rollback.
| tid | The thread ID to select the histories to update. |
| bv | The bit vector with n bits that will be shifted into the global history vector. |
| n | The number of bits to be updated |
Definition at line 305 of file tage_base.cc.
References gem5::branch_prediction::TAGEBase::ThreadHistory::computeIndices, gem5::branch_prediction::TAGEBase::ThreadHistory::computeTags, DPRINTF, gem5::branch_prediction::TAGEBase::ThreadHistory::gHist, gem5::branch_prediction::TAGEBase::ThreadHistory::globalHistory, histBufferSize, gem5::ArmISA::i, maxHist, gem5::ArmISA::n, nHistoryTables, gem5::branch_prediction::TAGEBase::ThreadHistory::ptGhist, threadHistory, and gem5::branch_prediction::TAGEBase::FoldedHistory::update().
Referenced by gem5::branch_prediction::MPP_TAGE::updateHistories(), gem5::branch_prediction::TAGE_SC_L_TAGE::updatePathAndGlobalHistory(), and updatePathAndGlobalHistory().
|
virtual |
(Speculatively) updates global histories (path and direction).
It manages squashing of histories in case of a mispredicted. In that case it also recomputes compressed (folded) histories based on the squashed state
| tid | The thread ID to select the histories to update. |
| branch_pc | The unshifted branch PC. |
| speculative | Whether the update is speculative or not |
| taken | (Predicted) branch direction. |
| target | (Predicted) branch target. |
| inst | The branch instruction. Some predictors do different things depending on the branch type. |
| bi | Pointer to information on the prediction recorded at prediction time. |
Reimplemented in gem5::branch_prediction::MPP_TAGE.
Definition at line 608 of file tage_base.cc.
References gem5::PowerISA::bi, branchTypeExtra(), calcNewPathHist(), calculateIndicesAndTags(), DPRINTF, recordHistState(), restoreHistState(), speculativeHistUpdate, threadHistory, and updatePathAndGlobalHistory().
Referenced by squash().
|
virtual |
Does the actual update of path and global history.
Different TAGE implementations may override this function to do extra work.
| tid | The thread ID to select the histories to update. |
| brtype | The branch type |
| taken | Actual branch outcome. |
| branch_pc | The unshifted branch PC. |
| target | The branch target |
| bi | Pointer to information on the prediction |
Reimplemented in gem5::branch_prediction::TAGE_SC_L_TAGE.
Definition at line 590 of file tage_base.cc.
References gem5::PowerISA::bi, calcNewPathHist(), gem5::branch_prediction::TAGEBase::ThreadHistory::pathHist, threadHistory, and updateGHist().
Referenced by updateHistories().
|
virtual |
Update the stats.
| taken | Actual branch outcome |
| bi | Pointer to information on the prediction recorded at prediction time. |
Definition at line 734 of file tage_base.cc.
References gem5::PowerISA::bi, BIMODAL_ALT_MATCH, BIMODAL_ONLY, stats, TAGE_ALT_MATCH, and TAGE_LONGEST_MATCH.
|
protected |
Definition at line 497 of file tage_base.hh.
Referenced by baseUpdate(), gem5::branch_prediction::TAGE_SC_L_TAGE::getBimodePred(), init(), and gem5::branch_prediction::MPP_TAGE::isHighConfidence().
|
protected |
Definition at line 496 of file tage_base.hh.
Referenced by baseUpdate(), gem5::branch_prediction::TAGE_SC_L_TAGE::getBimodePred(), getBimodePred(), init(), and gem5::branch_prediction::MPP_TAGE::isHighConfidence().
|
protected |
Definition at line 498 of file tage_base.hh.
Referenced by gem5::branch_prediction::TAGE_SC_L_TAGE::buildTageTables(), buildTageTables(), gem5::branch_prediction::TAGE_SC_L_TAGE::extraAltCalc(), getCtr(), gem5::branch_prediction::MPP_TAGE::handleAllocAndUReset(), gem5::branch_prediction::TAGE_SC_L_TAGE_64KB::handleAllocAndUReset(), gem5::branch_prediction::TAGE_SC_L_TAGE_8KB::handleAllocAndUReset(), handleAllocAndUReset(), gem5::branch_prediction::MPP_TAGE::handleTAGEUpdate(), gem5::branch_prediction::TAGE_SC_L_TAGE_64KB::handleTAGEUpdate(), gem5::branch_prediction::TAGE_SC_L_TAGE_8KB::handleTAGEUpdate(), handleTAGEUpdate(), gem5::branch_prediction::MPP_TAGE::handleUReset(), gem5::branch_prediction::TAGE_SC_L_TAGE::handleUReset(), handleUReset(), init(), gem5::branch_prediction::MPP_TAGE::isHighConfidence(), and tagePredict().
|
protected |
Definition at line 488 of file tage_base.hh.
Referenced by getGHR(), init(), TAGEBase(), and updateGHist().
|
protected |
Definition at line 533 of file tage_base.hh.
Referenced by gem5::branch_prediction::TAGE_SC_L_TAGE::calculateIndicesAndTags(), gem5::branch_prediction::MPP_TAGE::calculateParameters(), gem5::branch_prediction::TAGE_SC_L_TAGE::calculateParameters(), calculateParameters(), getSizeInBits(), gem5::branch_prediction::TAGE_SC_L_TAGE::gindex(), gindex(), gem5::branch_prediction::TAGE_SC_L_TAGE_8KB::gtag(), init(), gem5::branch_prediction::TAGE_SC_L_TAGE_8KB::initFoldedHistories(), and initFoldedHistories().
|
protected |
Definition at line 554 of file tage_base.hh.
Referenced by init(), and TAGEBase().
|
protected |
Definition at line 540 of file tage_base.hh.
Referenced by init(), and TAGEBase().
|
protected |
Definition at line 552 of file tage_base.hh.
Referenced by gem5::branch_prediction::TAGE_SC_L_TAGE::bindex(), bindex(), calcNewPathHist(), gem5::branch_prediction::TAGE_SC_L_TAGE::calculateIndicesAndTags(), gem5::branch_prediction::TAGE_SC_L_TAGE::gindex(), gindex(), gem5::branch_prediction::TAGE_SC_L_TAGE_64KB::gtag(), gem5::branch_prediction::TAGE_SC_L_TAGE_8KB::gtag(), gtag(), TAGEBase(), and gem5::branch_prediction::TAGE_SC_L_TAGE::updatePathAndGlobalHistory().
|
protected |
Definition at line 484 of file tage_base.hh.
Referenced by baseUpdate(), gem5::branch_prediction::TAGE_SC_L_TAGE::getBimodePred(), getSizeInBits(), init(), gem5::branch_prediction::MPP_TAGE::isHighConfidence(), and TAGEBase().
|
protected |
Definition at line 494 of file tage_base.hh.
Referenced by gem5::branch_prediction::MPP_TAGE::bindex(), gem5::branch_prediction::TAGE_SC_L_TAGE::bindex(), bindex(), buildTageTables(), gem5::branch_prediction::TAGE_SC_L_TAGE::calculateIndicesAndTags(), gem5::branch_prediction::TAGE_SC_L_TAGE::calculateParameters(), gem5::branch_prediction::TAGE_SC_L_TAGE::F(), F(), getSizeInBits(), gem5::branch_prediction::TAGE_SC_L_TAGE::gindex(), gindex(), gem5::branch_prediction::TAGE_SC_L_TAGE_8KB::gindex_ext(), gem5::branch_prediction::MPP_TAGE::handleUReset(), handleUReset(), init(), gem5::branch_prediction::TAGE_SC_L_TAGE_8KB::initFoldedHistories(), initFoldedHistories(), and TAGEBase().
|
protected |
Definition at line 539 of file tage_base.hh.
Referenced by getSizeInBits(), gem5::branch_prediction::MPP_TAGE::handleUReset(), gem5::branch_prediction::TAGE_SC_L_TAGE::handleUReset(), handleUReset(), init(), and TAGEBase().
|
protected |
Definition at line 490 of file tage_base.hh.
Referenced by gem5::branch_prediction::TAGE_SC_L_TAGE::calculateParameters(), calculateParameters(), init(), TAGEBase(), and updateGHist().
|
protected |
Definition at line 543 of file tage_base.hh.
Referenced by gem5::branch_prediction::TAGE_SC_L_TAGE_64KB::handleAllocAndUReset(), gem5::branch_prediction::TAGE_SC_L_TAGE_8KB::handleAllocAndUReset(), handleAllocAndUReset(), and TAGEBase().
|
protected |
Definition at line 489 of file tage_base.hh.
Referenced by gem5::branch_prediction::TAGE_SC_L_TAGE::calculateParameters(), calculateParameters(), and TAGEBase().
|
protected |
Definition at line 485 of file tage_base.hh.
Referenced by gem5::branch_prediction::TAGEBase::BranchInfo::BranchInfo(), gem5::branch_prediction::TAGE_SC_L_TAGE::buildTageTables(), buildTageTables(), gem5::branch_prediction::TAGE_SC_L_TAGE::calculateIndicesAndTags(), calculateIndicesAndTags(), gem5::branch_prediction::MPP_TAGE::calculateParameters(), gem5::branch_prediction::TAGE_SC_L_TAGE::calculateParameters(), calculateParameters(), condBranchUpdate(), getSizeInBits(), gem5::branch_prediction::MPP_TAGE::getUseAltIdx(), gem5::branch_prediction::MPP_TAGE::handleAllocAndUReset(), gem5::branch_prediction::TAGE_SC_L_TAGE_64KB::handleAllocAndUReset(), gem5::branch_prediction::TAGE_SC_L_TAGE_8KB::handleAllocAndUReset(), handleAllocAndUReset(), gem5::branch_prediction::MPP_TAGE::handleUReset(), handleUReset(), init(), gem5::branch_prediction::TAGE_SC_L_TAGE_8KB::initFoldedHistories(), initFoldedHistories(), recordHistState(), restoreHistState(), TAGEBase(), gem5::branch_prediction::TAGEBase::TAGEBaseStats::TAGEBaseStats(), tagePredict(), and updateGHist().
|
protected |
Definition at line 548 of file tage_base.hh.
Referenced by gem5::branch_prediction::TAGE_SC_L_TAGE::calculateIndicesAndTags(), gem5::branch_prediction::MPP_TAGE::handleAllocAndUReset(), gem5::branch_prediction::TAGE_SC_L_TAGE_64KB::handleAllocAndUReset(), gem5::branch_prediction::TAGE_SC_L_TAGE_8KB::handleAllocAndUReset(), TAGEBase(), and tagePredict().
|
protected |
Definition at line 541 of file tage_base.hh.
Referenced by getSizeInBits(), gem5::branch_prediction::MPP_TAGE::getUseAltIdx(), gem5::branch_prediction::TAGE_SC_L_TAGE::getUseAltIdx(), init(), and TAGEBase().
|
protected |
Definition at line 491 of file tage_base.hh.
Referenced by calcNewPathHist(), getSizeInBits(), gem5::branch_prediction::TAGE_SC_L_TAGE::gindex(), gindex(), gem5::branch_prediction::TAGE_SC_L_TAGE_8KB::gtag(), init(), TAGEBase(), and gem5::branch_prediction::TAGE_SC_L_TAGE::updatePathAndGlobalHistory().
|
protected |
Definition at line 550 of file tage_base.hh.
Referenced by isSpeculativeUpdateEnabled(), restoreHistState(), TAGEBase(), gem5::branch_prediction::MPP_TAGE::updateHistories(), and updateHistories().
|
protected |
Referenced by TAGEBase(), and updateStats().
|
protected |
Definition at line 534 of file tage_base.hh.
Referenced by gem5::branch_prediction::TAGE_SC_L_TAGE::calculateIndicesAndTags(), calculateIndicesAndTags(), init(), and tagePredict().
|
protected |
Definition at line 535 of file tage_base.hh.
Referenced by gem5::branch_prediction::TAGE_SC_L_TAGE::calculateIndicesAndTags(), calculateIndicesAndTags(), init(), and tagePredict().
|
protected |
Definition at line 486 of file tage_base.hh.
Referenced by getSizeInBits(), getTageCtrBits(), gem5::branch_prediction::MPP_TAGE::handleTAGEUpdate(), gem5::branch_prediction::TAGE_SC_L_TAGE_64KB::handleTAGEUpdate(), gem5::branch_prediction::TAGE_SC_L_TAGE_8KB::handleTAGEUpdate(), handleTAGEUpdate(), gem5::branch_prediction::MPP_TAGE::isHighConfidence(), and TAGEBase().
|
protected |
Definition at line 493 of file tage_base.hh.
Referenced by gem5::branch_prediction::TAGE_SC_L_TAGE::calculateParameters(), getSizeInBits(), gem5::branch_prediction::TAGE_SC_L_TAGE_64KB::gtag(), gem5::branch_prediction::TAGE_SC_L_TAGE_8KB::gtag(), gtag(), init(), gem5::branch_prediction::TAGE_SC_L_TAGE_8KB::initFoldedHistories(), initFoldedHistories(), and TAGEBase().
|
protected |
Definition at line 487 of file tage_base.hh.
Referenced by getSizeInBits(), gem5::branch_prediction::MPP_TAGE::handleTAGEUpdate(), gem5::branch_prediction::TAGE_SC_L_TAGE_64KB::handleTAGEUpdate(), gem5::branch_prediction::TAGE_SC_L_TAGE_8KB::handleTAGEUpdate(), handleTAGEUpdate(), init(), and TAGEBase().
|
protected |
Definition at line 538 of file tage_base.hh.
Referenced by gem5::branch_prediction::MPP_TAGE::handleAllocAndUReset(), gem5::branch_prediction::TAGE_SC_L_TAGE_64KB::handleAllocAndUReset(), gem5::branch_prediction::TAGE_SC_L_TAGE_8KB::handleAllocAndUReset(), handleAllocAndUReset(), gem5::branch_prediction::MPP_TAGE::handleUReset(), gem5::branch_prediction::TAGE_SC_L_TAGE::handleUReset(), handleUReset(), and init().
|
protected |
Definition at line 526 of file tage_base.hh.
Referenced by gem5::branch_prediction::TAGE_SC_L_TAGE::calculateIndicesAndTags(), getGHR(), getPathHist(), gem5::branch_prediction::TAGE_SC_L_TAGE::gindex(), gindex(), gem5::branch_prediction::TAGE_SC_L_TAGE_64KB::gtag(), gem5::branch_prediction::TAGE_SC_L_TAGE_8KB::gtag(), gtag(), init(), recordHistState(), restoreHistState(), TAGEBase(), updateGHist(), gem5::branch_prediction::MPP_TAGE::updateHistories(), updateHistories(), gem5::branch_prediction::TAGE_SC_L_TAGE::updatePathAndGlobalHistory(), and updatePathAndGlobalHistory().
|
protected |
Definition at line 542 of file tage_base.hh.
Referenced by condBranchUpdate(), getSizeInBits(), and TAGEBase().
|
protected |
Definition at line 537 of file tage_base.hh.
Referenced by condBranchUpdate(), init(), and tagePredict().