Skip to content

Commit 4129e13

Browse files
authored
Train ITTAGE at resolve stage (#630)
* cpu-o3: enable ITTAGE predictor Change-Id: I6a01e4ecb12119e1d2040eff44f28ceeefb3886d * cpu-o3: train ittage in resolve stage Change-Id: Ie7812db8bc256535f019bd59e36d5688312122ef * cpu-o3: filter not resolved btb entries in ittage resolve update Change-Id: I13a7033fce6096dd2ad7a5e3c58f935486b28a63 * cpu-o3: only update ubtb & abtb when it enabled Change-Id: If8ad467ec69fc727ce177a942ae3ebc10eceafbe
1 parent 27d6bbb commit 4129e13

File tree

3 files changed

+19
-10
lines changed

3 files changed

+19
-10
lines changed

configs/example/kmhv3.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,14 @@ def setKmhV3Params(args, system):
9797

9898
cpu.branchPred.mbtb.resolvedUpdate = True
9999
cpu.branchPred.tage.resolvedUpdate = True
100+
cpu.branchPred.ittage.resolvedUpdate = True
100101

101102
cpu.branchPred.ubtb.enabled = True
102103
cpu.branchPred.abtb.enabled = True
103104
cpu.branchPred.microtage.enabled = False
104105
cpu.branchPred.mbtb.enabled = True
105106
cpu.branchPred.tage.enabled = True
106-
cpu.branchPred.ittage.enabled = False
107+
cpu.branchPred.ittage.enabled = True
107108
cpu.branchPred.mgsc.enabled = False
108109
cpu.branchPred.ras.enabled = False
109110

src/cpu/pred/btb/btb_ittage.cc

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,17 @@ BTBITTAGE::update(const FetchStream &stream)
219219
all_entries_to_update.push_back(stream.updateNewBTBEntry);
220220
}
221221

222-
// only update indirect branches that are not returns
223-
auto remove_it = std::remove_if(all_entries_to_update.begin(), all_entries_to_update.end(),
224-
[](const BTBEntry &e) { return !(e.isIndirect && !e.isReturn); });
225-
all_entries_to_update.erase(remove_it, all_entries_to_update.end());
222+
// // only update indirect branches that are not returns
223+
if (getResolvedUpdate()) {
224+
auto remove_it =
225+
std::remove_if(all_entries_to_update.begin(), all_entries_to_update.end(),
226+
[](const BTBEntry &e) { return !(e.isIndirect && !e.isReturn && e.resolved); });
227+
all_entries_to_update.erase(remove_it, all_entries_to_update.end());
228+
} else {
229+
auto remove_it = std::remove_if(all_entries_to_update.begin(), all_entries_to_update.end(),
230+
[](const BTBEntry &e) { return !(e.isIndirect && !e.isReturn); });
231+
all_entries_to_update.erase(remove_it, all_entries_to_update.end());
232+
}
226233

227234
// get tage predictions from meta
228235
// TODO: use component idx

src/cpu/pred/btb/decoupled_bpred.cc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -251,15 +251,16 @@ DecoupledBPUWithBTB::generateFinalPredAndCreateBubbles()
251251

252252
// update ubtb/abtb using final S3 prediction
253253
if (predsOfEachStage[numStages - 1].btbEntries.size() > 0) {
254-
ubtb->updateUsingS3Pred(predsOfEachStage[numStages - 1]);
255-
auto it = fetchStreamQueue.find(fsqId-1);
256-
if (it != fetchStreamQueue.end()) {
254+
if (ubtb->isEnabled()) {
255+
ubtb->updateUsingS3Pred(predsOfEachStage[numStages - 1]);
256+
}
257+
auto it = fetchStreamQueue.find(fsqId - 1);
258+
if (it != fetchStreamQueue.end() && abtb->isEnabled()) {
257259
auto previous_block_startpc = it->second.startPC;
258260
abtb->updateUsingS3Pred(predsOfEachStage[numStages - 1], previous_block_startpc);
259-
} else {
261+
} else if (abtb->isEnabled()) {
260262
abtb->updateUsingS3Pred(predsOfEachStage[numStages - 1], 0);
261263
}
262-
263264
}
264265

265266
// 4. Record override bubbles and update statistics

0 commit comments

Comments
 (0)