changeset a3b41de1c4f1 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=a3b41de1c4f1
description:
sim: Add an option to forward work items to Python
There are cases where we want the Python world to handle work items
instead of the C++ world. However, that's currently not possible. This
changeset adds the forward_work_items option to the System class. Then
it is set to True, work items will generate workbegin/workend
simulation exists with the work item ID as the exit code and the old
C++ handling is completely bypassed.
diffstat:
src/sim/System.py | 2 ++
src/sim/pseudo_inst.cc | 24 +++++++++++++++++-------
2 files changed, 19 insertions(+), 7 deletions(-)
diffs (66 lines):
diff -r 33434d6cbd20 -r a3b41de1c4f1 src/sim/System.py
--- a/src/sim/System.py Mon Jul 20 09:15:18 2015 -0500
+++ b/src/sim/System.py Mon Dec 14 17:10:36 2015 +0000
@@ -73,6 +73,8 @@
cache_line_size = Param.Unsigned(64, "Cache line size in bytes")
+ exit_on_work_items = Param.Bool(True, "Exit from the simulation loop when "
+ "encountering work item annotations.")
work_item_id = Param.Int(-1, "specific work item id")
num_work_ids = Param.Int(16, "Number of distinct work item types")
work_begin_cpu_id_exit = Param.Int(-1,
diff -r 33434d6cbd20 -r a3b41de1c4f1 src/sim/pseudo_inst.cc
--- a/src/sim/pseudo_inst.cc Mon Jul 20 09:15:18 2015 -0500
+++ b/src/sim/pseudo_inst.cc Mon Dec 14 17:10:36 2015 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2012 ARM Limited
+ * Copyright (c) 2010-2012, 2015 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
@@ -616,14 +616,19 @@
workbegin(ThreadContext *tc, uint64_t workid, uint64_t threadid)
{
DPRINTF(PseudoInst, "PseudoInst::workbegin(%i, %i)\n", workid, threadid);
- tc->getCpuPtr()->workItemBegin();
System *sys = tc->getSystemPtr();
const System::Params *params = sys->params();
+
+ if (params->exit_on_work_items) {
+ exitSimLoop("workbegin", static_cast<int>(workid));
+ return;
+ }
+
+ DPRINTF(WorkItems, "Work Begin workid: %d, threadid %d\n", workid,
+ threadid);
+ tc->getCpuPtr()->workItemBegin();
sys->workItemBegin(threadid, workid);
- DPRINTF(WorkItems, "Work Begin workid: %d, threadid %d\n", workid,
- threadid);
-
//
// If specified, determine if this is the specific work item the user
// identified
@@ -674,12 +679,17 @@
workend(ThreadContext *tc, uint64_t workid, uint64_t threadid)
{
DPRINTF(PseudoInst, "PseudoInst::workend(%i, %i)\n", workid, threadid);
- tc->getCpuPtr()->workItemEnd();
System *sys = tc->getSystemPtr();
const System::Params *params = sys->params();
- sys->workItemEnd(threadid, workid);
+
+ if (params->exit_on_work_items) {
+ exitSimLoop("workend", static_cast<int>(workid));
+ return;
+ }
DPRINTF(WorkItems, "Work End workid: %d, threadid %d\n", workid, threadid);
+ tc->getCpuPtr()->workItemEnd();
+ sys->workItemEnd(threadid, workid);
//
// If specified, determine if this is the specific work item the user
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev