Skip to content

Commit 6c2a92d

Browse files
CJ362ffCao Jiaming
andauthored
cpu-o3:Add S3 prediction statistics to UBTB (#643)
* cpu-o3:Add S3 prediction statistics to UBTB Change-Id: Ie0a9a32f0ffc5e41a8555954392a08f62b746dc2 * cpu-o3: Fix formatting in UBTBStats constructor for consistency Change-Id: Iba74bbd15e4ab95e21b0fc36a0619831bc3b31a9 * cpu-o3: Enhance BTB entry update condition Change-Id: Ieaadb337dcff060d1c5b7163c0c08b7a5aa17f24 * cpu-o3: Rename S3 prediction statistics for clarity in UBTB Change-Id: I3abf8c61058cf8dc208985f596653964601aa212 * cpu-o3: mbtb removing unnecessary check for exeTaken Change-Id: Ie28e857ea2a6f9b44b09259986a4e5980271ac7c --------- Co-authored-by: Cao Jiaming <caojiaming@bosc.ac.cn>
1 parent 2afe252 commit 6c2a92d

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

src/cpu/pred/btb/btb_ubtb.cc

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -200,14 +200,20 @@ UBTB::replaceOldEntry(UBTBIter oldEntryIter, const BTBEntry &newTakenEntry, Addr
200200
void
201201
UBTB::updateUsingS3Pred(FullBTBPrediction &s3Pred)
202202
{
203-
if (usingS3Pred) {
204-
auto takenEntry = s3Pred.getTakenEntry();
205-
auto startAddr = s3Pred.bbStart;
206-
UBTBIter oldEntryIter = lastPred.hit_entry;
207-
updateNewEntry(oldEntryIter, takenEntry, startAddr);
208-
} else {
209-
//using commit result to update ubtb
203+
if (!usingS3Pred) {
204+
return;
210205
}
206+
207+
auto takenEntry = s3Pred.getTakenEntry();
208+
if (takenEntry.valid) {
209+
ubtbStats.s3UpdateHits++;
210+
}else {
211+
ubtbStats.s3UpdateMisses++;
212+
}
213+
auto startAddr = s3Pred.bbStart;
214+
UBTBIter oldEntryIter = lastPred.hit_entry;
215+
updateNewEntry(oldEntryIter, takenEntry, startAddr);
216+
211217
}
212218

213219

@@ -300,6 +306,8 @@ UBTB::update(const FetchStream &stream)
300306
if (!pred_hit_entry.valid || pred_hit_entry != stream.exeBranchInfo) {
301307
DPRINTF(UBTB, "update miss detected, pc %#lx, predTick %lu\n", stream.exeBranchInfo.pc, stream.predTick);
302308
ubtbStats.updateMiss++;
309+
}else {
310+
ubtbStats.updateHit++;
303311
}
304312
}
305313

@@ -407,7 +415,9 @@ UBTB::UBTBStats::UBTBStats(statistics::Group *parent)
407415
ADD_STAT(predMiss, statistics::units::Count::get(), "misses encountered on prediction"),
408416
ADD_STAT(predHit, statistics::units::Count::get(), "hits encountered on prediction"),
409417
ADD_STAT(updateMiss, statistics::units::Count::get(), "misses encountered on update"),
410-
418+
ADD_STAT(updateHit, statistics::units::Count::get(), "hits encountered on update"),
419+
ADD_STAT(s3UpdateHits, statistics::units::Count::get(), "hits encountered on S3 update"),
420+
ADD_STAT(s3UpdateMisses, statistics::units::Count::get(), "misses encountered on S3 update"),
411421

412422
ADD_STAT(allBranchHits, statistics::units::Count::get(),
413423
"all types of branches committed that was predicted hit"),

src/cpu/pred/btb/btb_ubtb.hh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ class UBTB : public TimedBaseBTBPredictor
286286
statistics::Scalar predMiss;
287287
statistics::Scalar predHit;
288288
statistics::Scalar updateMiss;
289+
statistics::Scalar updateHit;
290+
statistics::Scalar s3UpdateHits;
291+
statistics::Scalar s3UpdateMisses;
289292

290293
// per branch statistics
291294
statistics::Scalar allBranchHits;

0 commit comments

Comments
 (0)