Bobby Bruce has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/64833?usp=email )

Change subject: stdlib: Update AbstractCore's 'set_inst_stop_any_thread'
......................................................................

stdlib: Update AbstractCore's 'set_inst_stop_any_thread'

This patch:
- Makes this function private.
- Updates the function's documentation.
- Changes the 'init' parameter to 'board_initialized'.

It doesn't make much sense for this function to be exposed directly to
the user as it requires knowing whether the board is initialized or not.

In addition to this I believe it makes more sense for the 'init' logic
to be flipped and renamed "board_initialized' so that this value is True
if the board has been initialized.

The documentation for this function has been updated.

Change-Id: I016c65bde88357111d3e648d7aa99aeb6e31f410
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/64833
Maintainer: Bobby Bruce <bbr...@ucdavis.edu>
Reviewed-by: Bobby Bruce <bbr...@ucdavis.edu>
Tested-by: kokoro <noreply+kok...@google.com>
---
M configs/example/gem5_library/checkpoints/simpoints-se-restore.py
M src/python/gem5/components/processors/abstract_core.py
M src/python/gem5/components/processors/base_cpu_core.py
M src/python/gem5/simulate/simulator.py
4 files changed, 48 insertions(+), 21 deletions(-)

Approvals:
  Bobby Bruce: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass




diff --git a/configs/example/gem5_library/checkpoints/simpoints-se-restore.py b/configs/example/gem5_library/checkpoints/simpoints-se-restore.py
index b529672..f8f48d0 100644
--- a/configs/example/gem5_library/checkpoints/simpoints-se-restore.py
+++ b/configs/example/gem5_library/checkpoints/simpoints-se-restore.py
@@ -132,5 +132,5 @@
 # is greater than 0.
 # In here, it schedules an exit event for the first SimPoint's warmup
 # instructions
-simulator.schedule_max_insts(board.get_simpoint().get_warmup_list()[0], True)
+simulator.schedule_max_insts(board.get_simpoint().get_warmup_list()[0])
 simulator.run()
diff --git a/src/python/gem5/components/processors/abstract_core.py b/src/python/gem5/components/processors/abstract_core.py
index ea2875e..58296bc 100644
--- a/src/python/gem5/components/processors/abstract_core.py
+++ b/src/python/gem5/components/processors/abstract_core.py
@@ -140,15 +140,18 @@
raise NotImplementedError("This core type does not support simpoints")

     @abstractmethod
-    def set_inst_stop_any_thread(self, inst: int, init: bool) -> None:
+    def _set_inst_stop_any_thread(
+        self, inst: int, board_initialized: bool
+    ) -> None:
         """Schedule an exit event when any thread in this core reaches the
-        given number of instructions.
+        given number of instructions. This is called through the simulator
+        module and should not be called directly.

This is used to raise MAX_INSTS exit event in the gem5 standard library

         :param inst: a number of instructions
-        :param init: if it is True, the exit event will be scheduled at the
-        init stage of the core, else, it will be scheduled during the
-        simulation
+        :param board_initialized: True if the board has already been
+        initialized, otherwise False. This parameter is necessary as the
+        instruction stop is setup differently dependent on this.
         """
raise NotImplementedError("This core type does not support MAX_INSTS") diff --git a/src/python/gem5/components/processors/base_cpu_core.py b/src/python/gem5/components/processors/base_cpu_core.py
index 535a800..631fd0a 100644
--- a/src/python/gem5/components/processors/base_cpu_core.py
+++ b/src/python/gem5/components/processors/base_cpu_core.py
@@ -162,8 +162,10 @@
             self.core.simpoint_start_insts = sorted(set(inst_starts))

     @overrides(AbstractCore)
-    def set_inst_stop_any_thread(self, inst: int, init: bool) -> None:
-        if init:
-            self.core.max_insts_any_thread = inst
-        else:
+    def _set_inst_stop_any_thread(
+        self, inst: int, board_initialized: bool
+    ) -> None:
+        if board_initialized:
             self.core.scheduleInstStopAnyThread(inst)
+        else:
+            self.core.max_insts_any_thread = inst
diff --git a/src/python/gem5/simulate/simulator.py b/src/python/gem5/simulate/simulator.py
index d7e2141..0d2917d 100644
--- a/src/python/gem5/simulate/simulator.py
+++ b/src/python/gem5/simulate/simulator.py
@@ -251,20 +251,15 @@
             simpoint_start_insts, self._instantiated
         )

-    def schedule_max_insts(
-        self, inst: int, schedule_at_init: bool = False
-    ) -> None:
+    def schedule_max_insts(self, inst: int) -> None:
         """
-        Schedule a MAX_INSTS exit event when any thread in the current core
-        reaches the given number of instructions
+ Schedule a MAX_INSTS exit event when any thread in any core reaches the
+        given number of instructions.

-        :param insts: a number of instructions
- :param schedule_at_init: if it is True, schedule the event in the init
-        stage of the core, else, schedule the event during the simulation
+        :param insts: a number of instructions to run to.
         """
- self._board.get_processor().get_cores()[0].set_inst_stop_any_thread(
-            inst, schedule_at_init
-        )
+        for core in self._board.get_processor().get_cores():
+            core._set_inst_stop_any_thread(inst, self._instantiated)

     def get_stats(self) -> Dict:
         """

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/64833?usp=email To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I016c65bde88357111d3e648d7aa99aeb6e31f410
Gerrit-Change-Number: 64833
Gerrit-PatchSet: 8
Gerrit-Owner: Bobby Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Bobby Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Jason Lowe-Power <power...@gmail.com>
Gerrit-Reviewer: Melissa Jost <mkj...@ucdavis.edu>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org

Reply via email to