Skip to content

Commit 014d5f3

Browse files
committed
cpu-o3: Add replayed load completion counter
Change-Id: I78887a7eb4d90ad5b5a3a870977ff9aabd621468
1 parent 7542d58 commit 014d5f3

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

src/cpu/o3/dyn_inst.hh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,9 @@ class DynInst : public ExecContext, public RefCounted
252252
/* replay type of this instruction */
253253
std::optional<LdStReplayType> replayType;
254254

255+
// Track whether this instruction has ever been replayed.
256+
bool _everReplayed = false;
257+
255258
bool _hasProducerStorePC = false;
256259
Addr _producerStorePC = 0;
257260

@@ -1054,7 +1057,9 @@ class DynInst : public ExecContext, public RefCounted
10541057
void setReplay(LdStReplayType type) {
10551058
setNeedReplay();
10561059
replayType = type;
1060+
_everReplayed = true;
10571061
}
1062+
bool everReplayed() const { return _everReplayed; }
10581063
std::optional<LdStReplayType> getReplayType() const {
10591064
return replayType;
10601065
}

src/cpu/o3/lsq_unit.cc

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,14 @@ LSQUnit::LSQUnitStats::LSQUnitStats(statistics::Group *parent)
789789
ADD_STAT(RAWQueueFull, "Number of times RAW queue was full"),
790790
ADD_STAT(RAWQueueReplay, "Number of instructions replayed from RAW queue"),
791791
ADD_STAT(RAWQueueLatency, statistics::units::Cycle::get(), "RAW queue latency distribution"),
792-
ADD_STAT(loadReplayEvents, statistics::units::Count::get(), "event distribution of load replay")
792+
ADD_STAT(loadReplayEvents, statistics::units::Count::get(), "event distribution of load replay"),
793+
ADD_STAT(replayedLoadIssueToPipe, statistics::units::Count::get(),
794+
"Number of replayed loads that enter the load pipeline"),
795+
ADD_STAT(replayedLoadReadyToFinish, statistics::units::Count::get(),
796+
"Number of replayed loads that finish execution"),
797+
ADD_STAT(replayedLoadFinishRate, statistics::units::Ratio::get(),
798+
"Replay load finish rate",
799+
replayedLoadReadyToFinish / replayedLoadIssueToPipe)
793800
{
794801
loadToUse
795802
.init(0, 299, 10)
@@ -811,6 +818,8 @@ LSQUnit::LSQUnitStats::LSQUnitStats(statistics::Group *parent)
811818
for (int i = 0; i < LdStReplayTypeCount; i++) {
812819
loadReplayEvents.subname(i, load_store_replay_event_str[static_cast<LdStReplayType>(i)]);
813820
}
821+
822+
replayedLoadFinishRate.precision(6);
814823
}
815824

816825
void
@@ -1220,6 +1229,10 @@ LSQUnit::issueToLoadPipe(const DynInstPtr &inst)
12201229
loadPipeSx[0]->insts[idx] = inst;
12211230
loadPipeSx[0]->size++;
12221231

1232+
if (inst->everReplayed()) {
1233+
stats.replayedLoadIssueToPipe++;
1234+
}
1235+
12231236
DPRINTF(LoadPipeline, "issueToLoadPipe: [sn:%llu]\n", inst->seqNum);
12241237
}
12251238

@@ -1605,7 +1618,12 @@ LSQUnit::executeLoadPipeSx()
16051618
}
16061619

16071620
if (i == loadPipeStages - 1 && !inst->needReplay()) {
1608-
if (inst->isNormalLd() || !inst->readMemAccPredicate()) iewStage->readyToFinish(inst);
1621+
if (inst->isNormalLd() || !inst->readMemAccPredicate()) {
1622+
if (inst->everReplayed()) {
1623+
stats.replayedLoadReadyToFinish++;
1624+
}
1625+
iewStage->readyToFinish(inst);
1626+
}
16091627
iewStage->activityThisCycle();
16101628
inst->endPipelining();
16111629
DPRINTF(LoadPipeline, "Load [sn:%llu] ready to finish\n",

src/cpu/o3/lsq_unit.hh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -911,6 +911,13 @@ class LSQUnit
911911
statistics::Distribution RAWQueueLatency;
912912

913913
statistics::Vector loadReplayEvents;
914+
915+
/** Number of replayed loads that enter the load pipeline. */
916+
statistics::Scalar replayedLoadIssueToPipe;
917+
/** Number of replayed loads that finish execution. */
918+
statistics::Scalar replayedLoadReadyToFinish;
919+
/** Ratio of replayed load finishes to replayed load issues. */
920+
statistics::Formula replayedLoadFinishRate;
914921
} stats;
915922

916923
void bankConflictReplay();

0 commit comments

Comments
 (0)