stdlib: cpu support for SimPoint and MAX_INSTS exit events
BaseCPU.py: Linked "scheduleSimpointsInstStop" and "scheduleInstStopAnyThread" to python base.cc & base.hh: Added scheduling functions for SimPoint and MAX_INSTS exit event. abstract_core.py & base_cpu_core.py: Added scheduling functions for SimPoint and MAX_INSTS exit event for stdlib processor to access. Jira Issue: https://gem5.atlassian.net/browse/GEM5-1259 Change-Id: I98a0f93b46a220fdb3f350d8da359c24b4d66a58 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/63153 Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Maintainer: Jason Lowe-Power <power.jg@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com> Maintainer: Bobby Bruce <bbruce@ucdavis.edu> Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
This commit is contained in:
@@ -71,6 +71,8 @@ class BaseCPU(ClockedObject):
|
||||
PyBindMethod("totalInsts"),
|
||||
PyBindMethod("scheduleInstStop"),
|
||||
PyBindMethod("getCurrentInstCount"),
|
||||
PyBindMethod("scheduleSimpointsInstStop"),
|
||||
PyBindMethod("scheduleInstStopAnyThread"),
|
||||
]
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -275,9 +275,7 @@ BaseCPU::init()
|
||||
// Set up instruction-count-based termination events, if any. This needs
|
||||
// to happen after threadContexts has been constructed.
|
||||
if (params().max_insts_any_thread != 0) {
|
||||
const char *cause = "a thread reached the max instruction count";
|
||||
for (ThreadID tid = 0; tid < numThreads; ++tid)
|
||||
scheduleInstStop(tid, params().max_insts_any_thread, cause);
|
||||
scheduleInstStopAnyThread(params().max_insts_any_thread);
|
||||
}
|
||||
|
||||
// Set up instruction-count-based termination events for SimPoints
|
||||
@@ -285,13 +283,11 @@ BaseCPU::init()
|
||||
// Simulation.py is responsible to take the necessary actions upon
|
||||
// exitting the simulation loop.
|
||||
if (!params().simpoint_start_insts.empty()) {
|
||||
const char *cause = "simpoint starting point found";
|
||||
for (size_t i = 0; i < params().simpoint_start_insts.size(); ++i)
|
||||
scheduleInstStop(0, params().simpoint_start_insts[i], cause);
|
||||
scheduleSimpointsInstStop(params().simpoint_start_insts);
|
||||
}
|
||||
|
||||
if (params().max_insts_all_threads != 0) {
|
||||
const char *cause = "all threads reached the max instruction count";
|
||||
std::string cause = "all threads reached the max instruction count";
|
||||
|
||||
// allocate & initialize shared downcounter: each event will
|
||||
// decrement this when triggered; simulation will terminate
|
||||
@@ -661,7 +657,7 @@ BaseCPU::unserialize(CheckpointIn &cp)
|
||||
}
|
||||
|
||||
void
|
||||
BaseCPU::scheduleInstStop(ThreadID tid, Counter insts, const char *cause)
|
||||
BaseCPU::scheduleInstStop(ThreadID tid, Counter insts, std::string cause)
|
||||
{
|
||||
const Tick now(getCurrentInstCount(tid));
|
||||
Event *event(new LocalSimLoopExitEvent(cause, 0));
|
||||
@@ -727,6 +723,23 @@ BaseCPU::traceFunctionsInternal(Addr pc)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BaseCPU::scheduleSimpointsInstStop(std::vector<Counter> inst_starts)
|
||||
{
|
||||
std::string cause = "simpoint starting point found";
|
||||
for (size_t i = 0; i < inst_starts.size(); ++i) {
|
||||
scheduleInstStop(0, inst_starts[i], cause);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BaseCPU::scheduleInstStopAnyThread(Counter max_insts)
|
||||
{
|
||||
std::string cause = "a thread reached the max instruction count";
|
||||
for (ThreadID tid = 0; tid < numThreads; ++tid) {
|
||||
scheduleInstStop(tid, max_insts, cause);
|
||||
}
|
||||
}
|
||||
|
||||
BaseCPU::GlobalStats::GlobalStats(statistics::Group *parent)
|
||||
: statistics::Group(parent),
|
||||
|
||||
@@ -436,7 +436,28 @@ class BaseCPU : public ClockedObject
|
||||
* @param insts Number of instructions into the future.
|
||||
* @param cause Cause to signal in the exit event.
|
||||
*/
|
||||
void scheduleInstStop(ThreadID tid, Counter insts, const char *cause);
|
||||
void scheduleInstStop(ThreadID tid, Counter insts, std::string cause);
|
||||
|
||||
/**
|
||||
* Schedule simpoint events using the scheduleInstStop function.
|
||||
*
|
||||
* This is used to raise a SIMPOINT_BEGIN exit event in the gem5 standard
|
||||
* library.
|
||||
*
|
||||
* @param inst_starts A vector of number of instructions to start simpoints
|
||||
*/
|
||||
|
||||
void scheduleSimpointsInstStop(std::vector<Counter> inst_starts);
|
||||
|
||||
/**
|
||||
* Schedule an exit event when any threads in the core reach the max_insts
|
||||
* instructions using the scheduleInstStop function.
|
||||
*
|
||||
* This is used to raise a MAX_INSTS exit event in thegem5 standard library
|
||||
*
|
||||
* @param max_insts Number of instructions into the future.
|
||||
*/
|
||||
void scheduleInstStopAnyThread(Counter max_insts);
|
||||
|
||||
/**
|
||||
* Get the number of instructions executed by the specified thread
|
||||
|
||||
Reference in New Issue
Block a user