gem5-dev@gem5.org

The gem5 Developer List

View all threads

[M] Change in gem5/gem5[develop]: cpu: Remove duplicate base inst and op stats

BB
Bobby Bruce (Gerrit)
Mon, May 8, 2023 7:09 PM

Bobby Bruce has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/69109?usp=email )

Change subject: cpu: Remove duplicate base inst and op stats
......................................................................

cpu: Remove duplicate base inst and op stats

This change removes any duplicated numInsts, numOps, ipc, and
cpi stats, and makes sure that numInsts is only tracked per
thread.

Change-Id: I45d0f6cb5c523e53c0602b5152a5108108476936
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/69109
Reviewed-by: Bobby Bruce bbruce@ucdavis.edu
Tested-by: kokoro noreply+kokoro@google.com
Maintainer: Bobby Bruce bbruce@ucdavis.edu

M src/cpu/base.cc
M src/cpu/kvm/base.cc
M src/cpu/kvm/base.hh
M src/cpu/minor/execute.cc
M src/cpu/minor/stats.cc
M src/cpu/minor/stats.hh
M src/cpu/o3/commit.cc
M src/cpu/simple/base.cc
M src/cpu/simple/exec_context.hh
9 files changed, 2 insertions(+), 54 deletions(-)

Approvals:
Bobby Bruce: Looks good to me, approved; Looks good to me, approved
kokoro: Regressions pass

diff --git a/src/cpu/base.cc b/src/cpu/base.cc
index e5a661b..a61c997 100644
--- a/src/cpu/base.cc
+++ b/src/cpu/base.cc
@@ -407,10 +407,6 @@
BaseCPU::
BaseCPUStats::BaseCPUStats(statistics::Group *parent)
: statistics::Group(parent),

  •  ADD_STAT(numInsts, statistics::units::Count::get(),
    
  •           "Number of instructions committed (core level)"),
    
  •  ADD_STAT(numOps, statistics::units::Count::get(),
    
  •           "Number of ops (including micro ops) committed (core  
    

level)"),
ADD_STAT(numCycles, statistics::units::Cycle::get(),
"Number of cpu cycles simulated"),
ADD_STAT(cpi, statistics::units::Rate<
diff --git a/src/cpu/kvm/base.cc b/src/cpu/kvm/base.cc
index 5857f69..e22e162 100644
--- a/src/cpu/kvm/base.cc
+++ b/src/cpu/kvm/base.cc
@@ -261,8 +261,6 @@

BaseKvmCPU::StatGroup::StatGroup(statistics::Group *parent)
: statistics::Group(parent),

  • ADD_STAT(committedInsts, statistics::units::Count::get(),
  •         "Number of instructions committed"),
    ADD_STAT(numVMExits, statistics::units::Count::get(),
             "total number of KVM exits"),
    ADD_STAT(numVMHalfEntries, statistics::units::Count::get(),
    

@@ -778,8 +776,6 @@

      /* Update statistics */
      baseStats.numCycles += simCyclesExecuted;;
  •    stats.committedInsts += instsExecuted;
    
  •    // update both old and new stats
        commitStats[thread->threadId()]->numInsts += instsExecuted;
        baseStats.numInsts += instsExecuted;
        ctrInsts += instsExecuted;
    

diff --git a/src/cpu/kvm/base.hh b/src/cpu/kvm/base.hh
index 2d81c7c..7bbf393 100644
--- a/src/cpu/kvm/base.hh
+++ b/src/cpu/kvm/base.hh
@@ -804,7 +804,6 @@
struct StatGroup : public statistics::Group
{
StatGroup(statistics::Group *parent);

  •    statistics::Scalar committedInsts;
        statistics::Scalar numVMExits;
        statistics::Scalar numVMHalfEntries;
        statistics::Scalar numExitSignal;
    

diff --git a/src/cpu/minor/execute.cc b/src/cpu/minor/execute.cc
index 5df00d3..4e0fa42 100644
--- a/src/cpu/minor/execute.cc
+++ b/src/cpu/minor/execute.cc
@@ -871,8 +871,6 @@
{
thread->numInst++;
thread->threadStats.numInsts++;

  •    cpu.stats.numInsts++;
    
  •    // update both old and new stas
        cpu.commitStats[inst->id.threadId]->numInsts++;
        cpu.baseStats.numInsts++;
    

@@ -881,9 +879,7 @@
}
thread->numOp++;
thread->threadStats.numOps++;

  • cpu.stats.numOps++;
    cpu.commitStats[inst->id.threadId]->numOps++;
  • cpu.baseStats.numOps++;
    cpu.commitStats[inst->id.threadId]
    ->committedInstType[inst->staticInst->opClass()]++;

diff --git a/src/cpu/minor/stats.cc b/src/cpu/minor/stats.cc
index 818db8c..e4eebd3 100644
--- a/src/cpu/minor/stats.cc
+++ b/src/cpu/minor/stats.cc
@@ -45,28 +45,11 @@

MinorStats::MinorStats(BaseCPU *base_cpu)
: statistics::Group(base_cpu),

  • ADD_STAT(numInsts, statistics::units::Count::get(),
  •         "Number of instructions committed"),
    
  • ADD_STAT(numOps, statistics::units::Count::get(),
  •         "Number of ops (including micro ops) committed"),
    ADD_STAT(quiesceCycles, statistics::units::Cycle::get(),
             "Total number of cycles that CPU has spent quiesced or  
    

waiting "

  •         "for an interrupt"),
    
  • ADD_STAT(cpi, statistics::units::Rate<
  •            statistics::units::Cycle, statistics::units::Count>::get(),
    
  •         "CPI: cycles per instruction"),
    
  • ADD_STAT(ipc, statistics::units::Rate<
  •            statistics::units::Count, statistics::units::Cycle>::get(),
    
  •         "IPC: instructions per cycle")
    
  •         "for an interrupt")
    
    {
    quiesceCycles.prereq(quiesceCycles);
  • cpi.precision(6);
  • cpi = base_cpu->baseStats.numCycles / numInsts;
  • ipc.precision(6);
  • ipc = numInsts / base_cpu->baseStats.numCycles;
    }

} // namespace minor
diff --git a/src/cpu/minor/stats.hh b/src/cpu/minor/stats.hh
index f7d5e71..98ac80f 100644
--- a/src/cpu/minor/stats.hh
+++ b/src/cpu/minor/stats.hh
@@ -59,19 +59,9 @@
{
MinorStats(BaseCPU *parent);

  • /** Number of simulated instructions */

  • statistics::Scalar numInsts;

  • /** Number of simulated insts and microops */

  • statistics::Scalar numOps;

  • /** Number of cycles in quiescent state */
    statistics::Scalar quiesceCycles;
    
  • /** CPI/IPC for total cycle counts and macro insts */

  • statistics::Formula cpi;

  • statistics::Formula ipc;

  • };

    } // namespace minor
    diff --git a/src/cpu/o3/commit.cc b/src/cpu/o3/commit.cc
    index 266e59e..538505b 100644
    --- a/src/cpu/o3/commit.cc
    +++ b/src/cpu/o3/commit.cc
    @@ -1343,7 +1343,6 @@
    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.
    diff --git a/src/cpu/simple/base.cc b/src/cpu/simple/base.cc
    index ca86b0b..b42b689 100644
    --- a/src/cpu/simple/base.cc
    +++ b/src/cpu/simple/base.cc
    @@ -154,10 +154,8 @@

    if (!curStaticInst->isMicroop() || curStaticInst->isLastMicroop()) {
    t_info.numInst++;

  •    t_info.execContextStats.numInsts++;
    }
    t_info.numOp++;
    
  • t_info.execContextStats.numOps++;
    }

