From e86ad367b7cd7ef863542f3848d9233133fbddd9 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Wed, 9 Oct 2019 22:29:36 -0700 Subject: [PATCH] cpu: Get rid of load count based events. This was initially added in 2003 and only supported in the simple CPUs. It's oddly specific since there are no other similar event queues for, for instance, stores, branches, system calls, etc. Given that this seems like a historical oddity which is only partially supported and would be very hard to support on more diverse CPU types like KVM or fast model which don't generally have hooks for counts of specific instruction types. Change-Id: I29209b7ffcf896cf424b71545c9c7546f439e2b9 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/21780 Reviewed-by: Brandon Potter Maintainer: Gabe Black Tested-by: kokoro --- src/cpu/BaseCPU.py | 5 ----- src/cpu/base.cc | 33 --------------------------------- src/cpu/base.hh | 22 ---------------------- src/cpu/dummy_checker.cc | 1 - src/cpu/o3/checker.cc | 1 - src/cpu/simple/base.cc | 1 - 6 files changed, 63 deletions(-) diff --git a/src/cpu/BaseCPU.py b/src/cpu/BaseCPU.py index 0e8c28917..85e37776e 100644 --- a/src/cpu/BaseCPU.py +++ b/src/cpu/BaseCPU.py @@ -122,7 +122,6 @@ class BaseCPU(ClockedObject): PyBindMethod("flushTLBs"), PyBindMethod("totalInsts"), PyBindMethod("scheduleInstStop"), - PyBindMethod("scheduleLoadStop"), PyBindMethod("getCurrentInstCount"), ] @@ -196,10 +195,6 @@ class BaseCPU(ClockedObject): "terminate when any thread reaches this inst count") simpoint_start_insts = VectorParam.Counter([], "starting instruction counts of simpoints") - max_loads_all_threads = Param.Counter(0, - "terminate when all threads have reached this load count") - max_loads_any_thread = Param.Counter(0, - "terminate when any thread reaches this load count") progress_interval = Param.Frequency('0Hz', "frequency to print out the progress message") diff --git a/src/cpu/base.cc b/src/cpu/base.cc index 5bc3fe7c7..7e0e79e96 100644 --- a/src/cpu/base.cc +++ b/src/cpu/base.cc @@ -195,32 +195,9 @@ BaseCPU::BaseCPU(Params *p, bool is_checker) } } - // allocate per-thread load-based event queues - comLoadEventQueue = new EventQueue *[numThreads]; - for (ThreadID tid = 0; tid < numThreads; ++tid) - comLoadEventQueue[tid] = new EventQueue("load-based event queue"); - // // set up instruction-count-based termination events, if any // - if (p->max_loads_any_thread != 0) { - const char *cause = "a thread reached the max load count"; - for (ThreadID tid = 0; tid < numThreads; ++tid) - scheduleLoadStop(tid, p->max_loads_any_thread, cause); - } - - if (p->max_loads_all_threads != 0) { - const char *cause = "all threads reached the max load count"; - // allocate & initialize shared downcounter: each event will - // decrement this when triggered; simulation will terminate - // when counter reaches 0 - int *counter = new int; - *counter = numThreads; - for (ThreadID tid = 0; tid < numThreads; ++tid) { - Event *event = new CountedExitEvent(cause, *counter); - comLoadEventQueue[tid]->schedule(event, p->max_loads_all_threads); - } - } functionTracingEnabled = false; if (p->function_trace) { @@ -273,7 +250,6 @@ BaseCPU::enableFunctionTrace() BaseCPU::~BaseCPU() { delete profileEvent; - delete[] comLoadEventQueue; delete[] comInstEventQueue; } @@ -781,15 +757,6 @@ bool AddressMonitor::doMonitor(PacketPtr pkt) { return false; } -void -BaseCPU::scheduleLoadStop(ThreadID tid, Counter loads, const char *cause) -{ - const Tick now(comLoadEventQueue[tid]->getCurTick()); - Event *event(new LocalSimLoopExitEvent(cause, 0)); - - comLoadEventQueue[tid]->schedule(event, now + loads); -} - void BaseCPU::traceFunctionsInternal(Addr pc) diff --git a/src/cpu/base.hh b/src/cpu/base.hh index dfee21fab..383ae8185 100644 --- a/src/cpu/base.hh +++ b/src/cpu/base.hh @@ -390,13 +390,6 @@ class BaseCPU : public ClockedObject */ EventQueue **comInstEventQueue; - /** - * Vector of per-thread load-based event queues. Used for - * scheduling events based on number of loads committed by - *a particular thread. - */ - EventQueue **comLoadEventQueue; - System *system; /** @@ -463,21 +456,6 @@ class BaseCPU : public ClockedObject */ void scheduleInstStop(ThreadID tid, Counter insts, const char *cause); - /** - * Schedule an event that exits the simulation loops after a - * predefined number of load operations. - * - * This method is usually called from the configuration script to - * get an exit event some time in the future. It is typically used - * when the script wants to simulate for a specific number of - * loads rather than ticks. - * - * @param tid Thread monitor. - * @param loads Number of load instructions into the future. - * @param cause Cause to signal in the exit event. - */ - void scheduleLoadStop(ThreadID tid, Counter loads, const char *cause); - /** * Get the number of instructions executed by the specified thread * on this CPU. Used by Python to control simulation. diff --git a/src/cpu/dummy_checker.cc b/src/cpu/dummy_checker.cc index c42c8b5d6..d119d6189 100644 --- a/src/cpu/dummy_checker.cc +++ b/src/cpu/dummy_checker.cc @@ -48,7 +48,6 @@ DummyCheckerParams::create() // cpu and therefore any parameters for early exit don't make much // sense. fatal_if(max_insts_any_thread || max_insts_all_threads || - max_loads_any_thread || max_loads_all_threads || progress_interval, "Invalid checker parameters"); return new DummyChecker(this); diff --git a/src/cpu/o3/checker.cc b/src/cpu/o3/checker.cc index 1713da7c1..fdf7ec654 100644 --- a/src/cpu/o3/checker.cc +++ b/src/cpu/o3/checker.cc @@ -55,7 +55,6 @@ O3CheckerParams::create() // cpu and therefore any parameters for early exit don't make much // sense. fatal_if(max_insts_any_thread || max_insts_all_threads || - max_loads_any_thread || max_loads_all_threads || progress_interval, "Invalid checker parameters"); return new O3Checker(this); diff --git a/src/cpu/simple/base.cc b/src/cpu/simple/base.cc index b93ae0912..461f00fca 100644 --- a/src/cpu/simple/base.cc +++ b/src/cpu/simple/base.cc @@ -600,7 +600,6 @@ BaseSimpleCPU::postExecute() if (curStaticInst->isLoad()) { ++t_info.numLoad; - comLoadEventQueue[curThread]->serviceEvents(t_info.numLoad); } if (CPA::available()) { -- 2.30.2