Skip to content

Commit

Permalink
cpu-o3: Disabled two-taken, added override bubble perf counter (#309)
Browse files Browse the repository at this point in the history
* cpu-o3: fix pendingEvents wakeup

Change-Id: I43752e99026ce2e250f460bd78fcb6591bdacd98

* cpu-o3: Disabled two-taken, added override bubble perf counter

This change disables the two-taken branch prediction at ideal configuration and adds a performance counter to track override bubbles.

Change-Id: I3feb9bf662811941ad561ab73e0ee8c5b9040840

---------

Co-authored-by: lixin <[email protected]>
Co-authored-by: xu boran <[email protected]>
  • Loading branch information
3 people authored Mar 4, 2025
1 parent 529486a commit d865947
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion configs/example/xiangshan.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ def setKmhV3IdealParams(args, system):

# ideal decoupled frontend
if args.bp_type is None or args.bp_type == 'DecoupledBPUWithFTB':
cpu.branchPred.enableTwoTaken = True
cpu.branchPred.enableTwoTaken = False
cpu.branchPred.numBr = 8 # numBr must be a power of 2, see getShuffledBrIndex()
cpu.branchPred.predictWidth = 64
cpu.branchPred.tage.enableSC = False # TODO(bug): When numBr changes, enabling SC will trigger an assert
Expand Down
7 changes: 5 additions & 2 deletions src/cpu/pred/ftb/decoupled_bpred.cc
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,9 @@ DecoupledBPUWithFTB::DBPFTBStats::DBPFTBStats(statistics::Group* parent, unsigne
ADD_STAT(staticBranchNum, statistics::units::Count::get(), "the number of all (different) static branches"),
ADD_STAT(staticBranchNumEverTaken, statistics::units::Count::get(), "the number of all (different) static branches that are once taken"),
ADD_STAT(predsOfEachStage, statistics::units::Count::get(), "the number of preds of each stage that account for final pred"),
ADD_STAT(commitPredsFromEachStage, statistics::units::Count::get(), "the number of preds of each stage that account for a committed stream"),
ADD_STAT(overrideBubbleNum, statistics::units::Count::get(), "the number of override bubbles"),
ADD_STAT(commitPredsFromEachStage, statistics::units::Count::get(),
"the number of preds of each stage that account for a committed stream"),
ADD_STAT(fsqEntryDist, statistics::units::Count::get(), "the distribution of number of entries in fsq"),
ADD_STAT(fsqEntryEnqueued, statistics::units::Count::get(), "the number of fsq entries enqueued"),
ADD_STAT(fsqEntryCommitted, statistics::units::Count::get(), "the number of fsq entries committed at last"),
Expand Down Expand Up @@ -2125,6 +2127,7 @@ DecoupledBPUWithFTB::tryEnqFetchStream()
if (numOverrideBubbles > 0) {
DPRINTF(DecoupleBP, "Waiting for bubble caused by overriding, bubbles rest: %u\n", numOverrideBubbles);
DPRINTF(Override, "Waiting for bubble caused by overriding, bubbles rest: %u\n", numOverrideBubbles);
dbpFtbStats.overrideBubbleNum++;
return;
}
assert(!streamQueueFull());
Expand Down Expand Up @@ -2635,4 +2638,4 @@ DecoupledBPUWithFTB::getPreservedReturnAddr(const DynInstPtr &dynInst)

} // namespace branch_prediction

} // namespace gem5
} // namespace gem5
1 change: 1 addition & 0 deletions src/cpu/pred/ftb/decoupled_bpred.hh
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ class DecoupledBPUWithFTB : public BPredUnit
statistics::Scalar staticBranchNumEverTaken;

statistics::Vector predsOfEachStage;
statistics::Scalar overrideBubbleNum;
statistics::Vector commitPredsFromEachStage;
statistics::Distribution fsqEntryDist;
statistics::Scalar fsqEntryEnqueued;
Expand Down

0 comments on commit d865947

Please sign in to comment.