diff options
author | Pau Cabre <pau.cabre@metempsy.com> | 2018-11-22 14:48:30 +0100 |
---|---|---|
committer | Pau Cabre <pau.cabre@metempsy.com> | 2018-11-28 17:25:50 +0000 |
commit | 86b23a175c9985ecbfae710ba2b0fd6f629650df (patch) | |
tree | ad197ad4f892d6072a22217e4488a9276fdb41b5 /src/cpu/pred/ltage.cc | |
parent | b2078cef37f10ebe1822e3f2a372c780eab91a7e (diff) | |
download | gem5-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/ltage.cc')
-rw-r--r-- | src/cpu/pred/ltage.cc | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/cpu/pred/ltage.cc b/src/cpu/pred/ltage.cc index 3be01936e..73f477745 100644 --- a/src/cpu/pred/ltage.cc +++ b/src/cpu/pred/ltage.cc @@ -228,6 +228,7 @@ LTAGE::predict(ThreadID tid, Addr branch_pc, bool cond_branch, void* &b) if ((loopUseCounter >= 0) && bi->loopPredValid) { pred_taken = bi->loopPred; + bi->provider = LOOP; } DPRINTF(LTage, "Predict for %lx: taken?:%d, loopTaken?:%d, " "loopValid?:%d, loopUseCounter:%d, tagePred:%d, altPred:%d\n", @@ -288,6 +289,43 @@ LTAGE::squash(ThreadID tid, void *bp_history) TAGE::squash(tid, bp_history); } + +void +LTAGE::updateStats(bool taken, TageBranchInfo* bi) +{ + TAGE::updateStats(taken, bi); + + LTageBranchInfo * ltage_bi = static_cast<LTageBranchInfo *>(bi); + + if (ltage_bi->provider == LOOP) { + if (taken == ltage_bi->loopPred) { + loopPredictorCorrect++; + } else { + loopPredictorWrong++; + } + } +} + + + +void +LTAGE::regStats() +{ + TAGE::regStats(); + + loopPredictorCorrect + .name(name() + ".loopPredictorCorrect") + .desc("Number of times the loop predictor is the provider and " + "the prediction is correct"); + + loopPredictorWrong + .name(name() + ".loopPredictorWrong") + .desc("Number of times the loop predictor is the provier and " + "the prediction is wrong"); +} + + + LTAGE* LTAGEParams::create() { |