stdlib: add 'get_simpoint' function to se_binary_workload.py
This function is necessary to obtain the workload from a board once set.
This is a stop-gap solution to get SimPoints working with SE workloads
but will need revision when implementing this functionality for FS.
Change-Id: Ided2b1a5867655a98730879524e0be61c3f20295
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/64551
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Melissa Jost <mkjost@ucdavis.edu>
diff --git a/configs/example/gem5_library/checkpoints/simpoints-se-restore.py b/configs/example/gem5_library/checkpoints/simpoints-se-restore.py
index 82b56b5..aacddd7 100644
--- a/configs/example/gem5_library/checkpoints/simpoints-se-restore.py
+++ b/configs/example/gem5_library/checkpoints/simpoints-se-restore.py
@@ -129,7 +129,9 @@
print("end of warmup, starting to simulate SimPoint")
warmed_up = True
# Schedule a MAX_INSTS exit event during the simulation
- simulator.schedule_max_insts(simpoint.get_simpoint_interval())
+ simulator.schedule_max_insts(
+ board.get_simpoint().get_simpoint_interval()
+ )
dump()
reset()
yield False
@@ -146,5 +148,5 @@
# is greater than 0.
# In here, it schedules an exit event for the first SimPoint's warmup
# instructions
-simulator.schedule_max_insts(simpoint.get_warmup_list()[0], True)
+simulator.schedule_max_insts(board.get_simpoint().get_warmup_list()[0], True)
simulator.run()
diff --git a/src/python/gem5/components/boards/se_binary_workload.py b/src/python/gem5/components/boards/se_binary_workload.py
index 545dc40..7713b11 100644
--- a/src/python/gem5/components/boards/se_binary_workload.py
+++ b/src/python/gem5/components/boards/se_binary_workload.py
@@ -123,15 +123,16 @@
# convert input to SimPoint if necessary
if isinstance(simpoint, AbstractResource):
- simpoint_object = SimPoint(simpoint)
+ self._simpoint_object = SimPoint(simpoint)
else:
assert isinstance(simpoint, SimPoint)
- simpoint_object = simpoint
+ self._simpoint_object = simpoint
if self.get_processor().get_num_cores() > 1:
warn("SimPoints only works with one core")
self.get_processor().get_cores()[0].set_simpoint(
- inst_starts=simpoint_object.get_simpoint_start_insts(), init=True
+ inst_starts=self._simpoint_object.get_simpoint_start_insts(),
+ init=True,
)
# Call set_se_binary_workload after SimPoint setup is complete
@@ -139,3 +140,12 @@
binary=binary,
arguments=arguments,
)
+
+ def get_simpoint(self) -> SimPoint:
+ """
+ Returns the SimPoint object set. If no SimPoint object has been set an
+ exception is thrown.
+ """
+ if getattr(self, "_simpoint_object", None):
+ return self._simpoint_object
+ raise Exception("This board does not have a simpoint set.")