Bobby R. Bruce has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/52186 )
(
10 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the
submitted one.
)Change subject: stdlib,tests,configs: Create 'SEBinaryWorkload' class
......................................................................
stdlib,tests,configs: Create 'SEBinaryWorkload' class
This enables an SE mode execution of binary if added a Board's
superclass.
This has been abstracted from the SimpleBoard.
The 'set_workload' function has been renamed 'set_se_binary_workload'.
This is clearer on its purpose and doesn't overlap with other
'set_workload' functions.
Change-Id: I714425a3b6b98b91e762ad076eba583bc5953ddd
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/52186
Tested-by: kokoro <noreply+kok...@google.com>
Reviewed-by: Bobby R. Bruce <bbr...@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbr...@ucdavis.edu>
---
M src/python/gem5/components/boards/simple_board.py
M configs/example/gem5_library/arm-hello.py
M src/python/SConscript
M tests/gem5/configs/simple_binary_run.py
A src/python/gem5/components/boards/se_binary_workload.py
5 files changed, 86 insertions(+), 25 deletions(-)
Approvals:
Bobby R. Bruce: Looks good to me, approved; Looks good to me, approved
kokoro: Regressions pass
diff --git a/configs/example/gem5_library/arm-hello.py
b/configs/example/gem5_library/arm-hello.py
index dc4266c..540a96b 100644
--- a/configs/example/gem5_library/arm-hello.py
+++ b/configs/example/gem5_library/arm-hello.py
@@ -79,7 +79,7 @@
# program compiled to the ARM ISA. The `Resource` class will automatically
# download the binary from the gem5 Resources cloud bucket if it's not
already
# present.
-board.set_workload(
+board.set_se_binary_workload(
# The `Resource` class reads the `resources.json` file from the gem5
# resources repository:
# https://gem5.googlesource.com/public/gem5-resource.
diff --git a/src/python/SConscript b/src/python/SConscript
index db564ef..d210960 100644
--- a/src/python/SConscript
+++ b/src/python/SConscript
@@ -42,6 +42,8 @@
PySource('gem5.components.boards', 'gem5/components/boards/x86_board.py')
PySource('gem5.components.boards',
"gem5/components/boards/kernel_disk_workload.py")
+PySource('gem5.components.boards',
+ "gem5/components/boards/se_binary_workload.py")
PySource('gem5.components.cachehierarchies',
'gem5/components/cachehierarchies/__init__.py')
PySource('gem5.components.cachehierarchies',
diff --git a/src/python/gem5/components/boards/se_binary_workload.py
b/src/python/gem5/components/boards/se_binary_workload.py
new file mode 100644
index 0000000..485c1a3
--- /dev/null
+++ b/src/python/gem5/components/boards/se_binary_workload.py
@@ -0,0 +1,56 @@
+# Copyright (c) 2021 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 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+from ...resources.resource import AbstractResource
+
+from m5.objects import SEWorkload, Process
+
+class SEBinaryWorkload:
+ """
+ This class is used to enable simple Syscall-Execution (SE) mode
execution
+ of a binary.
+
+ For this to function correctly the SEBinaryWorkload class should be
added
+ as a superclass to a board (i.e., something that inherits from
+ AbstractBoard).
+ """
+
+ def set_se_binary_workload(self, binary: AbstractResource) -> None:
+ """Set up the system to run a specific binary.
+
+ **Limitations**
+ * Only supports single threaded applications
+ * Dynamically linked executables are partially supported when the
host
+ ISA and the simulated ISA are the same.
+
+ :param binary: The resource encapsulating the binary to be run.
+ """
+
+ self.workload = SEWorkload.init_compatible(binary.get_local_path())
+
+ process = Process()
+ process.cmd = [binary.get_local_path()]
+ self.get_processor().get_cores()[0].set_workload(process)
diff --git a/src/python/gem5/components/boards/simple_board.py
b/src/python/gem5/components/boards/simple_board.py
index 8fc43c8..ad11df9 100644
--- a/src/python/gem5/components/boards/simple_board.py
+++ b/src/python/gem5/components/boards/simple_board.py
@@ -24,19 +24,17 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-from ...resources.resource import AbstractResource
from m5.objects import (
AddrRange,
SrcClockDomain,
VoltageDomain,
- Process,
- SEWorkload,
IOXBar,
Port,
ClockDomain,
)
from .abstract_board import AbstractBoard
+from .se_binary_workload import SEBinaryWorkload
from ..processors.abstract_processor import AbstractProcessor
from ..memory.abstract_memory_system import AbstractMemorySystem
from ..cachehierarchies.abstract_cache_hierarchy import
AbstractCacheHierarchy
@@ -45,7 +43,7 @@
from typing import List
-class SimpleBoard(AbstractBoard):
+class SimpleBoard(AbstractBoard, SEBinaryWorkload):
"""
This is an incredibly simple system. It contains no I/O, and will work
only
with a classic cache hierarchy setup.
@@ -53,7 +51,7 @@
**Limitations**
* Only supports SE mode
- You can run a binary executable via the `set_workload` function.
+ You can run a binary executable via the `set_se_binary_workload`
function.
"""
def __init__(
@@ -117,21 +115,4 @@
# The simple board just has one memory range that is the size of
the
# memory.
self.mem_ranges = [AddrRange(memory.get_size())]
- memory.set_memory_range(self.mem_ranges)
-
- def set_workload(self, binary: AbstractResource) -> None:
- """Set up the system to run a specific binary.
-
- **Limitations**
- * Only supports single threaded applications
- * Dynamically linked executables are partially supported when the
host
- ISA and the simulated ISA are the same.
-
- :param binary: The resource encapsulating the binary to be run.
- """
-
- self.workload = SEWorkload.init_compatible(binary.get_local_path())
-
- process = Process()
- process.cmd = [binary.get_local_path()]
- self.get_processor().get_cores()[0].set_workload(process)
+ memory.set_memory_range(self.mem_ranges)
\ No newline at end of file
diff --git a/tests/gem5/configs/simple_binary_run.py
b/tests/gem5/configs/simple_binary_run.py
index 2e2bf3a..b41f26d 100644
--- a/tests/gem5/configs/simple_binary_run.py
+++ b/tests/gem5/configs/simple_binary_run.py
@@ -96,7 +96,7 @@
# Set the workload
binary = Resource(args.resource,
resource_directory=args.resource_directory)
-motherboard.set_workload(binary)
+motherboard.set_se_binary_workload(binary)
root = Root(full_system=False, system=motherboard)
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/52186
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: I714425a3b6b98b91e762ad076eba583bc5953ddd
Gerrit-Change-Number: 52186
Gerrit-PatchSet: 12
Gerrit-Owner: Bobby R. Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Andreas Sandberg <andreas.sandb...@arm.com>
Gerrit-Reviewer: Bobby R. Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Jason Lowe-Power <ja...@lowepower.com>
Gerrit-Reviewer: Jason Lowe-Power <power...@gmail.com>
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
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s