gem5-dev@gem5.org

The gem5 Developer List

View all threads

[S] Change in gem5/gem5[develop]: stdlib: Fix SwitchableProcessor use in SE mode

BB
Bobby Bruce (Gerrit)
Mon, Apr 17, 2023 4:32 PM

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

Change subject: stdlib: Fix SwitchableProcessor use in SE mode
......................................................................

stdlib: Fix SwitchableProcessor use in SE mode

The SwitchableProcessors in the standard library have switched-in and
switched-out cores. The get_cores API in the stdlib only returns
switched-in cores. In most uses this is desirable.

In the case of setting workloads in SE mode it's necessary to set the
workload to every core, switched-in and switched-out. As the get_cores
function was used for this, SwitchableProcessors were failing when used
in SE Mode.

This patch checks the processor type and, if a SwitchableProcessor, uses
the SwitchableProcessor's special _all_cores function which gets all
the cores, regardless as to their switched-in/switched-out status.

Issue-on: https://gem5.atlassian.net/browse/GEM5-1320

Change-Id: I0b7a699ac6196e827667955bef7afa37b2648744
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/68997
Reviewed-by: Jason Lowe-Power power.jg@gmail.com
Tested-by: kokoro noreply+kokoro@google.com
Maintainer: Bobby Bruce bbruce@ucdavis.edu
Reviewed-by: Bobby Bruce bbruce@ucdavis.edu

M src/python/gem5/components/boards/se_binary_workload.py
1 file changed, 19 insertions(+), 2 deletions(-)

Approvals:
Bobby Bruce: Looks good to me, approved; Looks good to me, approved
kokoro: Regressions pass
Jason Lowe-Power: Looks good to me, approved

diff --git a/src/python/gem5/components/boards/se_binary_workload.py
b/src/python/gem5/components/boards/se_binary_workload.py
index 98fe840..c62a1b6 100644
--- a/src/python/gem5/components/boards/se_binary_workload.py
+++ b/src/python/gem5/components/boards/se_binary_workload.py
@@ -35,6 +35,8 @@
SimpointDirectoryResource,
)

+from ..processors.switchable_processor import SwitchableProcessor
+
from gem5.resources.elfie import ELFieInfo
from gem5.resources.looppoint import Looppoint

@@ -112,8 +114,23 @@
if env_list is not None:
process.env = env_list

  •    for core in self.get_processor().get_cores():
    
  •        core.set_workload(process)
    
  •    if isinstance(self.get_processor(), SwitchableProcessor):
    
  •        # This is a hack to get switchable processors working  
    

correctly in

  •        # SE mode. The "get_cores" API for processors only gets the  
    

current

  •        # switched-in cores and, in most cases, this is what the script
    
  •        # required. In the case there are switched-out cores via the
    
  •        # SwitchableProcessor, we sometimes need to apply things to ALL
    
  •        # cores (switched-in or switched-out). In this case we have an
    
  •        # `__all_cores` function. Here we must apply the process to  
    

every

  •        # core.
    
  •        #
    
  •        # A better API for this which avoids `isinstance` checks would  
    

be

  •        # welcome.
    
  •        for core in self.get_processor()._all_cores():
    
  •            core.set_workload(process)
    
  •    else:
    
  •        for core in self.get_processor().get_cores():
    
  •            core.set_workload(process)
    
        # Set whether to exit on work items for the se_workload
        self.exit_on_work_items = exit_on_work_items
    

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

Gerrit-MessageType: merged
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I0b7a699ac6196e827667955bef7afa37b2648744
Gerrit-Change-Number: 68997
Gerrit-PatchSet: 4
Gerrit-Owner: Bobby Bruce bbruce@ucdavis.edu
Gerrit-Reviewer: Bobby Bruce bbruce@ucdavis.edu
Gerrit-Reviewer: Jason Lowe-Power power.jg@gmail.com
Gerrit-Reviewer: kokoro noreply+kokoro@google.com

Bobby Bruce has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/68997?usp=email ) Change subject: stdlib: Fix SwitchableProcessor use in SE mode ...................................................................... stdlib: Fix SwitchableProcessor use in SE mode The SwitchableProcessors in the standard library have switched-in and switched-out cores. The `get_cores` API in the stdlib only returns switched-in cores. In most uses this is desirable. In the case of setting workloads in SE mode it's necessary to set the workload to every core, switched-in and switched-out. As the `get_cores` function was used for this, SwitchableProcessors were failing when used in SE Mode. This patch checks the processor type and, if a SwitchableProcessor, uses the SwitchableProcessor's special `_all_cores` function which gets all the cores, regardless as to their switched-in/switched-out status. Issue-on: https://gem5.atlassian.net/browse/GEM5-1320 Change-Id: I0b7a699ac6196e827667955bef7afa37b2648744 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/68997 Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com> Maintainer: Bobby Bruce <bbruce@ucdavis.edu> Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu> --- M src/python/gem5/components/boards/se_binary_workload.py 1 file changed, 19 insertions(+), 2 deletions(-) Approvals: Bobby Bruce: Looks good to me, approved; Looks good to me, approved kokoro: Regressions pass Jason Lowe-Power: Looks good to me, approved diff --git a/src/python/gem5/components/boards/se_binary_workload.py b/src/python/gem5/components/boards/se_binary_workload.py index 98fe840..c62a1b6 100644 --- a/src/python/gem5/components/boards/se_binary_workload.py +++ b/src/python/gem5/components/boards/se_binary_workload.py @@ -35,6 +35,8 @@ SimpointDirectoryResource, ) +from ..processors.switchable_processor import SwitchableProcessor + from gem5.resources.elfie import ELFieInfo from gem5.resources.looppoint import Looppoint @@ -112,8 +114,23 @@ if env_list is not None: process.env = env_list - for core in self.get_processor().get_cores(): - core.set_workload(process) + if isinstance(self.get_processor(), SwitchableProcessor): + # This is a hack to get switchable processors working correctly in + # SE mode. The "get_cores" API for processors only gets the current + # switched-in cores and, in most cases, this is what the script + # required. In the case there are switched-out cores via the + # SwitchableProcessor, we sometimes need to apply things to ALL + # cores (switched-in or switched-out). In this case we have an + # `__all_cores` function. Here we must apply the process to every + # core. + # + # A better API for this which avoids `isinstance` checks would be + # welcome. + for core in self.get_processor()._all_cores(): + core.set_workload(process) + else: + for core in self.get_processor().get_cores(): + core.set_workload(process) # Set whether to exit on work items for the se_workload self.exit_on_work_items = exit_on_work_items -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/68997?usp=email To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings Gerrit-MessageType: merged Gerrit-Project: public/gem5 Gerrit-Branch: develop Gerrit-Change-Id: I0b7a699ac6196e827667955bef7afa37b2648744 Gerrit-Change-Number: 68997 Gerrit-PatchSet: 4 Gerrit-Owner: Bobby Bruce <bbruce@ucdavis.edu> Gerrit-Reviewer: Bobby Bruce <bbruce@ucdavis.edu> Gerrit-Reviewer: Jason Lowe-Power <power.jg@gmail.com> Gerrit-Reviewer: kokoro <noreply+kokoro@google.com>