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 <nilay@cs.wisc.edu>
This commit is contained in:
parent
fb0f9884e2
commit
543efd5ca6
2 changed files with 8 additions and 0 deletions
|
@ -217,6 +217,7 @@ TournamentBP::lookup(Addr branch_addr, void * &bp_history)
|
||||||
history->localPredTaken = local_prediction;
|
history->localPredTaken = local_prediction;
|
||||||
history->globalPredTaken = global_prediction;
|
history->globalPredTaken = global_prediction;
|
||||||
history->globalUsed = choice_prediction;
|
history->globalUsed = choice_prediction;
|
||||||
|
history->localHistoryIdx = local_history_idx;
|
||||||
history->localHistory = local_predictor_idx;
|
history->localHistory = local_predictor_idx;
|
||||||
bp_history = (void *)history;
|
bp_history = (void *)history;
|
||||||
|
|
||||||
|
@ -256,6 +257,7 @@ TournamentBP::uncondBranch(Addr pc, void * &bp_history)
|
||||||
history->localPredTaken = true;
|
history->localPredTaken = true;
|
||||||
history->globalPredTaken = true;
|
history->globalPredTaken = true;
|
||||||
history->globalUsed = true;
|
history->globalUsed = true;
|
||||||
|
history->localHistoryIdx = invalidPredictorIndex;
|
||||||
history->localHistory = invalidPredictorIndex;
|
history->localHistory = invalidPredictorIndex;
|
||||||
bp_history = static_cast<void *>(history);
|
bp_history = static_cast<void *>(history);
|
||||||
|
|
||||||
|
@ -371,6 +373,11 @@ TournamentBP::squash(void *bp_history)
|
||||||
// Restore global history to state prior to this branch.
|
// Restore global history to state prior to this branch.
|
||||||
globalHistory = history->globalHistory;
|
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 this BPHistory now that we're done with it.
|
||||||
delete history;
|
delete history;
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,6 +167,7 @@ class TournamentBP : public BPredUnit
|
||||||
static int newCount;
|
static int newCount;
|
||||||
#endif
|
#endif
|
||||||
unsigned globalHistory;
|
unsigned globalHistory;
|
||||||
|
unsigned localHistoryIdx;
|
||||||
unsigned localHistory;
|
unsigned localHistory;
|
||||||
bool localPredTaken;
|
bool localPredTaken;
|
||||||
bool globalPredTaken;
|
bool globalPredTaken;
|
||||||
|
|
Loading…
Reference in a new issue