void
@@ -183,9 +181,8 @@
commitStats[t_info.thread->threadId()]->numInsts++;
baseStats.numInsts++;
}

  • // increment thread level and core level numOps count
  • // increment thread level numOps count
    commitStats[t_info.thread->threadId()]->numOps++;
  • baseStats.numOps++;
    }

Counter
diff --git a/src/cpu/simple/exec_context.hh b/src/cpu/simple/exec_context.hh
index 9639f43..c8c7076 100644
--- a/src/cpu/simple/exec_context.hh
+++ b/src/cpu/simple/exec_context.hh
@@ -86,10 +86,6 @@
: statistics::Group(cpu,
csprintf("exec_context.thread_%i",
thread->threadId()).c_str()),

  •          ADD_STAT(numInsts, statistics::units::Count::get(),
    
  •                   "Number of instructions committed"),
    
  •          ADD_STAT(numOps, statistics::units::Count::get(),
    
  •                   "Number of ops (including micro ops) committed"),
              ADD_STAT(numMatAluAccesses, statistics::units::Count::get(),
                       "Number of matrix alu accesses"),
              ADD_STAT(numCallsReturns, statistics::units::Count::get(),
    

@@ -139,10 +135,6 @@
.prereq(numBranchMispred);
}

  •    // Number of simulated instructions
    
  •    statistics::Scalar numInsts;
    
  •    statistics::Scalar numOps;
    
  •     // Number of matrix alu accesses
        statistics::Scalar numMatAluAccesses;
    

