[gem5-dev] [L] Change in gem5/gem5[develop]: stdlib: Added stdlib LoopPoint classes
Zhantong Qiu has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/67195?usp=email ) ( 13 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: stdlib: Added stdlib LoopPoint classes .. stdlib: Added stdlib LoopPoint classes LoopPoint is a multithreaded workload sampling method that targets PCs and PC execution counts. The main idea for LoopPoint is to base the beginning and end of the simjulation sample on the number of times a particular loop (PC) has been executed globally across all threads in a region that partitioned with a set length of instruction counts. This in some senses generalizes SimPoint which use the instruction count of a single thread. The link to the paper: https://ieeexplore.ieee.org/document/9773236 The LoopPointCheckpoint is designed to take in LoopPoint data file and generate the information needed to take checkpoints for LoopPoint regions(warmup regions+simulation region) The LoopPointRestore is designed to take in the LoopPOint data file and generate information needed to to restore a checkpoint taken by the LoopPOintCheckpoint. The LoopPoint is the parent class for LoopPointCheckpoint and LoopPointRestore. Change-Id: I595b0ff9d350c7c496639748a9c63ecc61fbaec9 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/67195 Tested-by: kokoro Reviewed-by: Bobby Bruce Maintainer: Bobby Bruce --- M src/python/SConscript M src/python/gem5/components/processors/abstract_core.py M src/python/gem5/components/processors/base_cpu_core.py A src/python/gem5/utils/looppoint.py 4 files changed, 461 insertions(+), 2 deletions(-) Approvals: Bobby Bruce: Looks good to me, approved; Looks good to me, approved kokoro: Regressions pass diff --git a/src/python/SConscript b/src/python/SConscript index aeeb892..68b5e1d 100644 --- a/src/python/SConscript +++ b/src/python/SConscript @@ -240,6 +240,7 @@ PySource('gem5.components.processors', 'gem5/components/processors/switchable_processor.py') PySource('gem5.utils', 'gem5/utils/simpoint.py') +PySource('gem5.utils', 'gem5/utils/looppoint.py') PySource('gem5.components.processors', 'gem5/components/processors/traffic_generator_core.py') PySource('gem5.components.processors', diff --git a/src/python/gem5/components/processors/abstract_core.py b/src/python/gem5/components/processors/abstract_core.py index 58296bc..8259df8 100644 --- a/src/python/gem5/components/processors/abstract_core.py +++ b/src/python/gem5/components/processors/abstract_core.py @@ -29,7 +29,8 @@ from ...isas import ISA -from m5.objects import BaseMMU, Port, SubSystem +from m5.objects import BaseMMU, Port, SubSystem, PcCountTrackerManager +from m5.params import PcCountPair class AbstractCore(SubSystem): @@ -155,3 +156,9 @@ instruction stop is setup differently dependent on this. """ raise NotImplementedError("This core type does not support MAX_INSTS") + +@abstractmethod +def add_pc_tracker_probe( +self, target_pair: List[PcCountPair], manager: PcCountTrackerManager +) -> None: +raise NotImplementedError diff --git a/src/python/gem5/components/processors/base_cpu_core.py b/src/python/gem5/components/processors/base_cpu_core.py index 631fd0a..c75c002 100644 --- a/src/python/gem5/components/processors/base_cpu_core.py +++ b/src/python/gem5/components/processors/base_cpu_core.py @@ -33,7 +33,15 @@ from ...utils.override import overrides from ...utils.requires import requires -from m5.objects import BaseMMU, Port, BaseCPU, Process +from m5.objects import ( +BaseMMU, +Port, +BaseCPU, +Process, +PcCountTracker, +PcCountTrackerManager, +) +from m5.params import PcCountPair class BaseCPUCore(AbstractCore): @@ -169,3 +177,13 @@ self.core.scheduleInstStopAnyThread(inst) else: self.core.max_insts_any_thread = inst + +@overrides(AbstractCore) +def add_pc_tracker_probe( +self, target_pair: List[PcCountPair], manager: PcCountTrackerManager +) -> None: +pair_tracker = PcCountTracker() +pair_tracker.targets = target_pair +pair_tracker.core = self.core +pair_tracker.ptmanager = manager +self.core.probeListener = pair_tracker diff --git a/src/python/gem5/utils/looppoint.py b/src/python/gem5/utils/looppoint.py new file mode 100644 index 000..b681e75 --- /dev/null +++ b/src/python/gem5/utils/looppoint.py @@ -0,0 +1,401 @@ +# Copyright (c) 2022 The Regents of the University of California +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: redistributions of source code must retain the above copyright +# notice, this list of conditions and the following
[gem5-dev] [L] Change in gem5/gem5[develop]: stdlib: Added stdlib LoopPoint classes
Zhantong Qiu has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/67195?usp=email ) Change subject: stdlib: Added stdlib LoopPoint classes .. stdlib: Added stdlib LoopPoint classes LoopPoint is a multithreaded workload sampling method that targets PCs and PC execution counts. The main idea for LoopPoint is to base the beginning and end of the simjulation sample on the number of times a particular loop (PC) has been executed globally across all threads in a region that partitioned with a set length of instruction counts. This in some senses generalizes SimPoint which use the instruction count of a single thread. The link to the paper: https://ieeexplore.ieee.org/document/9773236 The LoopPointCheckpoint is designed to take in LoopPoint data file and generate the information needed to take checkpoints for LoopPoint regions(warmup regions+simulation region) The LoopPointRestore is designed to take in the LoopPOint data file and generate information needed to to restore a checkpoint taken by the LoopPOintCheckpoint. The LoopPoint is the parent class for LoopPointCheckpoint and LoopPointRestore. Change-Id: I595b0ff9d350c7c496639748a9c63ecc61fbaec9 --- M src/python/SConscript M src/python/gem5/components/processors/abstract_core.py M src/python/gem5/components/processors/base_cpu_core.py A src/python/gem5/utils/looppoint.py 4 files changed, 457 insertions(+), 2 deletions(-) diff --git a/src/python/SConscript b/src/python/SConscript index aeeb892..68b5e1d 100644 --- a/src/python/SConscript +++ b/src/python/SConscript @@ -240,6 +240,7 @@ PySource('gem5.components.processors', 'gem5/components/processors/switchable_processor.py') PySource('gem5.utils', 'gem5/utils/simpoint.py') +PySource('gem5.utils', 'gem5/utils/looppoint.py') PySource('gem5.components.processors', 'gem5/components/processors/traffic_generator_core.py') PySource('gem5.components.processors', diff --git a/src/python/gem5/components/processors/abstract_core.py b/src/python/gem5/components/processors/abstract_core.py index 58296bc..8259df8 100644 --- a/src/python/gem5/components/processors/abstract_core.py +++ b/src/python/gem5/components/processors/abstract_core.py @@ -29,7 +29,8 @@ from ...isas import ISA -from m5.objects import BaseMMU, Port, SubSystem +from m5.objects import BaseMMU, Port, SubSystem, PcCountTrackerManager +from m5.params import PcCountPair class AbstractCore(SubSystem): @@ -155,3 +156,9 @@ instruction stop is setup differently dependent on this. """ raise NotImplementedError("This core type does not support MAX_INSTS") + +@abstractmethod +def add_pc_tracker_probe( +self, target_pair: List[PcCountPair], manager: PcCountTrackerManager +) -> None: +raise NotImplementedError diff --git a/src/python/gem5/components/processors/base_cpu_core.py b/src/python/gem5/components/processors/base_cpu_core.py index 631fd0a..c75c002 100644 --- a/src/python/gem5/components/processors/base_cpu_core.py +++ b/src/python/gem5/components/processors/base_cpu_core.py @@ -33,7 +33,15 @@ from ...utils.override import overrides from ...utils.requires import requires -from m5.objects import BaseMMU, Port, BaseCPU, Process +from m5.objects import ( +BaseMMU, +Port, +BaseCPU, +Process, +PcCountTracker, +PcCountTrackerManager, +) +from m5.params import PcCountPair class BaseCPUCore(AbstractCore): @@ -169,3 +177,13 @@ self.core.scheduleInstStopAnyThread(inst) else: self.core.max_insts_any_thread = inst + +@overrides(AbstractCore) +def add_pc_tracker_probe( +self, target_pair: List[PcCountPair], manager: PcCountTrackerManager +) -> None: +pair_tracker = PcCountTracker() +pair_tracker.targets = target_pair +pair_tracker.core = self.core +pair_tracker.ptmanager = manager +self.core.probeListener = pair_tracker diff --git a/src/python/gem5/utils/looppoint.py b/src/python/gem5/utils/looppoint.py new file mode 100644 index 000..b681e75 --- /dev/null +++ b/src/python/gem5/utils/looppoint.py @@ -0,0 +1,401 @@ +# Copyright (c) 2022 The Regents of the University of California +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer; +# redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution; +# neither the name of the copyright holders nor the names of its +# contributors may be used to endorse or promote products derived from +# this software
[gem5-dev] [L] Change in gem5/gem5[develop]: stdlib: Added stdlib LoopPoint classes
Zhantong Qiu has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/64971?usp=email ) Change subject: stdlib: Added stdlib LoopPoint classes .. stdlib: Added stdlib LoopPoint classes The stdlib LoopPoint classes have to work with the LoopPoint probes and the LoopPointManger. They are all added for running the LoopPoint sampling method. The stdlib LoopPoint has three classes, an abstract class and two subclasses. The LoopPointRestore is responsible for profiling restoring related points. The LoopPointCheckpoint is responsible for profiling checkpoints. The BaseLoopPoint stores the general LoopPoints information and setup the LoopPointManager and LoopPoint probes to each core. Change-Id: Ie10d11e6b33189245997d3ab8e9f75cf03d76a39 --- M src/python/SConscript M src/python/gem5/components/processors/abstract_core.py M src/python/gem5/components/processors/base_cpu_core.py A src/python/gem5/utils/looppoint.py 4 files changed, 326 insertions(+), 0 deletions(-) diff --git a/src/python/SConscript b/src/python/SConscript index cbf88c9..bc1887a 100644 --- a/src/python/SConscript +++ b/src/python/SConscript @@ -217,6 +217,7 @@ PySource('gem5.components.processors', 'gem5/components/processors/switchable_processor.py') PySource('gem5.utils', 'gem5/utils/simpoint.py') +PySource('gem5.utils', 'gem5/utils/looppoint.py') PySource('gem5.components.processors', 'gem5/components/processors/traffic_generator_core.py') PySource('gem5.components.processors', diff --git a/src/python/gem5/components/processors/abstract_core.py b/src/python/gem5/components/processors/abstract_core.py index 2f4cb79..d4e1794 100644 --- a/src/python/gem5/components/processors/abstract_core.py +++ b/src/python/gem5/components/processors/abstract_core.py @@ -27,9 +27,12 @@ from abc import ABCMeta, abstractmethod from typing import Optional, List +from m5.params import UInt64 + from ...isas import ISA from m5.objects import BaseMMU, Port, SubSystem +from m5.objects.LoopPoint import LoopPointManager class AbstractCore(SubSystem): @@ -149,3 +152,13 @@ simulation """ raise NotImplementedError("This core type does not support MAX_INSTS") + +@abstractmethod +def addLoopPointProbe( +self, targetpc: List[int], manager: LoopPointManager +) -> None: +"""Add a LoopPoint to the core +:param targetpc: a list of target PC for the LoopPoint +:param manager: the LoopPointManager object +""" +raise NotImplementedError diff --git a/src/python/gem5/components/processors/base_cpu_core.py b/src/python/gem5/components/processors/base_cpu_core.py index db9a1a2..e86d978 100644 --- a/src/python/gem5/components/processors/base_cpu_core.py +++ b/src/python/gem5/components/processors/base_cpu_core.py @@ -25,6 +25,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from typing import Optional, List + from ...utils.requires import requires from .abstract_core import AbstractCore @@ -35,6 +36,8 @@ from m5.objects import BaseMMU, Port, BaseCPU, Process +from m5.objects.LoopPoint import LoopPoint, LoopPointManager + class BaseCPUCore(AbstractCore): """ @@ -165,3 +168,13 @@ self.core.max_insts_any_thread = inst else: self.core.scheduleInstStopAnyThread(inst) + +@overrides(AbstractCore) +def addLoopPointProbe( +self, targetpc: List[int], manager: LoopPointManager +) -> None: +looppoint = LoopPoint() +looppoint.target_pc = targetpc +looppoint.core = self.core +looppoint.lpmanager = manager +self.core.probeListener = looppoint diff --git a/src/python/gem5/utils/looppoint.py b/src/python/gem5/utils/looppoint.py new file mode 100644 index 000..fd5f524 --- /dev/null +++ b/src/python/gem5/utils/looppoint.py @@ -0,0 +1,279 @@ +# Copyright (c) 2022 The Regents of the University of California +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer; +# redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution; +# neither the name of the copyright holders nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR
[gem5-dev] [L] Change in gem5/gem5[develop]: stdlib: Added stdlib LoopPoint classes
Zhantong Qiu has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/64893?usp=email ) Change subject: stdlib: Added stdlib LoopPoint classes .. stdlib: Added stdlib LoopPoint classes The stdlib LoopPoint classes have to work with the LoopPoint probes and the LoopPointManger. They are all added for running the LoopPoint sampling method. The stdlib LoopPoint has three classes, an abstract class and two subclasses. The LoopPointRestore is responsible for profiling restoring points. The LoopPointCheckpoint is responsible for profiling checkpoints. The BaseLoopPoint stores the general information and setup the LoopPointManager and the LoopPoint probes to the cores. Change-Id: I37b101efab6e801ec66eef8e0a93a508d4e5bc62 --- M src/python/SConscript M src/python/gem5/components/processors/abstract_core.py M src/python/gem5/components/processors/base_cpu_core.py A src/python/gem5/utils/looppoint.py 4 files changed, 325 insertions(+), 0 deletions(-) diff --git a/src/python/SConscript b/src/python/SConscript index cbf88c9..bc1887a 100644 --- a/src/python/SConscript +++ b/src/python/SConscript @@ -217,6 +217,7 @@ PySource('gem5.components.processors', 'gem5/components/processors/switchable_processor.py') PySource('gem5.utils', 'gem5/utils/simpoint.py') +PySource('gem5.utils', 'gem5/utils/looppoint.py') PySource('gem5.components.processors', 'gem5/components/processors/traffic_generator_core.py') PySource('gem5.components.processors', diff --git a/src/python/gem5/components/processors/abstract_core.py b/src/python/gem5/components/processors/abstract_core.py index 70335c3..5db4c03 100644 --- a/src/python/gem5/components/processors/abstract_core.py +++ b/src/python/gem5/components/processors/abstract_core.py @@ -27,9 +27,12 @@ from abc import ABCMeta, abstractmethod from typing import Optional, List +from m5.params import UInt64 + from ...isas import ISA from m5.objects import BaseMMU, Port, SubSystem +from m5.objects.LoopPointManager import LoopPointManager class AbstractCore(SubSystem): @@ -148,3 +151,11 @@ simulation """ raise NotImplementedError("This core type does not support MAX_INSTS") + +@abstractmethod +def addLoopPointProbe(self, targetpc, manager: LoopPointManager) -> None: +"""Add a LoopPoint to the core +:param targetpc: a list of target PC for the LoopPoint +:param manager: the LoopPointManager object +""" +raise NotImplementedError diff --git a/src/python/gem5/components/processors/base_cpu_core.py b/src/python/gem5/components/processors/base_cpu_core.py index 7f77ad5..9551952 100644 --- a/src/python/gem5/components/processors/base_cpu_core.py +++ b/src/python/gem5/components/processors/base_cpu_core.py @@ -25,6 +25,8 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from typing import Optional, List + +from m5.params import UInt64 from ...utils.requires import requires from .abstract_core import AbstractCore @@ -35,6 +37,9 @@ from m5.objects import BaseMMU, Port, BaseCPU, Process +from m5.objects.LoopPointManager import LoopPointManager +from m5.objects.LoopPoint import LoopPoint + class BaseCPUCore(AbstractCore): """ @@ -165,3 +170,13 @@ self.core.max_insts_any_thread = inst else: self.core.scheduleInstStopAnyThread(inst) + +@overrides(AbstractCore) +def addLoopPointProbe( +self, targetpc: List[AbstractCore], manager: LoopPointManager +) -> None: +looppoint = LoopPoint() +looppoint.target_pc = targetpc +looppoint.core = self.core +looppoint.lpmanager = manager +self.core.probeListener = looppoint diff --git a/src/python/gem5/utils/looppoint.py b/src/python/gem5/utils/looppoint.py new file mode 100644 index 000..c74b9ee --- /dev/null +++ b/src/python/gem5/utils/looppoint.py @@ -0,0 +1,279 @@ +# Copyright (c) 2022 The Regents of the University of California +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer; +# redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution; +# neither the name of the copyright holders nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF