stdlib: Update AbstractCore set_simpoint func
This change: - Makes this function private. - Adds better documentation describing the usage. - Changes the 'init' param to 'board_initialized' This function really doesn't make much sense to set directly by an stdlib user. It requires knowing whether or not the the board has been initialized which is an annoying detail and will cause error if set incorrectly. The logic of the `init` parameter has been flipped to be `board_initialized`. This makes it clearer what the parameter is doing and what it's for. The documentation for this function has been updated to make it clearer on how the `board_initialized` parameter should be used correctly. Change-Id: I567a48df06e6327b38673a2c510065d4334657e2 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/64832 Reviewed-by: Melissa Jost <mkjost@ucdavis.edu> Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Maintainer: Bobby Bruce <bbruce@ucdavis.edu> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Bobby Bruce
parent
905b71c375
commit
12d8d5ca26
@@ -149,9 +149,9 @@ class SEBinaryWorkload:
|
||||
|
||||
if self.get_processor().get_num_cores() > 1:
|
||||
warn("SimPoints only works with one core")
|
||||
self.get_processor().get_cores()[0].set_simpoint(
|
||||
self.get_processor().get_cores()[0]._set_simpoint(
|
||||
inst_starts=self._simpoint_object.get_simpoint_start_insts(),
|
||||
init=True,
|
||||
board_initialized=False,
|
||||
)
|
||||
|
||||
# Call set_se_binary_workload after SimPoint setup is complete
|
||||
|
||||
@@ -122,17 +122,20 @@ class AbstractCore(SubSystem):
|
||||
raise NotImplementedError
|
||||
|
||||
@abstractmethod
|
||||
def set_simpoint(self, inst_starts: List[int], init: bool) -> None:
|
||||
def _set_simpoint(
|
||||
self, inst_starts: List[int], board_initialized: bool
|
||||
) -> None:
|
||||
"""Schedule simpoint exit events for the core.
|
||||
|
||||
This is used to raise SIMPOINT_BEGIN exit events in the gem5 standard
|
||||
library. Duplicate instruction counts in the inst_starts list will not
|
||||
library. This is called through the set_workload functions and should
|
||||
not be called directly. Duplicate instruction counts in the inst_starts list will not
|
||||
be scheduled.
|
||||
|
||||
:param inst_starts: a list of SimPoints starting instructions
|
||||
:param init: if it is True, the starting instructions will be scheduled
|
||||
at the init stage of the core, else, the starting insructions will be
|
||||
scheduled during the simulation
|
||||
:param board_initialized: True if the board has already been
|
||||
initialized, otherwise False. This parameter is necessary as simpoints
|
||||
are setup differently dependent on this.
|
||||
"""
|
||||
raise NotImplementedError("This core type does not support simpoints")
|
||||
|
||||
|
||||
@@ -153,11 +153,13 @@ class BaseCPUCore(AbstractCore):
|
||||
return self.core.mmu
|
||||
|
||||
@overrides(AbstractCore)
|
||||
def set_simpoint(self, inst_starts: List[int], init: bool) -> None:
|
||||
if init:
|
||||
self.core.simpoint_start_insts = sorted(set(inst_starts))
|
||||
else:
|
||||
def _set_simpoint(
|
||||
self, inst_starts: List[int], board_initialized: bool
|
||||
) -> None:
|
||||
if board_initialized:
|
||||
self.core.scheduleSimpointsInstStop(sorted(set(inst_starts)))
|
||||
else:
|
||||
self.core.simpoint_start_insts = sorted(set(inst_starts))
|
||||
|
||||
@overrides(AbstractCore)
|
||||
def set_inst_stop_any_thread(self, inst: int, init: bool) -> None:
|
||||
|
||||
@@ -236,9 +236,7 @@ class Simulator:
|
||||
|
||||
self._checkpoint_path = checkpoint_path
|
||||
|
||||
def schedule_simpoint(
|
||||
self, simpoint_start_insts: List[int], schedule_at_init: bool = False
|
||||
) -> None:
|
||||
def schedule_simpoint(self, simpoint_start_insts: List[int]) -> None:
|
||||
"""
|
||||
Schedule SIMPOINT_BEGIN exit events
|
||||
|
||||
@@ -246,13 +244,11 @@ class Simulator:
|
||||
|
||||
:param simpoint_start_insts: a list of number of instructions
|
||||
indicating the starting point of the simpoints
|
||||
:param schedule_at_init: if it is True, schedule the events in the init
|
||||
stage of the core, else, schedule the events during the simulation
|
||||
"""
|
||||
if self._board.get_processor().get_num_cores() > 1:
|
||||
warn("SimPoints only work with one core")
|
||||
self._board.get_processor().get_cores()[0].set_simpoint(
|
||||
simpoint_start_insts, schedule_at_init
|
||||
simpoint_start_insts, self._instantiated
|
||||
)
|
||||
|
||||
def schedule_max_insts(
|
||||
|
||||
Reference in New Issue
Block a user