--
To view, visit
https://gem5-review.googlesource.com/c/public/gem5/+/69109?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I45d0f6cb5c523e53c0602b5152a5108108476936
Gerrit-Change-Number: 69109
Gerrit-PatchSet: 13
Gerrit-Owner: Melissa Jost melissakjost@gmail.com
Gerrit-Reviewer: Bobby Bruce bbruce@ucdavis.edu
Gerrit-Reviewer: Gabe Black gabe.black@gmail.com
Gerrit-Reviewer: Jason Lowe-Power jason@lowepower.com
Gerrit-Reviewer: kokoro noreply+kokoro@google.com

Bobby Bruce has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/69109?usp=email ) Change subject: cpu: Remove duplicate base inst and op stats ...................................................................... cpu: Remove duplicate base inst and op stats This change removes any duplicated numInsts, numOps, ipc, and cpi stats, and makes sure that numInsts is only tracked per thread. Change-Id: I45d0f6cb5c523e53c0602b5152a5108108476936 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/69109 Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu> Tested-by: kokoro <noreply+kokoro@google.com> Maintainer: Bobby Bruce <bbruce@ucdavis.edu> --- M src/cpu/base.cc M src/cpu/kvm/base.cc M src/cpu/kvm/base.hh M src/cpu/minor/execute.cc M src/cpu/minor/stats.cc M src/cpu/minor/stats.hh M src/cpu/o3/commit.cc M src/cpu/simple/base.cc M src/cpu/simple/exec_context.hh 9 files changed, 2 insertions(+), 54 deletions(-) Approvals: Bobby Bruce: Looks good to me, approved; Looks good to me, approved kokoro: Regressions pass diff --git a/src/cpu/base.cc b/src/cpu/base.cc index e5a661b..a61c997 100644 --- a/src/cpu/base.cc +++ b/src/cpu/base.cc @@ -407,10 +407,6 @@ BaseCPU:: BaseCPUStats::BaseCPUStats(statistics::Group *parent) : statistics::Group(parent), - ADD_STAT(numInsts, statistics::units::Count::get(), - "Number of instructions committed (core level)"), - ADD_STAT(numOps, statistics::units::Count::get(), - "Number of ops (including micro ops) committed (core level)"), ADD_STAT(numCycles, statistics::units::Cycle::get(), "Number of cpu cycles simulated"), ADD_STAT(cpi, statistics::units::Rate< diff --git a/src/cpu/kvm/base.cc b/src/cpu/kvm/base.cc index 5857f69..e22e162 100644 --- a/src/cpu/kvm/base.cc +++ b/src/cpu/kvm/base.cc @@ -261,8 +261,6 @@ BaseKvmCPU::StatGroup::StatGroup(statistics::Group *parent) : statistics::Group(parent), - ADD_STAT(committedInsts, statistics::units::Count::get(), - "Number of instructions committed"), ADD_STAT(numVMExits, statistics::units::Count::get(), "total number of KVM exits"), ADD_STAT(numVMHalfEntries, statistics::units::Count::get(), @@ -778,8 +776,6 @@ /* Update statistics */ baseStats.numCycles += simCyclesExecuted;; - stats.committedInsts += instsExecuted; - // update both old and new stats commitStats[thread->threadId()]->numInsts += instsExecuted; baseStats.numInsts += instsExecuted; ctrInsts += instsExecuted; diff --git a/src/cpu/kvm/base.hh b/src/cpu/kvm/base.hh index 2d81c7c..7bbf393 100644 --- a/src/cpu/kvm/base.hh +++ b/src/cpu/kvm/base.hh @@ -804,7 +804,6 @@ struct StatGroup : public statistics::Group { StatGroup(statistics::Group *parent); - statistics::Scalar committedInsts; statistics::Scalar numVMExits; statistics::Scalar numVMHalfEntries; statistics::Scalar numExitSignal; diff --git a/src/cpu/minor/execute.cc b/src/cpu/minor/execute.cc index 5df00d3..4e0fa42 100644 --- a/src/cpu/minor/execute.cc +++ b/src/cpu/minor/execute.cc @@ -871,8 +871,6 @@ { thread->numInst++; thread->threadStats.numInsts++; - cpu.stats.numInsts++; - // update both old and new stas cpu.commitStats[inst->id.threadId]->numInsts++; cpu.baseStats.numInsts++; @@ -881,9 +879,7 @@ } thread->numOp++; thread->threadStats.numOps++; - cpu.stats.numOps++; cpu.commitStats[inst->id.threadId]->numOps++; - cpu.baseStats.numOps++; cpu.commitStats[inst->id.threadId] ->committedInstType[inst->staticInst->opClass()]++; diff --git a/src/cpu/minor/stats.cc b/src/cpu/minor/stats.cc index 818db8c..e4eebd3 100644 --- a/src/cpu/minor/stats.cc +++ b/src/cpu/minor/stats.cc @@ -45,28 +45,11 @@ MinorStats::MinorStats(BaseCPU *base_cpu) : statistics::Group(base_cpu), - ADD_STAT(numInsts, statistics::units::Count::get(), - "Number of instructions committed"), - ADD_STAT(numOps, statistics::units::Count::get(), - "Number of ops (including micro ops) committed"), ADD_STAT(quiesceCycles, statistics::units::Cycle::get(), "Total number of cycles that CPU has spent quiesced or waiting " - "for an interrupt"), - ADD_STAT(cpi, statistics::units::Rate< - statistics::units::Cycle, statistics::units::Count>::get(), - "CPI: cycles per instruction"), - ADD_STAT(ipc, statistics::units::Rate< - statistics::units::Count, statistics::units::Cycle>::get(), - "IPC: instructions per cycle") - + "for an interrupt") { quiesceCycles.prereq(quiesceCycles); - - cpi.precision(6); - cpi = base_cpu->baseStats.numCycles / numInsts; - - ipc.precision(6); - ipc = numInsts / base_cpu->baseStats.numCycles; } } // namespace minor diff --git a/src/cpu/minor/stats.hh b/src/cpu/minor/stats.hh index f7d5e71..98ac80f 100644 --- a/src/cpu/minor/stats.hh +++ b/src/cpu/minor/stats.hh @@ -59,19 +59,9 @@ { MinorStats(BaseCPU *parent); - /** Number of simulated instructions */ - statistics::Scalar numInsts; - - /** Number of simulated insts and microops */ - statistics::Scalar numOps; - /** Number of cycles in quiescent state */ statistics::Scalar quiesceCycles; - /** CPI/IPC for total cycle counts and macro insts */ - statistics::Formula cpi; - statistics::Formula ipc; - }; } // namespace minor diff --git a/src/cpu/o3/commit.cc b/src/cpu/o3/commit.cc index 266e59e..538505b 100644 --- a/src/cpu/o3/commit.cc +++ b/src/cpu/o3/commit.cc @@ -1343,7 +1343,6 @@ 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. diff --git a/src/cpu/simple/base.cc b/src/cpu/simple/base.cc index ca86b0b..b42b689 100644 --- a/src/cpu/simple/base.cc +++ b/src/cpu/simple/base.cc @@ -154,10 +154,8 @@ if (!curStaticInst->isMicroop() || curStaticInst->isLastMicroop()) { t_info.numInst++; - t_info.execContextStats.numInsts++; } t_info.numOp++; - t_info.execContextStats.numOps++; } void @@ -183,9 +181,8 @@ commitStats[t_info.thread->threadId()]->numInsts++; baseStats.numInsts++; } - // increment thread level and core level numOps count + // increment thread level numOps count commitStats[t_info.thread->threadId()]->numOps++; - baseStats.numOps++; } Counter diff --git a/src/cpu/simple/exec_context.hh b/src/cpu/simple/exec_context.hh index 9639f43..c8c7076 100644 --- a/src/cpu/simple/exec_context.hh +++ b/src/cpu/simple/exec_context.hh @@ -86,10 +86,6 @@ : statistics::Group(cpu, csprintf("exec_context.thread_%i", thread->threadId()).c_str()), - ADD_STAT(numInsts, statistics::units::Count::get(), - "Number of instructions committed"), - ADD_STAT(numOps, statistics::units::Count::get(), - "Number of ops (including micro ops) committed"), ADD_STAT(numMatAluAccesses, statistics::units::Count::get(), "Number of matrix alu accesses"), ADD_STAT(numCallsReturns, statistics::units::Count::get(), @@ -139,10 +135,6 @@ .prereq(numBranchMispred); } - // Number of simulated instructions - statistics::Scalar numInsts; - statistics::Scalar numOps; - // Number of matrix alu accesses statistics::Scalar numMatAluAccesses; -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/69109?usp=email To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: public/gem5 Gerrit-Branch: develop Gerrit-Change-Id: I45d0f6cb5c523e53c0602b5152a5108108476936 Gerrit-Change-Number: 69109 Gerrit-PatchSet: 13 Gerrit-Owner: Melissa Jost <melissakjost@gmail.com> Gerrit-Reviewer: Bobby Bruce <bbruce@ucdavis.edu> Gerrit-Reviewer: Gabe Black <gabe.black@gmail.com> Gerrit-Reviewer: Jason Lowe-Power <jason@lowepower.com> Gerrit-Reviewer: kokoro <noreply+kokoro@google.com>