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>
This commit is contained in:
Bobby R. Bruce
2022-10-13 14:24:06 -07:00
committed by Bobby Bruce
parent f1be0c808a
commit 36e5feb0de
2 changed files with 17 additions and 5 deletions

View File

@@ -129,7 +129,9 @@ def max_inst():
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 @@ simulator = Simulator(
# 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()

View File

@@ -123,15 +123,16 @@ class SEBinaryWorkload:
# 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 @@ class SEBinaryWorkload:
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.")