changeset 8e96720a382c in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=8e96720a382c
description:
        cpu: pred: Local Predictor Reset in Tournament Predictor

        When a branch gets squashed, it's speculative branch predictor state 
should get
        rolled back in squash().  However, only the globalHistory state was 
being
        rolled back.  This patch adds (at least some) support for rolling back 
the
        local predictor state also.

        Committed by: Nilay Vaish <[email protected]>

diffstat:

 src/cpu/pred/tournament.cc |  7 +++++++
 src/cpu/pred/tournament.hh |  1 +
 2 files changed, 8 insertions(+), 0 deletions(-)

diffs (42 lines):

diff -r da477ae38907 -r 8e96720a382c src/cpu/pred/tournament.cc
--- a/src/cpu/pred/tournament.cc        Tue Sep 15 08:14:06 2015 -0500
+++ b/src/cpu/pred/tournament.cc        Tue Sep 15 08:14:07 2015 -0500
@@ -217,6 +217,7 @@
     history->localPredTaken = local_prediction;
     history->globalPredTaken = global_prediction;
     history->globalUsed = choice_prediction;
+    history->localHistoryIdx = local_history_idx;
     history->localHistory = local_predictor_idx;
     bp_history = (void *)history;
 
@@ -256,6 +257,7 @@
     history->localPredTaken = true;
     history->globalPredTaken = true;
     history->globalUsed = true;
+    history->localHistoryIdx = invalidPredictorIndex;
     history->localHistory = invalidPredictorIndex;
     bp_history = static_cast<void *>(history);
 
@@ -371,6 +373,11 @@
     // Restore global history to state prior to this branch.
     globalHistory = history->globalHistory;
 
+    // Restore local history
+    if (history->localHistoryIdx != invalidPredictorIndex) {
+        localHistoryTable[history->localHistoryIdx] = history->localHistory;
+    }
+
     // Delete this BPHistory now that we're done with it.
     delete history;
 }
diff -r da477ae38907 -r 8e96720a382c src/cpu/pred/tournament.hh
--- a/src/cpu/pred/tournament.hh        Tue Sep 15 08:14:06 2015 -0500
+++ b/src/cpu/pred/tournament.hh        Tue Sep 15 08:14:07 2015 -0500
@@ -167,6 +167,7 @@
         static int newCount;
 #endif
         unsigned globalHistory;
+        unsigned localHistoryIdx;
         unsigned localHistory;
         bool localPredTaken;
         bool globalPredTaken;
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to