summaryrefslogtreecommitdiff
path: root/src/cpu/pred/tage.hh
diff options
context:
space:
mode:
authorPau Cabre <pau.cabre@metempsy.com>2018-11-22 14:48:30 +0100
committerPau Cabre <pau.cabre@metempsy.com>2018-11-28 17:25:50 +0000
commit86b23a175c9985ecbfae710ba2b0fd6f629650df (patch)
treead197ad4f892d6072a22217e4488a9276fdb41b5 /src/cpu/pred/tage.hh
parentb2078cef37f10ebe1822e3f2a372c780eab91a7e (diff)
downloadgem5-86b23a175c9985ecbfae710ba2b0fd6f629650df.tar.xz
cpu: Added new stats to TAGE and LTAGE branch predictors
They are basically used to tell wich component of the predictor is providing the prediction and whether it is correct or wrong Change-Id: I7b3db66535f159091f1b37d70c2d942d50b20fb2 Signed-off-by: Pau Cabre <pau.cabre@metempsy.com> Reviewed-on: https://gem5-review.googlesource.com/c/14535 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'src/cpu/pred/tage.hh')
-rw-r--r--src/cpu/pred/tage.hh40
1 files changed, 39 insertions, 1 deletions
diff --git a/src/cpu/pred/tage.hh b/src/cpu/pred/tage.hh
index 9ba02414c..c66c28cb1 100644
--- a/src/cpu/pred/tage.hh
+++ b/src/cpu/pred/tage.hh
@@ -71,6 +71,8 @@ class TAGE: public BPredUnit
virtual void squash(ThreadID tid, void *bp_history) override;
unsigned getGHR(ThreadID tid, void *bp_history) const override;
+ virtual void regStats() override;
+
protected:
// Prediction Structures
@@ -110,6 +112,15 @@ class TAGE: public BPredUnit
}
};
+ // provider type
+ enum {
+ BIMODAL_ONLY = 0,
+ TAGE_LONGEST_MATCH,
+ BIMODAL_ALT_MATCH,
+ TAGE_ALT_MATCH,
+ LAST_TAGE_PROVIDER_TYPE = TAGE_ALT_MATCH
+ };
+
// Primary branch history entry
struct TageBranchInfo
{
@@ -141,6 +152,9 @@ class TAGE: public BPredUnit
int *ct0;
int *ct1;
+ // for stats purposes
+ unsigned provider;
+
TageBranchInfo(int sz)
: pathHist(0), ptGhist(0),
hitBank(0), hitBankIndex(0),
@@ -148,7 +162,8 @@ class TAGE: public BPredUnit
bimodalIndex(0),
tagePred(false), altTaken(false),
condBranch(false), longestMatchPred(false),
- pseudoNewAlloc(false), branchPC(0)
+ pseudoNewAlloc(false), branchPC(0),
+ provider(-1)
{
storage = new int [sz * 5];
tableIndices = storage;
@@ -320,6 +335,14 @@ class TAGE: public BPredUnit
bool tagePredict(
ThreadID tid, Addr branch_pc, bool cond_branch, TageBranchInfo* bi);
+ /**
+ * Update the stats
+ * @param taken Actual branch outcome
+ * @param bi Pointer to information on the prediction
+ * recorded at prediction time.
+ */
+ virtual void updateStats(bool taken, TageBranchInfo* bi);
+
const unsigned logRatioBiModalHystEntries;
const unsigned nHistoryTables;
const unsigned tagTableCounterBits;
@@ -369,6 +392,21 @@ class TAGE: public BPredUnit
uint64_t tCounter;
uint64_t logUResetPeriod;
unsigned useAltOnNaBits;
+
+ // stats
+ Stats::Scalar tageLongestMatchProviderCorrect;
+ Stats::Scalar tageAltMatchProviderCorrect;
+ Stats::Scalar bimodalAltMatchProviderCorrect;
+ Stats::Scalar tageBimodalProviderCorrect;
+ Stats::Scalar tageLongestMatchProviderWrong;
+ Stats::Scalar tageAltMatchProviderWrong;
+ Stats::Scalar bimodalAltMatchProviderWrong;
+ Stats::Scalar tageBimodalProviderWrong;
+ Stats::Scalar tageAltMatchProviderWouldHaveHit;
+ Stats::Scalar tageLongestMatchProviderWouldHaveHit;
+
+ Stats::Vector tageLongestMatchProvider;
+ Stats::Vector tageAltMatchProvider;
};
#endif // __CPU_PRED_TAGE