cpu-o3: Use base instructions committed counters in O3CPU

Moved committedInsts from O3 cpu.* to BaseCPU as numInstsNotNOP because
it tracks the instructions committed that are not NOPs or prefetches.
This change also does the same for commitedOps. InstsCommitted from O3
commit.*, which tracks all instructions committed, has been removed.
CommitCPUStats::numInsts replaces it in O3. The same has been done for
opsCommitted. Because IPC and CPI calculations are handled in BaseCPU,
removed IPC and CPI stats from O3 cpu.*.

Change-Id: I9f122c9a9dafccd5342f18056f282f3dad8b1b1e
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/67393
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
This commit is contained in:
Melissa Jost
2023-01-19 01:48:32 -08:00
committed by Bobby Bruce
parent c7b6e78099
commit d943e42bdd
6 changed files with 17 additions and 78 deletions

View File

@@ -954,6 +954,10 @@ CommitCPUStats::CommitCPUStats(statistics::Group *parent, int thread_id)
"Number of instructions committed (thread level)"),
ADD_STAT(numOps, statistics::units::Count::get(),
"Number of ops (including micro ops) committed (thread level)"),
ADD_STAT(numInstsNotNOP, statistics::units::Count::get(),
"Number of instructions committed excluding NOPs or prefetches"),
ADD_STAT(numOpsNotNOP, statistics::units::Count::get(),
"Number of Ops (including micro ops) Simulated"),
ADD_STAT(cpi, statistics::units::Rate<
statistics::units::Cycle, statistics::units::Count>::get(),
"CPI: cycles per instruction (thread level)"),

View File

@@ -758,6 +758,10 @@ class BaseCPU : public ClockedObject
statistics::Scalar numInsts;
statistics::Scalar numOps;
/* Number of instructions committed that are not NOP or prefetches */
statistics::Scalar numInstsNotNOP;
statistics::Scalar numOpsNotNOP;
/* CPI/IPC for total cycle counts and macro insts */
statistics::Formula cpi;
statistics::Formula ipc;

View File

@@ -156,10 +156,6 @@ Commit::CommitStats::CommitStats(CPU *cpu, Commit *commit)
"The number of times a branch was mispredicted"),
ADD_STAT(numCommittedDist, statistics::units::Count::get(),
"Number of insts commited each cycle"),
ADD_STAT(instsCommitted, statistics::units::Count::get(),
"Number of instructions committed"),
ADD_STAT(opsCommitted, statistics::units::Count::get(),
"Number of ops (including micro ops) committed"),
ADD_STAT(amos, statistics::units::Count::get(),
"Number of atomic instructions committed"),
ADD_STAT(membars, statistics::units::Count::get(),
@@ -181,14 +177,6 @@ Commit::CommitStats::CommitStats(CPU *cpu, Commit *commit)
.init(0,commit->commitWidth,1)
.flags(statistics::pdf);
instsCommitted
.init(cpu->numThreads)
.flags(total);
opsCommitted
.init(cpu->numThreads)
.flags(total);
amos
.init(cpu->numThreads)
.flags(total);
@@ -1348,9 +1336,12 @@ Commit::updateComInstStats(const DynInstPtr &inst)
{
ThreadID tid = inst->threadNumber;
if (!inst->isMicroop() || inst->isLastMicroop())
stats.instsCommitted[tid]++;
stats.opsCommitted[tid]++;
if (!inst->isMicroop() || inst->isLastMicroop()) {
cpu->commitStats[tid]->numInsts++;
cpu->baseStats.numInsts++;
}
cpu->commitStats[tid]->numOps++;
cpu->baseStats.numOps++;
// To match the old model, don't count nops and instruction
// prefetches towards the total commit count.

View File

@@ -479,10 +479,6 @@ class Commit
/** Distribution of the number of committed instructions each cycle. */
statistics::Distribution numCommittedDist;
/** Total number of instructions committed. */
statistics::Vector instsCommitted;
/** Total number of ops (including micro ops) committed. */
statistics::Vector opsCommitted;
/** Stat for the total number of committed atomics. */
statistics::Vector amos;
/** Total number of committed memory barriers. */

View File

@@ -328,23 +328,7 @@ CPU::CPUStats::CPUStats(CPU *cpu)
"to idling"),
ADD_STAT(quiesceCycles, statistics::units::Cycle::get(),
"Total number of cycles that CPU has spent quiesced or waiting "
"for an interrupt"),
ADD_STAT(committedInsts, statistics::units::Count::get(),
"Number of Instructions Simulated"),
ADD_STAT(committedOps, statistics::units::Count::get(),
"Number of Ops (including micro ops) Simulated"),
ADD_STAT(cpi, statistics::units::Rate<
statistics::units::Cycle, statistics::units::Count>::get(),
"CPI: Cycles Per Instruction"),
ADD_STAT(totalCpi, statistics::units::Rate<
statistics::units::Cycle, statistics::units::Count>::get(),
"CPI: Total CPI of All Threads"),
ADD_STAT(ipc, statistics::units::Rate<
statistics::units::Count, statistics::units::Cycle>::get(),
"IPC: Instructions Per Cycle"),
ADD_STAT(totalIpc, statistics::units::Rate<
statistics::units::Count, statistics::units::Cycle>::get(),
"IPC: Total IPC of All Threads")
"for an interrupt")
{
// Register any of the O3CPU's stats here.
timesIdled
@@ -356,33 +340,6 @@ CPU::CPUStats::CPUStats(CPU *cpu)
quiesceCycles
.prereq(quiesceCycles);
// Number of Instructions simulated
// --------------------------------
// Should probably be in Base CPU but need templated
// MaxThreads so put in here instead
committedInsts
.init(cpu->numThreads)
.flags(statistics::total);
committedOps
.init(cpu->numThreads)
.flags(statistics::total);
cpi
.precision(6);
cpi = cpu->baseStats.numCycles / committedInsts;
totalCpi
.precision(6);
totalCpi = cpu->baseStats.numCycles / sum(committedInsts);
ipc
.precision(6);
ipc = committedInsts / cpu->baseStats.numCycles;
totalIpc
.precision(6);
totalIpc = sum(committedInsts) / cpu->baseStats.numCycles;
}
void
@@ -1170,14 +1127,14 @@ CPU::instDone(ThreadID tid, const DynInstPtr &inst)
if (!inst->isMicroop() || inst->isLastMicroop()) {
thread[tid]->numInst++;
thread[tid]->threadStats.numInsts++;
cpuStats.committedInsts[tid]++;
commitStats[tid]->numInstsNotNOP++;
// Check for instruction-count-based events.
thread[tid]->comInstEventQueue.serviceEvents(thread[tid]->numInst);
}
thread[tid]->numOp++;
thread[tid]->threadStats.numOps++;
cpuStats.committedOps[tid]++;
commitStats[tid]->numOpsNotNOP++;
probeInstCommit(inst->staticInst, inst->pcState().instAddr());
}

View File

@@ -581,19 +581,6 @@ class CPU : public BaseCPU
/** Stat for total number of cycles the CPU spends descheduled due to a
* quiesce operation or waiting for an interrupt. */
statistics::Scalar quiesceCycles;
/** Stat for the number of committed instructions per thread. */
statistics::Vector committedInsts;
/** Stat for the number of committed ops (including micro ops) per
* thread. */
statistics::Vector committedOps;
/** Stat for the CPI per thread. */
statistics::Formula cpi;
/** Stat for the total CPI. */
statistics::Formula totalCpi;
/** Stat for the IPC per thread. */
statistics::Formula ipc;
/** Stat for the total IPC. */
statistics::Formula totalIpc;
} cpuStats;