changeset b1be1df904c9 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=b1be1df904c9
description:
        cpu: remove local/globalHistoryBits params from branch pred

        having separate params for the local/globalHistoryBits and the
        local/globalPredictorSize can lead to inconsistencies if they
        are not carefully set. this patch dervies the number of bits
        necessary to index into the local/global predictors based on
        their size.

        the value of the localHistoryTableSize for the ARM O3 CPU has been
        increased to 1024 from 64, which is more accurate for an A15 based
        on some correlation against A15 hardware.

diffstat:

 configs/common/O3_ARM_v7a.py    |   5 ++---
 src/cpu/pred/BranchPredictor.py |   2 --
 src/cpu/pred/tournament.cc      |  21 ++++++++++++++-------
 3 files changed, 16 insertions(+), 12 deletions(-)

diffs (78 lines):

diff -r 8055cd04be78 -r b1be1df904c9 configs/common/O3_ARM_v7a.py
--- a/configs/common/O3_ARM_v7a.py      Tue May 14 16:02:45 2013 +0200
+++ b/configs/common/O3_ARM_v7a.py      Tue May 14 18:39:47 2013 -0400
@@ -90,12 +90,11 @@
 # Tournament Branch Predictor
 class O3_ARM_v7a_BP(BranchPredictor):
     predType = "tournament"
+    localPredictorSize = 2048
     localCtrBits = 2
-    localHistoryTableSize = 64
-    localHistoryBits = 6
+    localHistoryTableSize = 1024
     globalPredictorSize = 8192
     globalCtrBits = 2
-    globalHistoryBits = 13
     choicePredictorSize = 8192
     choiceCtrBits = 2
     BTBEntries = 2048
diff -r 8055cd04be78 -r b1be1df904c9 src/cpu/pred/BranchPredictor.py
--- a/src/cpu/pred/BranchPredictor.py   Tue May 14 16:02:45 2013 +0200
+++ b/src/cpu/pred/BranchPredictor.py   Tue May 14 18:39:47 2013 -0400
@@ -40,10 +40,8 @@
     localPredictorSize = Param.Unsigned(2048, "Size of local predictor")
     localCtrBits = Param.Unsigned(2, "Bits per counter")
     localHistoryTableSize = Param.Unsigned(2048, "Size of local history table")
-    localHistoryBits = Param.Unsigned(11, "Bits for the local history")
     globalPredictorSize = Param.Unsigned(8192, "Size of global predictor")
     globalCtrBits = Param.Unsigned(2, "Bits per counter")
-    globalHistoryBits = Param.Unsigned(13, "Bits of history")
     choicePredictorSize = Param.Unsigned(8192, "Size of choice predictor")
     choiceCtrBits = Param.Unsigned(2, "Bits of choice counters")
 
diff -r 8055cd04be78 -r b1be1df904c9 src/cpu/pred/tournament.cc
--- a/src/cpu/pred/tournament.cc        Tue May 14 16:02:45 2013 +0200
+++ b/src/cpu/pred/tournament.cc        Tue May 14 18:39:47 2013 -0400
@@ -46,17 +46,28 @@
 
 TournamentBP::TournamentBP(const Params *params)
     : BPredUnit(params),
+      localPredictorSize(params->localPredictorSize),
       localCtrBits(params->localCtrBits),
       localHistoryTableSize(params->localHistoryTableSize),
-      localHistoryBits(params->localHistoryBits),
+      localHistoryBits(ceilLog2(params->localPredictorSize)),
       globalPredictorSize(params->globalPredictorSize),
       globalCtrBits(params->globalCtrBits),
-      globalHistoryBits(params->globalHistoryBits),
+      globalHistoryBits(
+          ceilLog2(params->globalPredictorSize) >
+          ceilLog2(params->choicePredictorSize) ?
+          ceilLog2(params->globalPredictorSize) :
+          ceilLog2(params->choicePredictorSize)),
       choicePredictorSize(params->choicePredictorSize),
       choiceCtrBits(params->choiceCtrBits),
       instShiftAmt(params->instShiftAmt)
 {
-    localPredictorSize = ULL(1) << localHistoryBits;
+    if (!isPowerOf2(localPredictorSize)) {
+        fatal("Invalid local predictor size!\n");
+    }
+
+    if (!isPowerOf2(globalPredictorSize)) {
+        fatal("Invalid global predictor size!\n");
+    }
 
     //Set up the array of counters for the local predictor
     localCtrs.resize(localPredictorSize);
@@ -76,10 +87,6 @@
     for (int i = 0; i < localHistoryTableSize; ++i)
         localHistoryTable[i] = 0;
 
-    if (!isPowerOf2(globalPredictorSize)) {
-        fatal("Invalid global predictor size!\n");
-    }
-
     //Setup the array of counters for the global predictor
     globalCtrs.resize(globalPredictorSize);
 
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to