[gem5-dev] Jenkins build is back to normal : compiler-checks #72

2021-12-08 Thread jenkins-no-reply--- via gem5-dev
See 

___
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


[gem5-dev] Re: Broken SST due to python changes

2021-12-08 Thread Hoa Nguyen via gem5-dev
Hi Gabe,

I have more details about this. In this use case, SST initialized the
Python environment before adding the "gem5 object". This gem5 object
will add more Python stuff from gem5 to the environment.

The function that does that is initPython()
https://gem5.googlesource.com/public/gem5/+/refs/heads/develop/ext/sst/gem5.cc#415

The following commands will pull the docker image for SST testing
purposes (note that host_gem5_root and guest_gem5_root must be
specified),

```
docker run -u $UID:$GID --volume "${host_gem5_root}":"${guest_gem5_root}" -w \
 "${guest_gem5_root}" --rm gcr.io/gem5-test/sst-env \
 bash -c "\
scons build/RISCV/libgem5_opt.so -j${nproc} --without-tcmalloc; \
cd ext/sst; \
make clean; make; \
sst --add-lib-path=./ sst/example.py;
```

We appreciate your help!

Regards,
Hoa Nguyen

On 12/8/21, Jason Lowe-Power  wrote:
> Hey Gabe,
>
> This change breaks the SST integration. In the SST integration python is
> initialized from the SST module, not from init.cc (this is because SST has
> their own python interpreter).
>
> We would appreciate some help in fixing this. Hoa and Giacomo can give you
> an example that's breaking to help you fix it, I believe.
>
> https://gem5-review.googlesource.com/c/public/gem5/+/49413
>
> There's strong interest in having the SST integration working in this
> current release. We've spent a lot of time figuring out all of the
> intricacies and would appreciate any help you can provide in these last few
> days before the release!
>
> Thanks!
>
> Jason
>
___
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


[gem5-dev] Broken SST due to python changes

2021-12-08 Thread Jason Lowe-Power via gem5-dev
Hey Gabe,

This change breaks the SST integration. In the SST integration python is
initialized from the SST module, not from init.cc (this is because SST has
their own python interpreter).

We would appreciate some help in fixing this. Hoa and Giacomo can give you
an example that's breaking to help you fix it, I believe.

https://gem5-review.googlesource.com/c/public/gem5/+/49413

There's strong interest in having the SST integration working in this
current release. We've spent a lot of time figuring out all of the
intricacies and would appreciate any help you can provide in these last few
days before the release!

Thanks!

Jason
___
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

[gem5-dev] Change in gem5/gem5[develop]: dev: Remove unused private variable in lupio_tmr.hh

2021-12-08 Thread Bobby Bruce (Gerrit) via gem5-dev
Bobby Bruce has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/53823 )


Change subject: dev: Remove unused private variable in lupio_tmr.hh
..

dev: Remove unused private variable in lupio_tmr.hh

This was causing the compiler-checks to fail:
https://jenkins.gem5.org/job/compiler-checks/71

Clang-11 complained of an unused private variable. This variable is
removed in this commit.

Change-Id: I4a43d3cae0fe4ffed4e1df3d94849ac7dc24cc0b
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/53823
Maintainer: Bobby Bruce 
Reviewed-by: Jason Lowe-Power 
Tested-by: kokoro 
---
M src/dev/lupio/lupio_tmr.hh
1 file changed, 19 insertions(+), 1 deletion(-)

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




diff --git a/src/dev/lupio/lupio_tmr.hh b/src/dev/lupio/lupio_tmr.hh
index feea5ab..7a69fb7 100644
--- a/src/dev/lupio/lupio_tmr.hh
+++ b/src/dev/lupio/lupio_tmr.hh
@@ -50,7 +50,6 @@
 System *system;
 int nThread;
 int intType;
-int nCPUs = 0;

 // Register map
 enum

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/53823
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: I4a43d3cae0fe4ffed4e1df3d94849ac7dc24cc0b
Gerrit-Change-Number: 53823
Gerrit-PatchSet: 2
Gerrit-Owner: Bobby Bruce 
Gerrit-Reviewer: Bobby Bruce 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: kokoro 
Gerrit-Reviewer: melissa jost 
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

[gem5-dev] Change in gem5/gem5[develop]: stdlib,configs: Adding a config to run PARSEC using stdlib.

2021-12-08 Thread Kaustav Goswami (Gerrit) via gem5-dev
Kaustav Goswami has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/52943 )


 (

19 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the  
submitted one.
 )Change subject: stdlib,configs: Adding a config to run PARSEC using  
stdlib.

..

stdlib,configs: Adding a config to run PARSEC using stdlib.

This change adds a config file to execute PARSEC benchmarks using
gem5 stdlib. It also adds a new test for the same.

Change-Id: I2dfaae388f4a697911ef7894b35f7bfccd7e4761
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/52943
Reviewed-by: Bobby Bruce 
Maintainer: Bobby Bruce 
Tested-by: kokoro 
---
M tests/gem5/gem5_library_example_tests/test_gem5_library_examples.py
A configs/example/gem5_library/x86-parsec-benchmarks.py
2 files changed, 333 insertions(+), 0 deletions(-)

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




diff --git a/configs/example/gem5_library/x86-parsec-benchmarks.py  
b/configs/example/gem5_library/x86-parsec-benchmarks.py

new file mode 100644
index 000..c3dd9ea
--- /dev/null
+++ b/configs/example/gem5_library/x86-parsec-benchmarks.py
@@ -0,0 +1,295 @@
+# 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.
+
+"""
+Script to run PARSEC benchmarks with gem5.
+The script expects a benchmark program name and the simulation
+size. The system is fixed with 2 CPU cores, MESI Two Level system
+cache and 3 GB DDR4 memory. It uses the x86 board.
+
+This script will count the total number of instructions executed
+in the ROI. It also tracks how much wallclock and simulated time.
+
+Usage:
+--
+
+```
+scons build/X86/gem5.opt
+./build/X86/gem5.opt \
+configs/example/gem5_library/x86-parsec-benchmarks.py \
+--benchmark  \
+--size 
+```
+"""
+import argparse
+import time
+
+import m5
+from m5.objects import Root
+
+from gem5.utils.requires import requires
+from gem5.components.boards.x86_board import X86Board
+from gem5.components.memory import DualChannelDDR4_2400
+from gem5.components.processors.simple_switchable_processor import(
+SimpleSwitchableProcessor,
+)
+from gem5.components.processors.cpu_types import CPUTypes
+from gem5.isas import ISA
+from gem5.coherence_protocol import CoherenceProtocol
+from gem5.resources.resource import Resource
+
+from m5.stats.gem5stats import get_simstat
+
+# We check for the required gem5 build.
+
+requires(
+isa_required = ISA.X86,
+coherence_protocol_required=CoherenceProtocol.MESI_TWO_LEVEL,
+kvm_required=True,
+)
+
+# Following are the list of benchmark programs for parsec.
+
+benchmark_choices = ["blackscholes", "bodytrack", "canneal", "dedup",
+ "facesim", "ferret", "fluidanimate", "freqmine",
+ "raytrace", "streamcluster", "swaptions", "vips", "x264"]
+
+# Following are the input size.
+
+size_choices=["simsmall", "simmedium", "simlarge"]
+
+parser = argparse.ArgumentParser(
+description="An example configuration script to run the npb  
benchmarks."

+)
+
+# The arguments accepted are the benchmark name and the simulation size.
+
+parser.add_argument(
+"--benchmark",
+type = str,
+required=True,
+help = "Input the benchmark program to execute.",
+choices = benchmark_choices,
+)
+
+parser.add_argument(
+"--size",
+type = str,
+

[gem5-dev] Change in gem5/gem5[develop]: stdlib,configs: Config added for SPEC CPU2006 using stdlib.

2021-12-08 Thread Kaustav Goswami (Gerrit) via gem5-dev
Kaustav Goswami has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/53165 )


 (

57 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the  
submitted one.
 )Change subject: stdlib,configs: Config added for SPEC CPU2006 using  
stdlib.

..

stdlib,configs: Config added for SPEC CPU2006 using stdlib.

This change adds a config file to execute SPEC CPU 2006 benchmarks
using gem5 stdlib.

Signed-off-by: Kaustav Goswami 
Change-Id: I4287433717e4a3d05136b27554accd577275e1be
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/53165
Reviewed-by: Bobby Bruce 
Maintainer: Bobby Bruce 
Tested-by: kokoro 
---
A configs/example/gem5_library/x86-spec-cpu2006-benchmarks.py
1 file changed, 390 insertions(+), 0 deletions(-)

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




diff --git a/configs/example/gem5_library/x86-spec-cpu2006-benchmarks.py  
b/configs/example/gem5_library/x86-spec-cpu2006-benchmarks.py

new file mode 100644
index 000..0bd5320
--- /dev/null
+++ b/configs/example/gem5_library/x86-spec-cpu2006-benchmarks.py
@@ -0,0 +1,373 @@
+# 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.
+
+"""
+Script to run SPEC CPU2006 benchmarks with gem5.
+The script expects a benchmark program name and the simulation
+size. The system is fixed with 2 CPU cores, MESI Two Level system
+cache and 3 GB DDR4 memory. It uses the x86 board.
+
+This script will count the total number of instructions executed
+in the ROI. It also tracks how much wallclock and simulated time.
+
+Usage:
+--
+
+```
+scons build/X86/gem5.opt
+./build/X86/gem5.opt \
+configs/example/gem5_library/x86-spec-cpu2006-benchmarks.py \
+--image  \
+--partition  \
+--benchmark  \
+--size 
+```
+
+"""
+
+import argparse
+import time
+import os
+import json
+
+import m5
+from m5.objects import Root
+
+from gem5.utils.requires import requires
+from gem5.components.boards.x86_board import X86Board
+from gem5.components.memory import DualChannelDDR4_2400
+from gem5.components.processors.simple_switchable_processor import(
+SimpleSwitchableProcessor,
+)
+from gem5.components.processors.cpu_types import CPUTypes
+from gem5.isas import ISA
+from gem5.coherence_protocol import CoherenceProtocol
+from gem5.resources.resource import Resource, CustomResource
+
+from m5.stats.gem5stats import get_simstat
+from m5.util import warn
+from m5.util import fatal
+
+# We check for the required gem5 build.
+
+requires(
+isa_required=ISA.X86,
+coherence_protocol_required=CoherenceProtocol.MESI_TWO_LEVEL,
+kvm_required=True,
+)
+
+# Following are the list of benchmark programs for SPEC CPU2006.
+# Note that 400.perlbench, 447.dealII, 450.soplex and 483.xalancbmk
+# have build errors, and, therefore cannot be executed. More information is
+# available at: https://www.gem5.org/documentation/benchmark_status/gem5-20
+
+benchmark_choices = ['400.perlbench', '401.bzip2', '403.gcc', '410.bwaves',
+'416.gamess', '429.mcf', '433.milc', '435.gromacs',
+'436.cactusADM', '437.leslie3d', '444.namd', '445.gobmk',
+'447.dealII', '450.soplex', '453.povray', '454.calculix',
+'456.hmmer', '458.sjeng', '459.GemsFDTD',
+'462.libquantum', 

[gem5-dev] Change in gem5/gem5[develop]: stdlib,configs: Adding a config to run NPB using stdlib.

2021-12-08 Thread Kaustav Goswami (Gerrit) via gem5-dev
Kaustav Goswami has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/52964 )


 (

31 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the  
submitted one.

 )Change subject: stdlib,configs: Adding a config to run NPB using stdlib.
..

stdlib,configs: Adding a config to run NPB using stdlib.

This change adds a config file to execute NPB benchmarks using
gem5 stdlib. Also, it adds a new test for the same.

Signed-off-by: Kaustav Goswami 
Change-Id: I527b7d12be7ab43e61dde507095ebf9fa4b44867
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/52964
Reviewed-by: Bobby Bruce 
Maintainer: Bobby Bruce 
Tested-by: kokoro 
---
M tests/gem5/gem5_library_example_tests/test_gem5_library_examples.py
A configs/example/gem5_library/x86-npb-benchmarks.py
2 files changed, 377 insertions(+), 1 deletion(-)

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




diff --git a/configs/example/gem5_library/x86-npb-benchmarks.py  
b/configs/example/gem5_library/x86-npb-benchmarks.py

new file mode 100644
index 000..ba7b17c
--- /dev/null
+++ b/configs/example/gem5_library/x86-npb-benchmarks.py
@@ -0,0 +1,332 @@
+# 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.
+
+"""
+Script to run NAS parallel benchmarks with gem5. The script expects the
+benchmark program to run. The input is in the format
+..x .The system is fixed with 2 CPU cores, MESI
+Two Level system cache and 3 GB DDR4 memory. It uses the x86 board.
+
+This script will count the total number of instructions executed
+in the ROI. It also tracks how much wallclock and simulated time.
+
+Usage:
+--
+
+```
+scons build/X86/gem5.opt
+./build/X86/gem5.opt \
+configs/example/gem5_library/x86-npb-benchmarks.py \
+--benchmark  \
+--size 
+```
+"""
+
+import argparse
+import time
+
+import m5
+from m5.objects import Root
+
+from gem5.utils.requires import requires
+from gem5.components.boards.x86_board import X86Board
+from gem5.components.memory import DualChannelDDR4_2400
+from gem5.components.processors.simple_switchable_processor import(
+SimpleSwitchableProcessor,
+)
+from gem5.components.processors.cpu_types import CPUTypes
+from gem5.isas import ISA
+from gem5.coherence_protocol import CoherenceProtocol
+from gem5.resources.resource import Resource
+
+from m5.stats.gem5stats import get_simstat
+from m5.util import warn
+
+requires(
+isa_required = ISA.X86,
+coherence_protocol_required=CoherenceProtocol.MESI_TWO_LEVEL,
+kvm_required=True,
+)
+
+# Following are the list of benchmark programs for npb.
+
+benchmark_choices = ["bt", "cg", "ep", "ft", "is", "lu", "mg", "sp"]
+
+# We are restricting classes of NPB to A, B and C as the other classes (D  
and

+# F) require main memory size of more than 3 GB. The X86Board is currently
+# limited to 3 GB of memory. This limitation is explained later in line  
136.

+
+# The resource disk has binaries for class D. However, only `ep` benchmark
+# works with class D in the current configuration. More information on the
+# memory footprint for NPB is available at https://arxiv.org/abs/2010.13216
+
+size_choices = ["A", "B", "C"]
+
+parser = argparse.ArgumentParser(
+description="An example configuration script to run the npb  
benchmarks."

+)
+
+# The only positional argument accepted is 

[gem5-dev] Change in gem5/gem5[develop]: stdlib,configs: Config added for SPEC CPU2017 using stdlib.

2021-12-08 Thread Kaustav Goswami (Gerrit) via gem5-dev
Kaustav Goswami has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/53166 )


 (

68 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the  
submitted one.
 )Change subject: stdlib,configs: Config added for SPEC CPU2017 using  
stdlib.

..

stdlib,configs: Config added for SPEC CPU2017 using stdlib.

This change adds a config file to execute SPEC CPU 2017 benchmarks
using gem5 stdlib.

Signed-off-by: Kaustav Goswami 
Change-Id: I1c4e7cb56e18db44eac5549f9c7ca7379e377e04
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/53166
Reviewed-by: Bobby Bruce 
Maintainer: Bobby Bruce 
Tested-by: kokoro 
---
A configs/example/gem5_library/x86-spec-cpu2017-benchmarks.py
1 file changed, 385 insertions(+), 0 deletions(-)

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




diff --git a/configs/example/gem5_library/x86-spec-cpu2017-benchmarks.py  
b/configs/example/gem5_library/x86-spec-cpu2017-benchmarks.py

new file mode 100644
index 000..b4bb9ac
--- /dev/null
+++ b/configs/example/gem5_library/x86-spec-cpu2017-benchmarks.py
@@ -0,0 +1,368 @@
+# 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.
+
+"""
+Script to run SPEC CPU2017 benchmarks with gem5.
+The script expects a benchmark program name and the simulation
+size. The system is fixed with 2 CPU cores, MESI Two Level system
+cache and 3 GB DDR4 memory. It uses the x86 board.
+
+This script will count the total number of instructions executed
+in the ROI. It also tracks how much wallclock and simulated time.
+
+Usage:
+--
+```
+scons build/X86/gem5.opt
+./build/X86/gem5.opt \
+configs/example/gem5_library/x86-spec-cpu2017-benchmarks.py \
+--image  \
+--partition  \
+--benchmark  \
+--size 
+```
+"""
+
+import argparse
+import time
+import os
+import json
+
+import m5
+from m5.objects import Root
+
+from gem5.utils.requires import requires
+from gem5.components.boards.x86_board import X86Board
+from gem5.components.memory import DualChannelDDR4_2400
+from gem5.components.processors.simple_switchable_processor import(
+SimpleSwitchableProcessor,
+)
+from gem5.components.processors.cpu_types import CPUTypes
+from gem5.isas import ISA
+from gem5.coherence_protocol import CoherenceProtocol
+from gem5.resources.resource import Resource, CustomResource
+
+from m5.stats.gem5stats import get_simstat
+from m5.util import warn
+from m5.util import fatal
+
+# We check for the required gem5 build.
+
+requires(
+isa_required=ISA.X86,
+coherence_protocol_required=CoherenceProtocol.MESI_TWO_LEVEL,
+kvm_required=True,
+)
+
+# Following are the list of benchmark programs for SPEC CPU2017.
+# More information is available at:
+# https://www.gem5.org/documentation/benchmark_status/gem5-20
+
+benchmark_choices =["500.perlbench_r", "502.gcc_r", "503.bwaves_r",
+"505.mcf_r", "507.cactusBSSN_r", "508.namd_r",
+"510.parest_r", "511.povray_r", "519.lbm_r",
+"520.omnetpp_r", "521.wrf_r", "523.xalancbmk_r",
+"525.x264_r", "527.cam4_r", "531.deepsjeng_r",
+"538.imagick_r", "541.leela_r", "544.nab_r",
+"548.exchange2_r", "549.fotonik3d_r", "554.roms_r",
+"557.xz_r", "600.perlbench_s", "602.gcc_s",
+

[gem5-dev] Change in gem5/gem5[develop]: stdlib,configs: Config added for RISCV boot-test using stdlib.

2021-12-08 Thread Kaustav Goswami (Gerrit) via gem5-dev
Kaustav Goswami has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/53024 )


 (

45 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the  
submitted one.
 )Change subject: stdlib,configs: Config added for RISCV boot-test using  
stdlib.

..

stdlib,configs: Config added for RISCV boot-test using stdlib.

This change adds a config file to boot Ubuntu-20.04 using RISCV ISA
using gem5 stdlib. It also adds a new test for the same.

Signed-off-by: Kaustav Goswami 
Change-Id: Id2b5e46e7ba9e3c4701c97330406537dffa44479
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/53024
Reviewed-by: Bobby Bruce 
Maintainer: Bobby Bruce 
Tested-by: kokoro 
---
A configs/example/gem5_library/riscv-ubuntu-run.py
M tests/gem5/gem5_library_example_tests/test_gem5_library_examples.py
2 files changed, 180 insertions(+), 0 deletions(-)

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




diff --git a/configs/example/gem5_library/riscv-ubuntu-run.py  
b/configs/example/gem5_library/riscv-ubuntu-run.py

new file mode 100644
index 000..f25d20f
--- /dev/null
+++ b/configs/example/gem5_library/riscv-ubuntu-run.py
@@ -0,0 +1,146 @@
+# 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.
+
+"""
+This script shows an example of running a full system RISCV Ubuntu boot
+simulation using the gem5 library. This simulation boots Ubuntu 20.04 using
+2 TIMING CPU cores. The simulation ends when the startup is completed
+successfully.
+
+Usage
+-
+
+```
+scons build/RISCV/gem5.opt
+./build/RISCV/gem5.opt \
+configs/example/gem5_library/riscv-ubuntu-run.py
+```
+"""
+
+import m5
+from m5.objects import Root
+
+from gem5.utils.requires import requires
+from gem5.components.boards.riscv_board import RiscvBoard
+from gem5.components.memory import DualChannelDDR4_2400
+from gem5.components.processors.simple_processor import (
+SimpleProcessor,
+)
+from gem5.components.processors.cpu_types import CPUTypes
+from gem5.isas import ISA
+from gem5.coherence_protocol import CoherenceProtocol
+from gem5.resources.resource import Resource
+
+# This runs a check to ensure the gem5 binary is compiled for RISCV.
+
+requires(
+isa_required=ISA.RISCV,
+)
+
+# With RISCV, we use simple caches.
+from gem5.components.cachehierarchies.classic\
+.private_l1_private_l2_cache_hierarchy import (
+PrivateL1PrivateL2CacheHierarchy,
+)
+# Here we setup the parameters of the l1 and l2 caches.
+cache_hierarchy = PrivateL1PrivateL2CacheHierarchy(
+l1d_size="16kB",
+l1i_size="16kB",
+l2_size="256kB",
+)
+
+# Memory: Dual Channel DDR4 2400 DRAM device.
+
+memory = DualChannelDDR4_2400(size = "3GB")
+
+# Here we setup the processor. We use a simple processor.
+processor = SimpleProcessor(
+cpu_type=CPUTypes.TIMING,
+num_cores=2,
+)
+
+# Here we setup the board. The RiscvBoard allows for Full-System RISCV
+# simulations.
+board = RiscvBoard(
+clk_freq="3GHz",
+processor=processor,
+memory=memory,
+cache_hierarchy=cache_hierarchy,
+)
+
+# Here we set the Full System workload.
+
+# The `set_kernel_disk_workload` function for the RiscvBoard accepts a
+# RISCV bootloader and a disk image. Once the system successfully boots, it
+# encounters an `m5_exit instruction encountered`. We stop the simulation  
then.
+# When 

[gem5-dev] Change in gem5/gem5[develop]: stdlib,configs: Adding a config to run GAPBS using stdlib.

2021-12-08 Thread Kaustav Goswami (Gerrit) via gem5-dev
Kaustav Goswami has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/53023 )


 (

41 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the  
submitted one.

 )Change subject: stdlib,configs: Adding a config to run GAPBS using stdlib.
..

stdlib,configs: Adding a config to run GAPBS using stdlib.

This change adds a config file to execute GAPBS benchmarks using
gem5 stdlib. It also adds a new test for the same.

Signed-off-by: Kaustav Goswami 
Change-Id: I10326cace4e6fa160e02e479fb4443277af3966f
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/53023
Reviewed-by: Bobby Bruce 
Maintainer: Bobby Bruce 
Tested-by: kokoro 
---
A configs/example/gem5_library/x86-gapbs-benchmarks.py
M tests/gem5/gem5_library_example_tests/test_gem5_library_examples.py
2 files changed, 343 insertions(+), 0 deletions(-)

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




diff --git a/configs/example/gem5_library/x86-gapbs-benchmarks.py  
b/configs/example/gem5_library/x86-gapbs-benchmarks.py

new file mode 100644
index 000..92746aa
--- /dev/null
+++ b/configs/example/gem5_library/x86-gapbs-benchmarks.py
@@ -0,0 +1,306 @@
+# 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.
+
+"""
+Script to run GAPBS benchmarks with gem5. The script expects the
+benchmark program and the simulation size to run. The input is in the  
format

+  
+The system is fixed with 2 CPU cores, MESI Two Level system cache and 3 GB
+DDR4 memory. It uses the x86 board.
+
+This script will count the total number of instructions executed
+in the ROI. It also tracks how much wallclock and simulated time.
+
+Usage:
+--
+
+```
+scons build/X86/gem5.opt
+./build/X86/gem5.opt \
+configs/example/gem5_library/x86-gabps-benchmarks.py \
+--benchmark  \
+--synthetic  \
+--size 
+```
+"""
+
+import argparse
+import time
+import sys
+
+import m5
+from m5.objects import Root
+
+from gem5.utils.requires import requires
+from gem5.components.boards.x86_board import X86Board
+from gem5.components.memory import DualChannelDDR4_2400
+from gem5.components.processors.simple_switchable_processor import (
+SimpleSwitchableProcessor,
+)
+from gem5.components.processors.cpu_types import CPUTypes
+from gem5.isas import ISA
+from gem5.coherence_protocol import CoherenceProtocol
+from gem5.resources.resource import Resource
+
+from m5.stats.gem5stats import get_simstat
+
+requires(
+isa_required=ISA.X86,
+coherence_protocol_required=CoherenceProtocol.MESI_TWO_LEVEL,
+kvm_required=True,
+)
+
+# Following are the list of benchmark programs for gapbs
+
+benchmark_choices = ["cc", "bc", "tc", "pr", "bfs"]
+
+synthetic_choices = ["0", "1"]
+
+size_choices =  
["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12",

+"13", "14", "15", "16", "USA-road-d.NY.gr"]
+
+parser = argparse.ArgumentParser(
+description="An example configuration script to run the gapbs  
benchmarks."

+)
+
+# The only positional argument accepted is the benchmark name in this  
script.

+
+parser.add_argument(
+"--benchmark",
+type=str,
+required=True,
+help="Input the benchmark program to execute.",
+choices=benchmark_choices,
+)
+
+parser.add_argument(
+"--synthetic",
+type=str,
+required=True,
+

[gem5-dev] Re: Build failed in Jenkins: compiler-checks #71

2021-12-08 Thread Bobby Bruce via gem5-dev
Fix here: https://gem5-review.googlesource.com/c/public/gem5/+/53823
--
Dr. Bobby R. Bruce
Room 3050,
Kemper Hall, UC Davis
Davis,
CA, 95616

web: https://www.bobbybruce.net


On Wed, Dec 8, 2021 at 12:42 AM jenkins-no-reply--- via gem5-dev <
gem5-dev@gem5.org> wrote:

> See <
> https://jenkins.gem5.org/job/compiler-checks/71/display/redirect?page=changes
> >
>
> Changes:
>
> [melissakjost] dev: Added new LupIO-RTC device
>
> [melissakjost] dev: Introduced new LupV Platform
>
> [melissakjost] stdlib: Introduced new LupV Board
>
> [melissakjost] dev: Added new LupIO-RNG device
>
> [melissakjost] stdlib: Added LupioRNG to LupVBoard
>
> [melissakjost] dev: Added new LupIO-TTY device
>
> [melissakjost] stdlib: Added LupioTTY to LupVBoard
>
> [melissakjost] dev: Added new Lupio-BLK Device
>
> [melissakjost] stdlib: Added LupioBLK Device to LupVBoard
>
> [melissakjost] dev: Added new LupIO-TMR device
>
> [melissakjost] dev: Added new LupIO-PIC device
>
> [melissakjost] stdlib: Modified LupV Platform + Board to use LupioPIC + TMR
>
> [melissakjost] dev: Modified LupioBLK and LupioTTY to use LupioPIC
>
> [melissakjost] dev: Modify LupIO-TMR for SMP support
>
> [melissakjost] dev: Added new Lupio-IPI device
>
> [melissakjost] stdlib: Added LupIO-IPI to the LupV Board
>
> [melissakjost] dev: Added new Lupio-SYS device
>
> [melissakjost] stdlib: Added Lupio-SYS device to LupV Board
>
> [melissakjost] stdlib: Moved LupV Board to an experimental folder
>
> [melissakjost] stdlib: Update the LupvBoard to account for stdlib changes
>
> [melissakjost] stdlib: Update the LupvBoard to use 'requires'
>
> [melissakjost] stdlib: Update the LupvBoard to use KernelDiskWorkload
>
> [melissakjost] configs: Added LupV script to configs
>
> [gabe.black] sim-se: Handle empty paths when resolving an "at" path.
>
> [gabe.black] sim-se: Implement the newfstatat system call.
>
> [gabe.black] arch-x86: Hook up system calls for 64 bit processes.
>
> [gabe.black] arch-x86: Hook up the newfstatat system call for 64 bit Linux.
>
> [yuhsingw] fastmodel: add setResetAddr interface
>
> [yuhsingw] fastmodel: CortexA76 implements setResetAddr interface
>
> [yuhsingw] fastmodel: CortexR52 implements setResetAddr interface
>
>
> --
> Started by timer
> Running as SYSTEM
> Building in workspace 
> The recommended git tool is: NONE
> No credentials specified
>  > git rev-parse --resolve-git-dir <
> https://jenkins.gem5.org/job/compiler-checks/ws/.git> # timeout=10
> Fetching changes from the remote Git repository
>  > git config remote.origin.url https://gem5.googlesource.com/public/gem5
> # timeout=10
> Fetching upstream changes from https://gem5.googlesource.com/public/gem5
>  > git --version # timeout=10
>  > git --version # 'git version 2.25.1'
>  > git fetch --tags --force --progress --
> https://gem5.googlesource.com/public/gem5
> +refs/heads/*:refs/remotes/origin/* # timeout=10
>  > git rev-parse refs/remotes/origin/develop^{commit} # timeout=10
> Checking out Revision 60e55ecef8310fc861e1effb0b1776c732abeacc
> (refs/remotes/origin/develop)
>  > git config core.sparsecheckout # timeout=10
>  > git checkout -f 60e55ecef8310fc861e1effb0b1776c732abeacc # timeout=10
> Commit message: "fastmodel: CortexR52 implements setResetAddr interface"
>  > git rev-list --no-walk df516127145505177de0f01fa6d8985cf061d6af #
> timeout=10
> [compiler-checks] $ /bin/sh -xe /tmp/jenkins877689978860865276.sh
> + ./tests/compiler-tests.sh -j 40
> Starting build tests with 'gcc-version-11'...
> 'gcc-version-11' was found in the comprehensive tests. All ISAs will be
> built.
>   * Building target 'NULL_MOESI_CMP_directory.opt' with 'gcc-version-11'...
> Done.
>   * Building target 'NULL_MOESI_CMP_directory.fast' with
> 'gcc-version-11'...
> Done.
>   * Building target 'RISCV.opt' with 'gcc-version-11'...
> Done.
>   * Building target 'RISCV.fast' with 'gcc-version-11'...
> Done.
>   * Building target 'POWER.opt' with 'gcc-version-11'...
> Done.
>   * Building target 'POWER.fast' with 'gcc-version-11'...
> Done.
>   * Building target 'NULL_MESI_Two_Level.opt' with 'gcc-version-11'...
> Done.
>   * Building target 'NULL_MESI_Two_Level.fast' with 'gcc-version-11'...
> Done.
>   * Building target 'ARM_MOESI_hammer.opt' with 'gcc-version-11'...
> Done.
>   * Building target 'ARM_MOESI_hammer.fast' with 'gcc-version-11'...
> Done.
>   * Building target 'MIPS.opt' with 'gcc-version-11'...
> Done.
>   * Building target 'MIPS.fast' with 'gcc-version-11'...
> Done.
>   * Building target 'ARM.opt' with 'gcc-version-11'...
> Done.
>   * Building target 'ARM.fast' with 'gcc-version-11'...
> Done.
>   * Building target 'GCN3_X86.opt' with 'gcc-version-11'...
> Done.
>   * Building target 'GCN3_X86.fast' with 'gcc-version-11'...
> Done.
>   * Building target 'X86.opt' with 'gcc-version-11'...
> Done.
>   * Building target 

[gem5-dev] Change in gem5/gem5[develop]: dev: Remove unused private variable in lupio_tmr.hh

2021-12-08 Thread Bobby Bruce (Gerrit) via gem5-dev
Bobby Bruce has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/53823 )



Change subject: dev: Remove unused private variable in lupio_tmr.hh
..

dev: Remove unused private variable in lupio_tmr.hh

This was causing the compiler-checks to fail:
https://jenkins.gem5.org/job/compiler-checks/71

Clang-11 complained of an unused private variable. This variable is
removed in this commit.

Change-Id: I4a43d3cae0fe4ffed4e1df3d94849ac7dc24cc0b
---
M src/dev/lupio/lupio_tmr.hh
1 file changed, 15 insertions(+), 1 deletion(-)



diff --git a/src/dev/lupio/lupio_tmr.hh b/src/dev/lupio/lupio_tmr.hh
index feea5ab..7a69fb7 100644
--- a/src/dev/lupio/lupio_tmr.hh
+++ b/src/dev/lupio/lupio_tmr.hh
@@ -50,7 +50,6 @@
 System *system;
 int nThread;
 int intType;
-int nCPUs = 0;

 // Register map
 enum

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/53823
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: I4a43d3cae0fe4ffed4e1df3d94849ac7dc24cc0b
Gerrit-Change-Number: 53823
Gerrit-PatchSet: 1
Gerrit-Owner: Bobby Bruce 
Gerrit-MessageType: newchange
___
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

[gem5-dev] Change in gem5/gem5[develop]: arch-gcn3,gpu-compute: Move TLB to common folder in amdgpu

2021-12-08 Thread Matthew Poremba (Gerrit) via gem5-dev
Matthew Poremba has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/53803 )



Change subject: arch-gcn3,gpu-compute: Move TLB to common folder in amdgpu
..

arch-gcn3,gpu-compute: Move TLB to common folder in amdgpu

This TLB is more of an "APU" TLB than anything GCN3 specific. It can be
used with either GCN3 or Vega. With this change, VEGA_X86 builds and one
can run binaries with Vega ISA code using the same steps as GCN3 but
building the Vega ISA instead.

Change-Id: I0c92bcd0379a18628dc05cb5af070bdc7e692c7c
---
M src/arch/amdgpu/gcn3/SConscript
M src/gpu-compute/compute_unit.cc
M src/gpu-compute/shader.cc
R src/arch/amdgpu/common/X86GPUTLB.py
M src/gpu-compute/fetch_unit.cc
R src/arch/amdgpu/common/tlb.cc
R src/arch/amdgpu/common/tlb.hh
M src/arch/amdgpu/gcn3/gpu_isa.hh
R src/arch/amdgpu/common/tlb_coalescer.cc
R src/arch/amdgpu/common/tlb_coalescer.hh
10 files changed, 23 insertions(+), 10 deletions(-)



diff --git a/src/arch/amdgpu/gcn3/X86GPUTLB.py  
b/src/arch/amdgpu/common/X86GPUTLB.py

similarity index 96%
rename from src/arch/amdgpu/gcn3/X86GPUTLB.py
rename to src/arch/amdgpu/common/X86GPUTLB.py
index 1c7f1d0..b5f3387 100644
--- a/src/arch/amdgpu/gcn3/X86GPUTLB.py
+++ b/src/arch/amdgpu/common/X86GPUTLB.py
@@ -39,7 +39,7 @@
 class X86GPUTLB(ClockedObject):
 type = 'X86GPUTLB'
 cxx_class = 'gem5::X86ISA::GpuTLB'
-cxx_header = 'arch/amdgpu/gcn3/tlb.hh'
+cxx_header = 'arch/amdgpu/common/tlb.hh'
 size = Param.Int(64, "TLB size (number of entries)")
 assoc = Param.Int(64, "TLB associativity")

@@ -63,7 +63,7 @@
 class TLBCoalescer(ClockedObject):
 type = 'TLBCoalescer'
 cxx_class = 'gem5::TLBCoalescer'
-cxx_header = 'arch/amdgpu/gcn3/tlb_coalescer.hh'
+cxx_header = 'arch/amdgpu/common/tlb_coalescer.hh'

 probesPerCycle = Param.Int(2, "Number of TLB probes per cycle")
 coalescingWindow = Param.Int(1, "Permit coalescing across that many  
ticks")

diff --git a/src/arch/amdgpu/gcn3/tlb.cc b/src/arch/amdgpu/common/tlb.cc
similarity index 99%
rename from src/arch/amdgpu/gcn3/tlb.cc
rename to src/arch/amdgpu/common/tlb.cc
index a6280da..e108a0b 100644
--- a/src/arch/amdgpu/gcn3/tlb.cc
+++ b/src/arch/amdgpu/common/tlb.cc
@@ -32,7 +32,7 @@
  *
  */

-#include "arch/amdgpu/gcn3/tlb.hh"
+#include "arch/amdgpu/common/tlb.hh"

 #include 
 #include 
diff --git a/src/arch/amdgpu/gcn3/tlb.hh b/src/arch/amdgpu/common/tlb.hh
similarity index 100%
rename from src/arch/amdgpu/gcn3/tlb.hh
rename to src/arch/amdgpu/common/tlb.hh
diff --git a/src/arch/amdgpu/gcn3/tlb_coalescer.cc  
b/src/arch/amdgpu/common/tlb_coalescer.cc

similarity index 99%
rename from src/arch/amdgpu/gcn3/tlb_coalescer.cc
rename to src/arch/amdgpu/common/tlb_coalescer.cc
index 9b53db8..507d0e2 100644
--- a/src/arch/amdgpu/gcn3/tlb_coalescer.cc
+++ b/src/arch/amdgpu/common/tlb_coalescer.cc
@@ -31,7 +31,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */

-#include "arch/amdgpu/gcn3/tlb_coalescer.hh"
+#include "arch/amdgpu/common/tlb_coalescer.hh"

 #include 

diff --git a/src/arch/amdgpu/gcn3/tlb_coalescer.hh  
b/src/arch/amdgpu/common/tlb_coalescer.hh

similarity index 99%
rename from src/arch/amdgpu/gcn3/tlb_coalescer.hh
rename to src/arch/amdgpu/common/tlb_coalescer.hh
index afe12c9..22f311c 100644
--- a/src/arch/amdgpu/gcn3/tlb_coalescer.hh
+++ b/src/arch/amdgpu/common/tlb_coalescer.hh
@@ -39,7 +39,7 @@
 #include 
 #include 

-#include "arch/amdgpu/gcn3/tlb.hh"
+#include "arch/amdgpu/common/tlb.hh"
 #include "arch/generic/tlb.hh"
 #include "arch/x86/isa.hh"
 #include "arch/x86/pagetable.hh"
diff --git a/src/arch/amdgpu/gcn3/SConscript  
b/src/arch/amdgpu/gcn3/SConscript

index e8e0002..eb309c4 100644
--- a/src/arch/amdgpu/gcn3/SConscript
+++ b/src/arch/amdgpu/gcn3/SConscript
@@ -39,15 +39,11 @@
 Return()

 if env['TARGET_GPU_ISA'] == 'gcn3':
-SimObject('X86GPUTLB.py', sim_objects=['X86GPUTLB', 'TLBCoalescer'])
-
 Source('decoder.cc')
 Source('insts/gpu_static_inst.cc')
 Source('insts/instructions.cc')
 Source('insts/op_encodings.cc')
 Source('isa.cc')
 Source('registers.cc')
-Source('tlb.cc')
-Source('tlb_coalescer.cc')

 DebugFlag('GCN3', 'Debug flag for GCN3 GPU ISA')
diff --git a/src/arch/amdgpu/gcn3/gpu_isa.hh  
b/src/arch/amdgpu/gcn3/gpu_isa.hh

index 205f097..26cbc5c 100644
--- a/src/arch/amdgpu/gcn3/gpu_isa.hh
+++ b/src/arch/amdgpu/gcn3/gpu_isa.hh
@@ -37,8 +37,8 @@
 #include 
 #include 

+#include "arch/amdgpu/common/tlb.hh"
 #include "arch/amdgpu/gcn3/gpu_registers.hh"
-#include "arch/amdgpu/gcn3/tlb.hh"
 #include "gpu-compute/dispatcher.hh"
 #include "gpu-compute/hsa_queue_entry.hh"
 #include "gpu-compute/misc.hh"
diff --git a/src/gpu-compute/compute_unit.cc  
b/src/gpu-compute/compute_unit.cc

index feef552..761d37b 100644
--- a/src/gpu-compute/compute_unit.cc
+++ b/src/gpu-compute/compute_unit.cc
@@ -35,6 +35,7 @@

 #include 

+#include 

[gem5-dev] Change in gem5/gem5[develop]: arch-gcn3: Delete extraneous registers header

2021-12-08 Thread Matthew Poremba (Gerrit) via gem5-dev
Matthew Poremba has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/53743 )


Change subject: arch-gcn3: Delete extraneous registers header
..

arch-gcn3: Delete extraneous registers header

This file is a duplicate of arch/amdgpu/gcn3/gpu_registers.hh and is in
the wrong location. It should be removed to avoid mistakenly editing the
wrong file.

Change-Id: Ie96e22fe8f78fda954af788b472ec2df4782e4a5
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/53743
Reviewed-by: Jason Lowe-Power 
Maintainer: Jason Lowe-Power 
Tested-by: kokoro 
Reviewed-by: Matt Sinclair 
Maintainer: Matt Sinclair 
---
D src/arch/gcn3/registers.hh
1 file changed, 19 insertions(+), 235 deletions(-)

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




diff --git a/src/arch/gcn3/registers.hh b/src/arch/gcn3/registers.hh
deleted file mode 100644
index 130f052..000
--- a/src/arch/gcn3/registers.hh
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * Copyright (c) 2015-2017 Advanced Micro Devices, Inc.
- * All rights reserved.
- *
- * For use for simulation and test purposes only
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are  
met:

- *
- * 1. Redistributions of source code must retain the above copyright  
notice,

- * this list of conditions and the following disclaimer.
- *
- * 2. 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.
- *
- * 3. Neither the name of the copyright holder 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 HOLDER 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.
- */
-
-#ifndef __ARCH_GCN3_REGISTERS_HH__
-#define __ARCH_GCN3_REGISTERS_HH__
-
-#include 
-#include 
-#include 
-
-#include "arch/generic/vec_reg.hh"
-#include "base/intmath.hh"
-#include "base/logging.hh"
-
-namespace gem5
-{
-
-namespace Gcn3ISA
-{
-enum OpSelector : int
-{
-REG_SGPR_MIN = 0,
-REG_SGPR_MAX = 101,
-REG_FLAT_SCRATCH_LO = 102,
-REG_FLAT_SCRATCH_HI = 103,
-REG_XNACK_MASK_LO = 104,
-REG_XNACK_MASK_HI = 105,
-REG_VCC_LO = 106,
-REG_VCC_HI = 107,
-REG_TBA_LO = 108,
-REG_TBA_HI = 109,
-REG_TMA_LO = 110,
-REG_TMA_HI = 111,
-REG_TTMP_0 = 112,
-REG_TTMP_1 = 113,
-REG_TTMP_2 = 114,
-REG_TTMP_3 = 115,
-REG_TTMP_4 = 116,
-REG_TTMP_5 = 117,
-REG_TTMP_6 = 118,
-REG_TTMP_7 = 119,
-REG_TTMP_8 = 120,
-REG_TTMP_9 = 121,
-REG_TTMP_10 = 122,
-REG_TTMP_11 = 123,
-REG_M0 = 124,
-REG_RESERVED_1 = 125,
-REG_EXEC_LO = 126,
-REG_EXEC_HI = 127,
-REG_ZERO = 128,
-REG_INT_CONST_POS_MIN = 129,
-REG_INT_CONST_POS_MAX = 192,
-REG_INT_CONST_NEG_MIN = 193,
-REG_INT_CONST_NEG_MAX = 208,
-REG_RESERVED_2 = 209,
-REG_RESERVED_3 = 210,
-REG_RESERVED_4 = 211,
-REG_RESERVED_5 = 212,
-REG_RESERVED_6 = 213,
-REG_RESERVED_7 = 214,
-REG_RESERVED_8 = 215,
-REG_RESERVED_9 = 216,
-REG_RESERVED_10 = 217,
-REG_RESERVED_11 = 218,
-REG_RESERVED_12 = 219,
-REG_RESERVED_13 = 220,
-REG_RESERVED_14 = 221,
-REG_RESERVED_15 = 222,
-REG_RESERVED_16 = 223,
-REG_RESERVED_17 = 224,
-REG_RESERVED_18 = 225,
-REG_RESERVED_19 = 226,
-REG_RESERVED_20 = 227,
-REG_RESERVED_21 = 228,
-REG_RESERVED_22 = 229,
-REG_RESERVED_23 = 230,
-REG_RESERVED_24 = 231,
-REG_RESERVED_25 = 232,
-REG_RESERVED_26 = 233,
-REG_RESERVED_27 = 234,
-REG_RESERVED_28 = 235,
-REG_RESERVED_29 

[gem5-dev] Build failed in Jenkins: compiler-checks #71

2021-12-08 Thread jenkins-no-reply--- via gem5-dev
See 


Changes:

[melissakjost] dev: Added new LupIO-RTC device

[melissakjost] dev: Introduced new LupV Platform

[melissakjost] stdlib: Introduced new LupV Board

[melissakjost] dev: Added new LupIO-RNG device

[melissakjost] stdlib: Added LupioRNG to LupVBoard

[melissakjost] dev: Added new LupIO-TTY device

[melissakjost] stdlib: Added LupioTTY to LupVBoard

[melissakjost] dev: Added new Lupio-BLK Device

[melissakjost] stdlib: Added LupioBLK Device to LupVBoard

[melissakjost] dev: Added new LupIO-TMR device

[melissakjost] dev: Added new LupIO-PIC device

[melissakjost] stdlib: Modified LupV Platform + Board to use LupioPIC + TMR

[melissakjost] dev: Modified LupioBLK and LupioTTY to use LupioPIC

[melissakjost] dev: Modify LupIO-TMR for SMP support

[melissakjost] dev: Added new Lupio-IPI device

[melissakjost] stdlib: Added LupIO-IPI to the LupV Board

[melissakjost] dev: Added new Lupio-SYS device

[melissakjost] stdlib: Added Lupio-SYS device to LupV Board

[melissakjost] stdlib: Moved LupV Board to an experimental folder

[melissakjost] stdlib: Update the LupvBoard to account for stdlib changes

[melissakjost] stdlib: Update the LupvBoard to use 'requires'

[melissakjost] stdlib: Update the LupvBoard to use KernelDiskWorkload

[melissakjost] configs: Added LupV script to configs

[gabe.black] sim-se: Handle empty paths when resolving an "at" path.

[gabe.black] sim-se: Implement the newfstatat system call.

[gabe.black] arch-x86: Hook up system calls for 64 bit processes.

[gabe.black] arch-x86: Hook up the newfstatat system call for 64 bit Linux.

[yuhsingw] fastmodel: add setResetAddr interface

[yuhsingw] fastmodel: CortexA76 implements setResetAddr interface

[yuhsingw] fastmodel: CortexR52 implements setResetAddr interface


--
Started by timer
Running as SYSTEM
Building in workspace 
The recommended git tool is: NONE
No credentials specified
 > git rev-parse --resolve-git-dir 
 >  # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url https://gem5.googlesource.com/public/gem5 # 
 > timeout=10
Fetching upstream changes from https://gem5.googlesource.com/public/gem5
 > git --version # timeout=10
 > git --version # 'git version 2.25.1'
 > git fetch --tags --force --progress -- 
 > https://gem5.googlesource.com/public/gem5 
 > +refs/heads/*:refs/remotes/origin/* # timeout=10
 > git rev-parse refs/remotes/origin/develop^{commit} # timeout=10
Checking out Revision 60e55ecef8310fc861e1effb0b1776c732abeacc 
(refs/remotes/origin/develop)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f 60e55ecef8310fc861e1effb0b1776c732abeacc # timeout=10
Commit message: "fastmodel: CortexR52 implements setResetAddr interface"
 > git rev-list --no-walk df516127145505177de0f01fa6d8985cf061d6af # timeout=10
[compiler-checks] $ /bin/sh -xe /tmp/jenkins877689978860865276.sh
+ ./tests/compiler-tests.sh -j 40
Starting build tests with 'gcc-version-11'...
'gcc-version-11' was found in the comprehensive tests. All ISAs will be built.
  * Building target 'NULL_MOESI_CMP_directory.opt' with 'gcc-version-11'...
Done.
  * Building target 'NULL_MOESI_CMP_directory.fast' with 'gcc-version-11'...
Done.
  * Building target 'RISCV.opt' with 'gcc-version-11'...
Done.
  * Building target 'RISCV.fast' with 'gcc-version-11'...
Done.
  * Building target 'POWER.opt' with 'gcc-version-11'...
Done.
  * Building target 'POWER.fast' with 'gcc-version-11'...
Done.
  * Building target 'NULL_MESI_Two_Level.opt' with 'gcc-version-11'...
Done.
  * Building target 'NULL_MESI_Two_Level.fast' with 'gcc-version-11'...
Done.
  * Building target 'ARM_MOESI_hammer.opt' with 'gcc-version-11'...
Done.
  * Building target 'ARM_MOESI_hammer.fast' with 'gcc-version-11'...
Done.
  * Building target 'MIPS.opt' with 'gcc-version-11'...
Done.
  * Building target 'MIPS.fast' with 'gcc-version-11'...
Done.
  * Building target 'ARM.opt' with 'gcc-version-11'...
Done.
  * Building target 'ARM.fast' with 'gcc-version-11'...
Done.
  * Building target 'GCN3_X86.opt' with 'gcc-version-11'...
Done.
  * Building target 'GCN3_X86.fast' with 'gcc-version-11'...
Done.
  * Building target 'X86.opt' with 'gcc-version-11'...
Done.
  * Building target 'X86.fast' with 'gcc-version-11'...
Done.
  * Building target 'SPARC.opt' with 'gcc-version-11'...
Done.
  * Building target 'SPARC.fast' with 'gcc-version-11'...
Done.
  * Building target 'Garnet_standalone.opt' with 'gcc-version-11'...
Done.
  * Building target 'Garnet_standalone.fast' with 'gcc-version-11'...
Done.
  * Building target 'X86_MOESI_AMD_Base.opt' with 'gcc-version-11'...
Done.
  * Building target 'X86_MOESI_AMD_Base.fast' with 'gcc-version-11'...

[gem5-dev] Change in gem5/gem5[develop]: python: Define deprecated and callOnce decorators

2021-12-08 Thread Meatboy 106 (Gerrit) via gem5-dev
Meatboy 106 has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/53523 )


Change subject: python: Define deprecated and callOnce decorators
..

python: Define deprecated and callOnce decorators

Change-Id: I85d52a65308b9d5068a9aaa46597e5eaf8175064
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/53523
Reviewed-by: Jason Lowe-Power 
Maintainer: Jason Lowe-Power 
Reviewed-by: Andreas Sandberg 
Maintainer: Andreas Sandberg 
Tested-by: kokoro 
---
M src/python/m5/util/__init__.py
1 file changed, 47 insertions(+), 0 deletions(-)

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




diff --git a/src/python/m5/util/__init__.py b/src/python/m5/util/__init__.py
index a63fa81..f5b5c79 100644
--- a/src/python/m5/util/__init__.py
+++ b/src/python/m5/util/__init__.py
@@ -41,6 +41,8 @@
 import re
 import sys

+from functools import wraps
+
 from . import convert

 from .attrdict import attrdict, multiattrdict, optiondict
@@ -71,6 +73,36 @@
 def inform(fmt, *args):
 print('info:', fmt % args, file=sys.stdout)

+def callOnce(func):
+"""Decorator that enables to run a given function only once. Subsequent
+calls are discarded."""
+@wraps(func)
+def wrapper(*args, **kwargs):
+if not wrapper.has_run:
+wrapper.has_run = True
+return func(*args, **kwargs)
+wrapper.has_run = False
+return wrapper
+
+def deprecated(replacement=None, logger=warn):
+"""This decorator warns the user about a deprecated function."""
+def decorator(func):
+@callOnce
+def notifyDeprecation():
+try:
+func_name = lambda f: f.__module__ + '.' +  f.__qualname__
+message = f'Function {func_name(func)} is deprecated.'
+if replacement:
+message += f' Prefer {func_name(replacement)} instead.'
+except AttributeError:
+message = f'Function {func} is deprecated.'
+if replacement:
+message += f' Prefer {replacement} instead.'
+logger(message)
+notifyDeprecation()
+return func
+return decorator
+
 class Singleton(type):
 def __call__(cls, *args, **kwargs):
 if hasattr(cls, '_instance'):

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/53523
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: I85d52a65308b9d5068a9aaa46597e5eaf8175064
Gerrit-Change-Number: 53523
Gerrit-PatchSet: 6
Gerrit-Owner: Meatboy 106 
Gerrit-Reviewer: Andreas Sandberg 
Gerrit-Reviewer: Bobby Bruce 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: Meatboy 106 
Gerrit-Reviewer: kokoro 
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

[gem5-dev] Change in gem5/gem5[develop]: scons: Remove a workaround for a very old SCons bug.

2021-12-08 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/49419 )


 (

2 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the  
submitted one.

 )Change subject: scons: Remove a workaround for a very old SCons bug.
..

scons: Remove a workaround for a very old SCons bug.

I can't conclusively verify that this issue has been fixed because I
can't find any information about it on the internet. It's "SCons bug
2006" and "gem5 bug 308" but neither project still uses whatever bug
tracking mechanism those numbers correspond to. The change was mentioned
in the gem5 code base at least as early as 2008, and so hopefully has
been fixed in the last 13 years. I did a clean build without this
workaround, and things seem to work.

Change-Id: I155f0e72cb720fb5d35d8098375a45a69ea02263
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49419
Maintainer: Gabe Black 
Reviewed-by: Andreas Sandberg 
Tested-by: kokoro 
---
M src/SConscript
1 file changed, 21 insertions(+), 5 deletions(-)

Approvals:
  Andreas Sandberg: Looks good to me, approved
  Gabe Black: Looks good to me, approved
  kokoro: Regressions pass




diff --git a/src/SConscript b/src/SConscript
index c514fc7..b19c3c5 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -432,11 +432,6 @@
 for extra_dir in extras_dir_list:
 env.Append(CPPPATH=Dir(extra_dir))

-# Workaround for bug in SCons version > 0.97d20071212
-# Scons bug id: 2006 gem5 Bug id: 308
-for root, dirs, files in os.walk(base_dir, topdown=True):
-Dir(root[len(base_dir) + 1:])
-
 
 #
 # Walk the tree and execute all SConscripts in subdirectories

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/49419
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: I155f0e72cb720fb5d35d8098375a45a69ea02263
Gerrit-Change-Number: 49419
Gerrit-PatchSet: 33
Gerrit-Owner: Gabe Black 
Gerrit-Reviewer: Andreas Sandberg 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: kokoro 
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

[gem5-dev] Change in gem5/gem5[develop]: scons: Ensure the gem5py_env always has embedded python.

2021-12-08 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/49422 )


 (

4 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the  
submitted one.

 )Change subject: scons: Ensure the gem5py_env always has embedded python.
..

scons: Ensure the gem5py_env always has embedded python.

Even if the gem5 binary itself won't.

Change-Id: I825e2cbed35a3dcc4fb4bec6f2fd71e78164e7c0
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49422
Maintainer: Gabe Black 
Reviewed-by: Andreas Sandberg 
Tested-by: kokoro 
---
M SConstruct
1 file changed, 36 insertions(+), 15 deletions(-)

Approvals:
  Andreas Sandberg: Looks good to me, approved
  Gabe Black: Looks good to me, approved
  kokoro: Regressions pass




diff --git a/SConstruct b/SConstruct
index 9c7a43a..8fa5517 100755
--- a/SConstruct
+++ b/SConstruct
@@ -482,24 +482,25 @@
 

 main['USE_PYTHON'] = not GetOption('without_python')
-if main['USE_PYTHON']:
+
+def config_embedded_python(env):
 # Find Python include and library directories for embedding the
 # interpreter. We rely on python-config to resolve the appropriate
 # includes and linker flags. If you want to link in an alternate  
version

 # of python, override the PYTHON_CONFIG variable.

-python_config = main.Detect(main['PYTHON_CONFIG'])
+python_config = env.Detect(env['PYTHON_CONFIG'])
 if python_config is None:
-error("Can't find a suitable python-config, tried %s" % \
-  main['PYTHON_CONFIG'])
+error("Can't find a suitable python-config, tried "
+  f"{env['PYTHON_CONFIG']}")

-print("Info: Using Python config: %s" % python_config)
+print(f"Info: Using Python config: {python_config}")

 cmd = [python_config, '--ldflags', '--includes']

 # Starting in Python 3.8 the --embed flag is required. Use it if  
supported.

-with gem5_scons.Configure(main) as conf:
-if conf.TryAction('@%s --embed' % python_config)[0]:
+with gem5_scons.Configure(env) as conf:
+if conf.TryAction(f'@{python_config} --embed')[0]:
 cmd.append('--embed')

 def flag_filter(env, cmd_output):
@@ -509,11 +510,11 @@
 useful_flags = list(filter(is_useful, flags))
 env.MergeFlags(' '.join(useful_flags))

-main.ParseConfig(cmd, flag_filter)
+env.ParseConfig(cmd, flag_filter)

-main.Prepend(CPPPATH=Dir('ext/pybind11/include/'))
+env.Prepend(CPPPATH=Dir('ext/pybind11/include/'))

-with gem5_scons.Configure(main) as conf:
+with gem5_scons.Configure(env) as conf:
 # verify that this stuff works
 if not conf.CheckHeader('Python.h', '<>'):
 error("Check failed for Python.h header.\n",
@@ -522,7 +523,7 @@
   "package python-dev on Ubuntu and RedHat)\n"
   "2. SCons is using a wrong C compiler. This can happen  
if "

   "CC has the wrong value.\n"
-  "CC = %s" % main['CC'])
+  f"CC = {env['CC']}")
 py_version = conf.CheckPythonLib()
 if not py_version:
 error("Can't find a working Python installation")
@@ -531,13 +532,18 @@
 # requirements.
 ver_string = '.'.join(map(str, py_version))
 if py_version[0] < 3 or (py_version[0] == 3 and py_version[1] < 6):
-error('Embedded python library 3.6 or newer required, found %s.' %
-  ver_string)
+error('Embedded python library 3.6 or newer required, found '
+  f'{ver_string}.')
 elif py_version[0] > 3:
 warning('Embedded python library too new. '
-'Python 3 expected, found %s.' % ver_string)
+f'Python 3 expected, found {ver_string}.')

-gem5py_env = main.Clone()
+if main['USE_PYTHON']:
+config_embedded_python(main)
+gem5py_env = main.Clone()
+else:
+gem5py_env = main.Clone()
+config_embedded_python(gem5py_env)

 # Bare minimum environment that only includes python
 gem5py_env.Append(CCFLAGS=['${GEM5PY_CCFLAGS_EXTRA}'])

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/49422
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: I825e2cbed35a3dcc4fb4bec6f2fd71e78164e7c0
Gerrit-Change-Number: 49422
Gerrit-PatchSet: 34
Gerrit-Owner: Gabe Black 
Gerrit-Reviewer: Andreas Sandberg 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: kokoro 
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

[gem5-dev] Change in gem5/gem5[develop]: scons: Also build param struct .cc files using a helper script.

2021-12-08 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/49425 )


 (

32 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the  
submitted one.
 )Change subject: scons: Also build param struct .cc files using a helper  
script.

..

scons: Also build param struct .cc files using a helper script.

There was a comment in the SConscript talking about building a single
.cc file for all the param structs, but that's not what the code was
actually doing. This change drops that misleading comment.

Change-Id: I3a5e4424e1021d6dfbdeafcef7709dae988747a4
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49425
Reviewed-by: Jason Lowe-Power 
Maintainer: Jason Lowe-Power 
Tested-by: kokoro 
---
A build_tools/sim_object_param_struct_cc.py
M src/SConscript
2 files changed, 101 insertions(+), 25 deletions(-)

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




diff --git a/build_tools/sim_object_param_struct_cc.py  
b/build_tools/sim_object_param_struct_cc.py

new file mode 100644
index 000..7266556
--- /dev/null
+++ b/build_tools/sim_object_param_struct_cc.py
@@ -0,0 +1,62 @@
+# Copyright 2021 Google, Inc.
+#
+# 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.
+
+import argparse
+import importlib
+import os.path
+import sys
+
+import importer
+
+from code_formatter import code_formatter
+
+parser = argparse.ArgumentParser()
+parser.add_argument('modpath', help='module the simobject belongs to')
+parser.add_argument('param_cc', help='parameter cc file to generate')
+parser.add_argument('use_python',
+help='whether python is enabled in gem5 (True or False)')
+
+args = parser.parse_args()
+
+use_python = args.use_python.lower()
+if use_python == 'true':
+use_python = True
+elif use_python == 'false':
+use_python = False
+else:
+print(f'Unrecognized "use_python" value {use_python}', file=sys.stderr)
+sys.exit(1)
+
+basename = os.path.basename(args.param_cc)
+no_ext = os.path.splitext(basename)[0]
+sim_object_name = '_'.join(no_ext.split('_')[1:])
+
+importer.install()
+module = importlib.import_module(args.modpath)
+sim_object = getattr(module, sim_object_name)
+
+code = code_formatter()
+sim_object.params_create_decl(code, use_python)
+code.write(args.param_cc)
diff --git a/src/SConscript b/src/SConscript
index 97214a4..7eb810a 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -147,6 +147,7 @@

 sim_objects = dict()
 enums = dict()
+tags = dict()

 def __init__(self, source, *, sim_objects=[], enums=[],
 tags=None, add_tags=None):
@@ -158,6 +159,7 @@

 SimObject.sim_objects[self.modpath] = sim_objects
 SimObject.enums[self.modpath] = enums
+SimObject.tags[self.modpath] = self.tags

 # This regular expression is simplistic and assumes that the import takes  
up
 # the entire line, doesn't have the keyword "public", uses double quotes,  
has

@@ -665,16 +667,33 @@
 # Generate all of the SimObject param C++ struct header files

 for module, simobjs in sorted(SimObject.sim_objects.items()):
+tags = SimObject.tags[module]
 for simobj in simobjs:
-gem5py_env.Command(f'params/{simobj}.hh',
+gem5py_env.Command([ "${PARAMS_HH}" ],
 [ Value(module), Value(simobj),
 "${GEM5PY_M5}", "${PARAMSTRUCT_PY}" ],
  
MakeAction('"${GEM5PY_M5}" 

[gem5-dev] Change in gem5/gem5[develop]: python,sim,util: Move EmbeddedPython into it's own file.

2021-12-08 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/49418 )


 (

30 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the  
submitted one.

 )Change subject: python,sim,util: Move EmbeddedPython into it's own file.
..

python,sim,util: Move EmbeddedPython into it's own file.

By separating out this utility class, we make it possible to build
embedded python modules into other binarys without dragging along lots
of other, unrelated gem5 dependencies.

Also, move the class from sim/init.hh (which is a largely unrelated
name) to python/embedded.hh which much more directly describes what that
file contains.

Change-Id: Ia83439144893ad8401a5d51003e2686d9c9b2d7b
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49418
Reviewed-by: Gabe Black 
Maintainer: Gabe Black 
Tested-by: kokoro 
---
M build_tools/marshal.py
A src/python/embedded.cc
A src/python/embedded.hh
M src/python/importer.cc
M src/sim/main.cc
M src/python/SConscript
M src/sim/init.cc
M src/sim/init.hh
8 files changed, 213 insertions(+), 88 deletions(-)

Approvals:
  Gabe Black: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass




diff --git a/build_tools/marshal.py b/build_tools/marshal.py
index a2af1b0..9c2964b 100644
--- a/build_tools/marshal.py
+++ b/build_tools/marshal.py
@@ -77,7 +77,7 @@

 code = code_formatter()
 code('''\
-#include "sim/init.hh"
+#include "python/embedded.hh"

 namespace gem5
 {
diff --git a/src/python/SConscript b/src/python/SConscript
index 1fab974..c9cd2d4 100644
--- a/src/python/SConscript
+++ b/src/python/SConscript
@@ -253,6 +253,7 @@
 PySource('m5.ext.pystats', 'm5/ext/pystats/jsonloader.py')
 PySource('m5.stats', 'm5/stats/gem5stats.py')

+Source('embedded.cc', add_tags='python')
 Source('importer.cc', add_tags='python')
 cc, hh = env.Blob('m5ImporterCode', 'importer.py')
 Source(cc, add_tags='python')
diff --git a/src/python/embedded.cc b/src/python/embedded.cc
new file mode 100644
index 000..27bf770
--- /dev/null
+++ b/src/python/embedded.cc
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2012, 2017 ARM Limited
+ * All rights reserved
+ *
+ * The license below extends only to copyright in the software and shall
+ * not be construed as granting a license to any other intellectual
+ * property including but not limited to intellectual property relating
+ * to a hardware implementation of the functionality of the software
+ * licensed hereunder.  You may use the software subject to the license
+ * terms below provided that you ensure that this notice is replicated
+ * unmodified and in its entirety in all distributions of the software,
+ * modified or unmodified, in source code or in binary form.
+ *
+ * Copyright (c) 2000-2005 The Regents of The University of Michigan
+ * Copyright (c) 2008 The Hewlett-Packard Development Company
+ * 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.
+ */
+
+#include "pybind11/embed.h"
+
+#include "python/embedded.hh"
+
+#include 
+
+#include 
+
+#include "base/logging.hh"
+
+namespace py = pybind11;
+
+namespace gem5
+{
+
+EmbeddedPython::EmbeddedPython(const char *abspath, const char *modpath,
+const unsigned char *code, int zlen, int len)
+: abspath(abspath), modpath(modpath), code(code), zlen(zlen), len(len)
+{
+getList().push_back(this);
+}
+
+std::list &
+EmbeddedPython::getList()
+{
+static std::list 

[gem5-dev] Change in gem5/gem5[develop]: scons: Use an external script to generate param struct headers.

2021-12-08 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/49424 )


 (

32 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the  
submitted one.
 )Change subject: scons: Use an external script to generate param struct  
headers.

..

scons: Use an external script to generate param struct headers.

Change-Id: I633537f2b7542350895e50fe79dd80c88a811a41
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49424
Reviewed-by: Jason Lowe-Power 
Maintainer: Jason Lowe-Power 
Tested-by: kokoro 
---
A build_tools/sim_object_param_struct_hh.py
M src/SConscript
2 files changed, 74 insertions(+), 28 deletions(-)

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




diff --git a/build_tools/sim_object_param_struct_hh.py  
b/build_tools/sim_object_param_struct_hh.py

new file mode 100644
index 000..0652ae5
--- /dev/null
+++ b/build_tools/sim_object_param_struct_hh.py
@@ -0,0 +1,50 @@
+# Copyright 2021 Google, Inc.
+#
+# 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.
+
+import argparse
+import importlib
+import os.path
+import sys
+
+import importer
+
+from code_formatter import code_formatter
+
+parser = argparse.ArgumentParser()
+parser.add_argument('modpath', help='module the simobject belongs to')
+parser.add_argument('param_hh', help='parameter header file to generate')
+
+args = parser.parse_args()
+
+basename = os.path.basename(args.param_hh)
+sim_object_name = os.path.splitext(basename)[0]
+
+importer.install()
+module = importlib.import_module(args.modpath)
+sim_object = getattr(module, sim_object_name)
+
+code = code_formatter()
+sim_object.cxx_param_decl(code)
+code.write(args.param_hh)
diff --git a/src/SConscript b/src/SConscript
index c390b81..97214a4 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -664,34 +664,17 @@

 # Generate all of the SimObject param C++ struct header files

-def createSimObjectParamStruct(target, source, env):
-assert len(target) == 1 and len(source) == 1
-
-name = source[0].get_text_contents()
-obj = sim_objects[name]
-
-code = code_formatter()
-obj.cxx_param_decl(code)
-code.write(target[0].abspath)
-
-params_hh_files = []
-for name,simobj in sorted(sim_objects.items()):
-# If this simobject's source changes, we need to regenerate the header.
-py_source = PySource.modules[simobj.__module__]
-extra_deps = [ py_source.tnode ]
-
-# Get the params for just this SimObject, excluding base classes.
-params = simobj._params.local.values()
-# Extract the parameters' c++ types.
-types = sorted(map(lambda p: p.ptype.cxx_type, params))
-# If any of these types have changed, we need to regenerate the header.
-extra_deps.append(Value(types))
-
-hh_file = File('params/%s.hh' % name)
-params_hh_files.append(hh_file)
-env.Command(hh_file, Value(name),
-MakeAction(createSimObjectParamStruct, Transform("SO  
PARAM")))

-env.Depends(hh_file, depends + extra_deps)
+for module, simobjs in sorted(SimObject.sim_objects.items()):
+for simobj in simobjs:
+gem5py_env.Command(f'params/{simobj}.hh',
+[ Value(module), Value(simobj),
+"${GEM5PY_M5}", "${PARAMSTRUCT_PY}" ],
+ 
MakeAction('"${GEM5PY_M5}" "${PARAMSTRUCT_PY}" "${MODULE}" ' \

+'"${TARGET}"',
+Transform("SO Param", 

[gem5-dev] Change in gem5/gem5[develop]: python,scons: Add a gem5py_m5 program which supports the m5 module.

2021-12-08 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/49421 )


 (

32 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the  
submitted one.
 )Change subject: python,scons: Add a gem5py_m5 program which supports the  
m5 module.

..

python,scons: Add a gem5py_m5 program which supports the m5 module.

Like gem5py which uses the same main source file, this program will run
arbitrary python scripts. Unlike the other program, it will include
support for the m5 module. That will make it capable of generating
SimObject param, enum, etc c++ files.

Change-Id: I15fd7545f6b1ea6559cbe27cef30c778867ebe70
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49421
Reviewed-by: Jason Lowe-Power 
Maintainer: Jason Lowe-Power 
Tested-by: kokoro 
---
M src/python/SConscript
M src/SConscript
2 files changed, 35 insertions(+), 5 deletions(-)

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




diff --git a/src/SConscript b/src/SConscript
index b19c3c5..d566010 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -81,8 +81,11 @@
 # as gem5. This is in an unorthodox location to avoid building it for every
 # variant.
 gem5py_env = gem5py_env.Clone()
-gem5py = gem5py_env.Program('gem5py', 'python/gem5py.cc')[0]
+gem5py = gem5py_env.File('gem5py')
+gem5py_m5 = gem5py_env.File('gem5py_m5')
 gem5py_env['GEM5PY'] = gem5py
+gem5py_env['GEM5PY_M5'] = gem5py_m5
+gem5py_env['OBJSUFFIX'] = '.pyo'
 # Inject build_tools into PYTHONPATH for when we run gem5py.
 pythonpath = gem5py_env['ENV'].get('PYTHONPATH', '').split(':')
 pythonpath.append(build_tools.abspath)
@@ -134,7 +137,7 @@
'"${PYSOURCE_ABSPATH}"',
Transform("EMBED PY", max_sources=1)),
 **overrides)
-Source(cpp, tags=self.tags, add_tags='python')
+Source(cpp, tags=self.tags, add_tags=['python', 'm5_module'])

 class SimObject(PySource):
 '''Add a SimObject python file as a python source object and add
@@ -640,6 +643,15 @@
 INFOPY_PY=build_tools.File('infopy.py'))
 PySource('m5', 'python/m5/info.py')

+gem5py_m5_env = gem5py_env.Clone()
+gem5py_env.Append(CPPPATH=env['CPPPATH'])
+gem5py_env.Append(LIBS='z')
+gem5py_env.Program(gem5py, 'python/gem5py.cc')[0]
+m5_module_source = \
+Source.all.with_all_tags(env, 'm5_module', 'gem5 lib')
+m5_module_static = list(map(lambda s: s.static(gem5py_env),  
m5_module_source))

+gem5py_env.Program(gem5py_m5, [ 'python/gem5py.cc' ] + m5_module_static)
+
 
 #
 # Create all of the SimObject param headers and enum headers
diff --git a/src/python/SConscript b/src/python/SConscript
index c9cd2d4..1939100 100644
--- a/src/python/SConscript
+++ b/src/python/SConscript
@@ -253,10 +253,10 @@
 PySource('m5.ext.pystats', 'm5/ext/pystats/jsonloader.py')
 PySource('m5.stats', 'm5/stats/gem5stats.py')

-Source('embedded.cc', add_tags='python')
-Source('importer.cc', add_tags='python')
+Source('embedded.cc', add_tags=['python', 'm5_module'])
+Source('importer.cc', add_tags=['python', 'm5_module'])
 cc, hh = env.Blob('m5ImporterCode', 'importer.py')
-Source(cc, add_tags='python')
+Source(cc, add_tags=['python', 'm5_module'])

 Source('pybind11/core.cc', add_tags='python')
 Source('pybind11/debug.cc', add_tags='python')

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/49421
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: I15fd7545f6b1ea6559cbe27cef30c778867ebe70
Gerrit-Change-Number: 49421
Gerrit-PatchSet: 34
Gerrit-Owner: Gabe Black 
Gerrit-Reviewer: Andreas Sandberg 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: kokoro 
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

[gem5-dev] Change in gem5/gem5[develop]: python: Remove python/embedded.cc's dependence on the rest of gem5.

2021-12-08 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/49420 )


 (

4 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the  
submitted one.
 )Change subject: python: Remove python/embedded.cc's dependence on the  
rest of gem5.

..

python: Remove python/embedded.cc's dependence on the rest of gem5.

If embedded python modules are going to be built into other binaries,
then they can't depend on other parts of gem5.

Change-Id: I4e12f1962cb6330e70866a40388689102c23693a
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49420
Maintainer: Gabe Black 
Reviewed-by: Andreas Sandberg 
Tested-by: kokoro 
---
M src/python/embedded.cc
1 file changed, 22 insertions(+), 4 deletions(-)

Approvals:
  Andreas Sandberg: Looks good to me, approved
  Gabe Black: Looks good to me, approved
  kokoro: Regressions pass




diff --git a/src/python/embedded.cc b/src/python/embedded.cc
index 27bf770..4b129dd 100644
--- a/src/python/embedded.cc
+++ b/src/python/embedded.cc
@@ -45,10 +45,10 @@

 #include 

+#include 
+#include 
 #include 

-#include "base/logging.hh"
-
 namespace py = pybind11;

 namespace gem5
@@ -78,8 +78,10 @@
 Bytef marshalled[len];
 uLongf unzlen = len;
 int ret = uncompress(marshalled, , (const Bytef *)code, zlen);
-if (ret != Z_OK)
-panic("Could not uncompress code: %s\n", zError(ret));
+if (ret != Z_OK) {
+std::cerr << "Could not uncompress code: " << zError(ret) <<  
std::endl;

+std::abort();
+}
 assert(unzlen == (uLongf)len);

 auto marshal = py::module_::import("marshal");

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/49420
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: I4e12f1962cb6330e70866a40388689102c23693a
Gerrit-Change-Number: 49420
Gerrit-PatchSet: 34
Gerrit-Owner: Gabe Black 
Gerrit-Reviewer: Andreas Sandberg 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: kokoro 
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

[gem5-dev] Change in gem5/gem5[develop]: scons: Record the sim_objects and enums passed into SimObject().

2021-12-08 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/49423 )


 (

32 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the  
submitted one.
 )Change subject: scons: Record the sim_objects and enums passed into  
SimObject().

..

scons: Record the sim_objects and enums passed into SimObject().

We'll use those to tell SCons what params headers, etc, to generate.

Change-Id: Iedc9c6a8cdfc2201e85bc7ba1d420dfa08b90cab
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49423
Reviewed-by: Jason Lowe-Power 
Maintainer: Jason Lowe-Power 
Tested-by: kokoro 
---
M src/SConscript
1 file changed, 20 insertions(+), 0 deletions(-)

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




diff --git a/src/SConscript b/src/SConscript
index d566010..c390b81 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -145,6 +145,9 @@

 fixed = False

+sim_objects = dict()
+enums = dict()
+
 def __init__(self, source, *, sim_objects=[], enums=[],
 tags=None, add_tags=None):
 '''Specify the source file and any tags (automatically in
@@ -153,6 +156,8 @@
 if self.fixed:
 raise AttributeError("Too late to call SimObject now.")

+SimObject.sim_objects[self.modpath] = sim_objects
+SimObject.enums[self.modpath] = enums

 # This regular expression is simplistic and assumes that the import takes  
up
 # the entire line, doesn't have the keyword "public", uses double quotes,  
has


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/49423
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: Iedc9c6a8cdfc2201e85bc7ba1d420dfa08b90cab
Gerrit-Change-Number: 49423
Gerrit-PatchSet: 34
Gerrit-Owner: Gabe Black 
Gerrit-Reviewer: Andreas Sandberg 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: kokoro 
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

[gem5-dev] Change in gem5/gem5[develop]: scons: When importing SimObjects, use a copy of globals().

2021-12-08 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/49407 )


 (

29 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the  
submitted one.

 )Change subject: scons: When importing SimObjects, use a copy of globals().
..

scons: When importing SimObjects, use a copy of globals().

Use a copy of globals when importing SimObjects, instead of the real
deal that the SConscript runs under. This avoids polluting the
SConscript namespace.

Change-Id: I689d693d93cc8998be0967ec2b0c58f5851d39cf
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49407
Reviewed-by: Jason Lowe-Power 
Maintainer: Jason Lowe-Power 
Tested-by: kokoro 
---
M src/SConscript
1 file changed, 19 insertions(+), 1 deletion(-)

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




diff --git a/src/SConscript b/src/SConscript
index 9cbfbdf..c514fc7 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -594,12 +594,13 @@
 importer = M5MetaPathFinder(PySource.modules)
 sys.meta_path[0:0] = [ importer ]

+import_globals = globals().copy()
 # import all sim objects so we can populate the all_objects list
 # make sure that we're working with a list, then let's sort it
 gem5_lib_simobjects = SimObject.all.with_tag(env, 'gem5 lib')
 gem5_lib_modnames = sorted(map(lambda so: so.modname, gem5_lib_simobjects))
 for modname in gem5_lib_modnames:
-exec('from m5.objects import %s' % modname)
+exec('from m5.objects import %s' % modname, import_globals)

 # we need to unload all of the currently imported modules so that they
 # will be re-imported the next time the sconscript is run

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/49407
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: I689d693d93cc8998be0967ec2b0c58f5851d39cf
Gerrit-Change-Number: 49407
Gerrit-PatchSet: 31
Gerrit-Owner: Gabe Black 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: kokoro 
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

[gem5-dev] Change in gem5/gem5[develop]: sim,misc: Move protobuf housekeeping out of gem5Main.

2021-12-08 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/49416 )


 (

2 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the  
submitted one.

 )Change subject: sim,misc: Move protobuf housekeeping out of gem5Main.
..

sim,misc: Move protobuf housekeeping out of gem5Main.

Put that code into a singleton class in src/proto, so that it gets
called during initialization and teardown of gem5 without cluttering up
gem5Main. This also removes the need to use #ifdefs to guard for
actualling having protobuf support.

Change-Id: I93b5d994eee478a9c159a3f3d02b3e996af02a3e
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49416
Maintainer: Gabe Black 
Reviewed-by: Andreas Sandberg 
Tested-by: kokoro 
---
M src/proto/SConscript
M src/sim/init.cc
A src/proto/protobuf.cc
3 files changed, 87 insertions(+), 18 deletions(-)

Approvals:
  Andreas Sandberg: Looks good to me, approved
  Gabe Black: Looks good to me, approved
  kokoro: Regressions pass




diff --git a/src/proto/SConscript b/src/proto/SConscript
index 9ca38f7..09589a9 100644
--- a/src/proto/SConscript
+++ b/src/proto/SConscript
@@ -42,6 +42,7 @@
 ProtoBuf('inst_dep_record.proto')
 ProtoBuf('packet.proto')
 ProtoBuf('inst.proto')
+Source('protobuf.cc')
 Source('protoio.cc')

 # protoc relies on the fact that undefined preprocessor symbols are
diff --git a/src/proto/protobuf.cc b/src/proto/protobuf.cc
new file mode 100644
index 000..4f0a482
--- /dev/null
+++ b/src/proto/protobuf.cc
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2012, 2017 ARM Limited
+ * All rights reserved
+ *
+ * The license below extends only to copyright in the software and shall
+ * not be construed as granting a license to any other intellectual
+ * property including but not limited to intellectual property relating
+ * to a hardware implementation of the functionality of the software
+ * licensed hereunder.  You may use the software subject to the license
+ * terms below provided that you ensure that this notice is replicated
+ * unmodified and in its entirety in all distributions of the software,
+ * modified or unmodified, in source code or in binary form.
+ *
+ * Copyright (c) 2000-2005 The Regents of The University of Michigan
+ * Copyright (c) 2008 The Hewlett-Packard Development Company
+ * 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.
+ */
+
+#include 
+
+namespace gem5
+{
+
+namespace
+{
+
+struct ProtobufSingleton
+{
+ProtobufSingleton()
+{
+// Verify that the version of the protobuf library that we linked
+// against is compatible with the version of the headers we
+// compiled against.
+GOOGLE_PROTOBUF_VERIFY_VERSION;
+}
+
+~ProtobufSingleton()
+{
+google::protobuf::ShutdownProtobufLibrary();
+}
+} protobufSingleton;
+
+} // anonymous namespace
+
+} // namespace gem5
diff --git a/src/sim/init.cc b/src/sim/init.cc
index d612b0b..9d94618 100644
--- a/src/sim/init.cc
+++ b/src/sim/init.cc
@@ -53,14 +53,8 @@
 #include "base/cprintf.hh"
 #include "base/logging.hh"
 #include "base/types.hh"
-#include "config/have_protobuf.hh"
 #include "python/pybind11/pybind.hh"

-#if HAVE_PROTOBUF
-#include 
-
-#endif
-
 namespace py = pybind11;

 namespace gem5
@@ -204,14 +198,6 @@
 int
 gem5Main(int argc, char **argv)
 {
-#if HAVE_PROTOBUF
-// Verify that the version of the protobuf 

[gem5-dev] Change in gem5/gem5[develop]: sim: Use pybind11 consistently in sim/init.(hh|cc).

2021-12-08 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/49413 )


 (

31 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the  
submitted one.

 )Change subject: sim: Use pybind11 consistently in sim/init.(hh|cc).
..

sim: Use pybind11 consistently in sim/init.(hh|cc).

Use pybind11 to avoid having to use the python C API directly, which is
simpler, easier to read, and less error prone. Also, use its
PYBIND11_EMBEDDED_MODULE macro to set up the _m5 module instead of a
callback which has to be proactively called from main().

Change-Id: I9c8bcebea934844d16a1fdd88f66a5e66ef0486f
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49413
Maintainer: Bobby Bruce 
Reviewed-by: Gabe Black 
Reviewed-by: Jason Lowe-Power 
Tested-by: kokoro 
---
M src/sim/main.cc
M src/sim/init.cc
M src/sim/init.hh
3 files changed, 52 insertions(+), 72 deletions(-)

Approvals:
  Jason Lowe-Power: Looks good to me, approved
  Gabe Black: Looks good to me, but someone else must approve
  Bobby Bruce: Looks good to me, approved
  kokoro: Regressions pass




diff --git a/src/sim/init.cc b/src/sim/init.cc
index abbb8c2..5067604 100644
--- a/src/sim/init.cc
+++ b/src/sim/init.cc
@@ -39,14 +39,12 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */

-#include 
+#include "pybind11/embed.h"

 #include "sim/init.hh"

-#include 
 #include 

-#include 
 #include 
 #include 
 #include 
@@ -57,7 +55,6 @@
 #include "base/types.hh"
 #include "config/have_protobuf.hh"
 #include "python/pybind11/pybind.hh"
-#include "sim/async.hh"

 #if HAVE_PROTOBUF
 #include 
@@ -69,10 +66,6 @@
 namespace gem5
 {

-// The python library is totally messed up with respect to constness,
-// so make a simple macro to make life a little easier
-#define PyCC(x) (const_cast(x))
-
 EmbeddedPython::EmbeddedPython(const char *abspath, const char *modpath,
 const unsigned char *code, int zlen, int len)
 : abspath(abspath), modpath(modpath), code(code), zlen(zlen), len(len)
@@ -91,7 +84,7 @@
  * Uncompress and unmarshal the code object stored in the
  * EmbeddedPython
  */
-PyObject *
+py::object
 EmbeddedPython::getCode() const
 {
 Bytef marshalled[len];
@@ -101,17 +94,15 @@
 panic("Could not uncompress code: %s\n", zError(ret));
 assert(unzlen == (uLongf)len);

-return PyMarshal_ReadObjectFromString((char *)marshalled, len);
+auto marshal = py::module_::import("marshal");
+return marshal.attr("loads")(py::bytes((char *)marshalled, len));
 }

 bool
 EmbeddedPython::addModule() const
 {
-auto code = py::reinterpret_borrow(getCode());
-// Ensure that "code" is not garbage collected.
-code.inc_ref();
 auto importer = py::module_::import("importer");
-importer.attr("add_module")(abspath, modpath, code);
+importer.attr("add_module")(abspath, modpath, getCode());
 return true;
 }

@@ -168,34 +159,21 @@
 return objs;
 }

-PyObject *
-EmbeddedPyBind::initAll()
+void
+EmbeddedPyBind::initAll(py::module_ &_m5)
 {
 std::list pending;

-// The PyModuleDef structure needs to live as long as the module it
-// defines, so we'll leak it here so it lives forever. This is what
-// pybind11 does internally in the module_ constructor we were using.  
We

-// could theoretically keep track of the lifetime of the _m5 module
-// somehow and clean this up when it goes away, but that doesn't seem
-// worth the effort. The docs recommend statically allocating it, but  
that
-// could be unsafe on the very slim chance this method is called more  
than

-// once.
-auto *py_mod_def = new py::module_::module_def;
-py::module_ m_m5 = py::module_::create_extension_module(
-"_m5", nullptr, py_mod_def);
-m_m5.attr("__package__") = py::cast("_m5");
+pybind_init_core(_m5);
+pybind_init_debug(_m5);

-pybind_init_core(m_m5);
-pybind_init_debug(m_m5);
+pybind_init_event(_m5);
+pybind_init_stats(_m5);

-pybind_init_event(m_m5);
-pybind_init_stats(m_m5);
-
-for (auto  : getMap()) {
+for (auto  : EmbeddedPyBind::getMap()) {
 auto  = kv.second;
 if (obj->base.empty()) {
-obj->init(m_m5);
+obj->init(_m5);
 } else {
 pending.push_back(obj);
 }
@@ -205,23 +183,18 @@
 for (auto it = pending.begin(); it != pending.end(); ) {
 EmbeddedPyBind  = **it;
 if (obj.depsReady()) {
-obj.init(m_m5);
+obj.init(_m5);
 it = pending.erase(it);
 } else {
 ++it;
 }
 }
 }
-
-return m_m5.ptr();
 }

-void
-registerNativeModules()
+PYBIND11_EMBEDDED_MODULE(_m5, _m5)
 {
-auto result = PyImport_AppendInittab("_m5", EmbeddedPyBind::initAll);
-if (result == -1)
-

[gem5-dev] Change in gem5/gem5[develop]: python,sim: Change how the m5.* importer code is integrated.

2021-12-08 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/49410 )


 (

30 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the  
submitted one.
 )Change subject: python,sim: Change how the m5.* importer code is  
integrated.

..

python,sim: Change how the m5.* importer code is integrated.

Previously, the importer module was built into gem5 as a compressed
bytecode blob like all the other code, and it had to be singled out and
installed manually so that it could help bring in all the other modules.
That adds some amount of complexity since it has to be identified and
treated as a special case.

Instead, this change builds it into gem5 using pybind11's
PYBIND11_EMBEDDED_MODULE macro, and a string that gets evaluated into
the new module's __dict__. This means the importer module is
automatically available just by building in that .cc, and it can just be
imported to start using it.

Theoretically all the embedded python could be handled this way, but
that would mean building it into gem5 as raw strings which wouldn't even
be compiled into byte code until run time. That would take more space in
the binary, and also delay catching simple errors.

Change-Id: Ic600bf6bce41a53289a2833484a655dd5a226e03
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49410
Reviewed-by: Jason Lowe-Power 
Maintainer: Jason Lowe-Power 
Tested-by: kokoro 
---
A src/python/importer.cc
M src/python/SConscript
M src/sim/init.cc
M src/sim/init.hh
4 files changed, 81 insertions(+), 29 deletions(-)

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




diff --git a/src/python/SConscript b/src/python/SConscript
index 9f1cddb..1fab974 100644
--- a/src/python/SConscript
+++ b/src/python/SConscript
@@ -253,6 +253,10 @@
 PySource('m5.ext.pystats', 'm5/ext/pystats/jsonloader.py')
 PySource('m5.stats', 'm5/stats/gem5stats.py')

+Source('importer.cc', add_tags='python')
+cc, hh = env.Blob('m5ImporterCode', 'importer.py')
+Source(cc, add_tags='python')
+
 Source('pybind11/core.cc', add_tags='python')
 Source('pybind11/debug.cc', add_tags='python')
 Source('pybind11/event.cc', add_tags='python')
diff --git a/src/python/importer.cc b/src/python/importer.cc
new file mode 100644
index 000..c7beb62
--- /dev/null
+++ b/src/python/importer.cc
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2021 Google, Inc.
+ *
+ * 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.
+ */
+
+#include "pybind11/embed.h"
+#include "pybind11/pybind11.h"
+#include "python/m5ImporterCode.hh"
+
+namespace py = pybind11;
+
+PYBIND11_EMBEDDED_MODULE(importer, m)
+{
+py::str importer_code(
+reinterpret_cast(gem5::Blobs::m5ImporterCode),
+gem5::Blobs::m5ImporterCode_len);
+py::exec(std::move(importer_code), m.attr("__dict__"));
+}
diff --git a/src/sim/init.cc b/src/sim/init.cc
index ed54742..ce72b04 100644
--- a/src/sim/init.cc
+++ b/src/sim/init.cc
@@ -73,18 +73,11 @@
 // so make a simple macro to make life a little easier
 #define PyCC(x) (const_cast(x))

-EmbeddedPython *EmbeddedPython::importer = NULL;
-PyObject *EmbeddedPython::importerModule = NULL;
 EmbeddedPython::EmbeddedPython(const char *abspath, const char *modpath,
 const unsigned char *code, int zlen, int len)
 : abspath(abspath), modpath(modpath), code(code), zlen(zlen), len(len)
 {
-// if we've added the importer keep track of it 

[gem5-dev] Change in gem5/gem5[develop]: sim: Collapse gem5Main into main.

2021-12-08 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/49417 )


 (

30 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the  
submitted one.

 )Change subject: sim: Collapse gem5Main into main.
..

sim: Collapse gem5Main into main.

gem5Main is short and simple and only calls into python's m5.main()
function. It's also only called from one place and only makes sense to
call from one place, so lets just put it there inline and keep
everything together.

Change-Id: I17e303e3a29d5473f0f31cd51d7fb367f6c81f9e
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49417
Reviewed-by: Gabe Black 
Maintainer: Gabe Black 
Tested-by: kokoro 
---
M src/sim/main.cc
M src/sim/init.cc
M src/sim/init.hh
3 files changed, 49 insertions(+), 41 deletions(-)

Approvals:
  Gabe Black: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass




diff --git a/src/sim/init.cc b/src/sim/init.cc
index 9d94618..c8a545f 100644
--- a/src/sim/init.cc
+++ b/src/sim/init.cc
@@ -191,41 +191,4 @@
 EmbeddedPyBind::initAll(_m5);
 }

-/*
- * Start up the M5 simulator.  This mostly vectors into the python
- * main function.
- */
-int
-gem5Main(int argc, char **argv)
-{
-// Embedded python doesn't set up sys.argv, so we'll do that ourselves.
-py::list py_argv;
-auto sys = py::module::import("sys");
-if (py::hasattr(sys, "argv")) {
-// sys.argv already exists, so grab that.
-py_argv = sys.attr("argv");
-} else {
-// sys.argv doesn't exist, so create it.
-sys.add_object("argv", py_argv);
-}
-// Clear out argv just in case it has something in it.
-py_argv.attr("clear")();
-
-// Fill it with our argvs.
-for (int i = 0; i < argc; i++)
-py_argv.append(argv[i]);
-
-try {
-py::module_::import("m5").attr("main")();
-} catch (py::error_already_set ) {
-if (e.matches(PyExc_SystemExit))
-return e.value().attr("code").cast();
-
-std::cerr << e.what();
-return 1;
-}
-
-return 0;
-}
-
 } // namespace gem5
diff --git a/src/sim/init.hh b/src/sim/init.hh
index b4c248d..95c597b 100644
--- a/src/sim/init.hh
+++ b/src/sim/init.hh
@@ -98,8 +98,6 @@
 static std::map ();
 };

-int gem5Main(int argc, char **argv);
-
 } // namespace gem5

 #endif // __SIM_INIT_HH__
diff --git a/src/sim/main.cc b/src/sim/main.cc
index c89e67f..0d9bcb7 100644
--- a/src/sim/main.cc
+++ b/src/sim/main.cc
@@ -28,6 +28,8 @@

 #include 

+#include 
+
 #include "pybind11/embed.h"
 #include "pybind11/pybind11.h"

@@ -41,7 +43,7 @@
 // main() is now pretty stripped down and just sets up python and then
 // calls EmbeddedPython::initAll which loads the various embedded python
 // modules into the python environment and then starts things running by
-// calling gem5Main.
+// running python's m5.main().
 int
 main(int argc, char **argv)
 {
@@ -63,5 +65,32 @@
 auto importer = py::module_::import("importer");
 importer.attr("install")();

-return gem5Main(argc, argv);
+// Embedded python doesn't set up sys.argv, so we'll do that ourselves.
+py::list py_argv;
+auto sys = py::module::import("sys");
+if (py::hasattr(sys, "argv")) {
+// sys.argv already exists, so grab that.
+py_argv = sys.attr("argv");
+} else {
+// sys.argv doesn't exist, so create it.
+sys.add_object("argv", py_argv);
+}
+// Clear out argv just in case it has something in it.
+py_argv.attr("clear")();
+
+// Fill it with our argvs.
+for (int i = 0; i < argc; i++)
+py_argv.append(argv[i]);
+
+try {
+py::module_::import("m5").attr("main")();
+} catch (py::error_already_set ) {
+if (e.matches(PyExc_SystemExit))
+return e.value().attr("code").cast();
+
+std::cerr << e.what();
+return 1;
+}
+
+return 0;
 }

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/49417
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: I17e303e3a29d5473f0f31cd51d7fb367f6c81f9e
Gerrit-Change-Number: 49417
Gerrit-PatchSet: 33
Gerrit-Owner: Gabe Black 
Gerrit-Reviewer: Andreas Sandberg 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: kokoro 
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

[gem5-dev] Change in gem5/gem5[develop]: sim: Eliminate m5MainCommands and simplify calling m5.main.

2021-12-08 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/49412 )


 (

30 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the  
submitted one.
 )Change subject: sim: Eliminate m5MainCommands and simplify calling  
m5.main.

..

sim: Eliminate m5MainCommands and simplify calling m5.main.

m5MainCommands had been a way to override the python code which would
get the python side of gem5 started, used by some "unit" tests which
were really tests of all of gem5 but focus on a particular area. Those
tests have either been converted into real unit tests or eliminated,
and so that mechanism is no longer needed.

This change eliminates that mechanism, and also uses pybind11 to
significantly simplify the code that calls m5.main().

Change-Id: I553ae17074cd5389708f1b7313630a13a6946d76
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49412
Reviewed-by: Gabe Black 
Maintainer: Gabe Black 
Tested-by: kokoro 
---
M src/sim/init.cc
1 file changed, 29 insertions(+), 30 deletions(-)

Approvals:
  Gabe Black: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass




diff --git a/src/sim/init.cc b/src/sim/init.cc
index ce72b04..abbb8c2 100644
--- a/src/sim/init.cc
+++ b/src/sim/init.cc
@@ -225,16 +225,6 @@
 }

 /*
- * Make the commands array weak so that they can be overridden (used
- * by unit tests to specify a different python main function.
- */
-GEM5_WEAK const char *m5MainCommands[] = {
-"import m5",
-"m5.main()",
-0 // sentinel is required
-};
-
-/*
  * Start up the M5 simulator.  This mostly vectors into the python
  * main function.
  */
@@ -263,27 +253,14 @@

 PySys_SetArgv(argc, argv);

-// We have to set things up in the special __main__ module
-PyObject *module = PyImport_AddModule(PyCC("__main__"));
-if (module == NULL)
-panic("Could not import __main__");
-PyObject *dict = PyModule_GetDict(module);
+try {
+py::module_::import("m5").attr("main")();
+} catch (py::error_already_set ) {
+if (e.matches(PyExc_SystemExit))
+return e.value().attr("code").cast();

-// import the main m5 module
-PyObject *result;
-const char **command = m5MainCommands;
-
-// evaluate each command in the m5MainCommands array (basically a
-// bunch of python statements.
-while (*command) {
-result = PyRun_String(*command, Py_file_input, dict, dict);
-if (!result) {
-PyErr_Print();
-return 1;
-}
-Py_DECREF(result);
-
-command++;
+std::cerr << e.what();
+return 1;
 }

 #if HAVE_PROTOBUF

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/49412
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: I553ae17074cd5389708f1b7313630a13a6946d76
Gerrit-Change-Number: 49412
Gerrit-PatchSet: 33
Gerrit-Owner: Gabe Black 
Gerrit-Reviewer: Andreas Sandberg 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: kokoro 
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

[gem5-dev] Change in gem5/gem5[develop]: python: Insert gem5's m5 importer at the front of sys.meta_path.

2021-12-08 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/49415 )


 (

30 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the  
submitted one.
 )Change subject: python: Insert gem5's m5 importer at the front of  
sys.meta_path.

..

python: Insert gem5's m5 importer at the front of sys.meta_path.

This is equivalent to putting a path first in $PATH, ie it will make
sure that m5.foo resolves to gem5's internal m5 package, and not
whatever directory named m5 happens to be nearby.

Change-Id: I762d47da8ed8e4cfdf03e412d7dd7cc91a691b58
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49415
Reviewed-by: Gabe Black 
Maintainer: Gabe Black 
Tested-by: kokoro 
---
M src/python/importer.py
1 file changed, 18 insertions(+), 1 deletion(-)

Approvals:
  Gabe Black: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass




diff --git a/src/python/importer.py b/src/python/importer.py
index baeae21..94edb91 100644
--- a/src/python/importer.py
+++ b/src/python/importer.py
@@ -77,4 +77,4 @@
 import sys
 importer = CodeImporter()
 add_module = importer.add_module
-sys.meta_path.append(importer)
+sys.meta_path.insert(0, importer)

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/49415
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: I762d47da8ed8e4cfdf03e412d7dd7cc91a691b58
Gerrit-Change-Number: 49415
Gerrit-PatchSet: 33
Gerrit-Owner: Gabe Black 
Gerrit-Reviewer: Andreas Sandberg 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: kokoro 
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

[gem5-dev] Change in gem5/gem5[develop]: python,scons: Add a dummy m5/objects/SimObject.py.

2021-12-08 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/49408 )


 (

17 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the  
submitted one.

 )Change subject: python,scons: Add a dummy m5/objects/SimObject.py.
..

python,scons: Add a dummy m5/objects/SimObject.py.

This serves two purposes. First, it's a way to declare the base
SimObject class and params using the SimObject() SCons mechanism, while
the actual class still lives at m5/SimObject.py.

Second, it alleviates a very old inconsistency where *most* SimObjects
are imported using the m5.objects.Foo path, except SimObject itself
which lives under m5.SimObject. With this change, it will live under
both, more or less.

It may be possible to remove the inconsistency entirely in the future
and move m5.SimObject entirely to m5.objects.SimObject and only declare
it with SCons's SimObject(), but that won't quite work during this
transitional period, and it wouldn't give users a chance to move over to
the new name.

Change-Id: Ic714bacfaef73d1116ab7ff716cf19b7ce4b67e1
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49408
Reviewed-by: Jason Lowe-Power 
Maintainer: Jason Lowe-Power 
Tested-by: kokoro 
---
M src/python/SConscript
A src/python/m5/objects/SimObject.py
2 files changed, 60 insertions(+), 0 deletions(-)

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




diff --git a/src/python/SConscript b/src/python/SConscript
index dd02dd3..9f1cddb 100644
--- a/src/python/SConscript
+++ b/src/python/SConscript
@@ -258,3 +258,6 @@
 Source('pybind11/event.cc', add_tags='python')
 Source('pybind11/object_file.cc', add_tags='python')
 Source('pybind11/stats.cc', add_tags='python')
+
+SimObject('m5/objects/SimObject.py', sim_objects=['SimObject'],
+enums=['ByteOrder'])
diff --git a/src/python/m5/objects/SimObject.py  
b/src/python/m5/objects/SimObject.py

new file mode 100644
index 000..efec5eb
--- /dev/null
+++ b/src/python/m5/objects/SimObject.py
@@ -0,0 +1,29 @@
+# Copyright 2020 Google, Inc.
+#
+# 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 m5.SimObject import *
+# The ByteOrder enum is defined in params. Expose it here so we can  
declare it

+# to SCons, since there's no normal SimObject file to make it a part of.
+from m5.params import ByteOrder

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/49408
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: Ic714bacfaef73d1116ab7ff716cf19b7ce4b67e1
Gerrit-Change-Number: 49408
Gerrit-PatchSet: 32
Gerrit-Owner: Gabe Black 
Gerrit-Reviewer: Andreas Sandberg 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: kokoro 
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

[gem5-dev] Change in gem5/gem5[develop]: sim: Clean up and simplify main().

2021-12-08 Thread Gabe Black (Gerrit) via gem5-dev
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/49414 )


 (

30 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the  
submitted one.

 )Change subject: sim: Clean up and simplify main().
..

sim: Clean up and simplify main().

Use pybind11 to simplify the python parts, update some inaccurate
comments, rename m5Main to gem5Main, remove code which supported python
versions less than 3.

Change-Id: I139af7d3d1052cfbce779a87e34d7ce997876a60
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49414
Reviewed-by: Gabe Black 
Maintainer: Gabe Black 
Tested-by: kokoro 
---
M src/python/importer.py
M src/python/importer.cc
M src/sim/main.cc
M src/sim/init.cc
M src/sim/init.hh
5 files changed, 50 insertions(+), 30 deletions(-)

Approvals:
  Gabe Black: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass




diff --git a/src/python/importer.cc b/src/python/importer.cc
index c7beb62..7d1f7dc 100644
--- a/src/python/importer.cc
+++ b/src/python/importer.cc
@@ -29,10 +29,13 @@
 #include "pybind11/pybind11.h"
 #include "python/m5ImporterCode.hh"

+#include "sim/init.hh"
+
 namespace py = pybind11;

 PYBIND11_EMBEDDED_MODULE(importer, m)
 {
+m.def("_init_all_embedded", gem5::EmbeddedPython::initAll);
 py::str importer_code(
 reinterpret_cast(gem5::Blobs::m5ImporterCode),
 gem5::Blobs::m5ImporterCode_len);
diff --git a/src/python/importer.py b/src/python/importer.py
index 94edb91..f75f95b 100644
--- a/src/python/importer.py
+++ b/src/python/importer.py
@@ -74,7 +74,12 @@
 # Create an importer and add it to the meta_path so future imports can
 # use it.  There's currently nothing in the importer, but calls to
 # add_module can be used to add code.
-import sys
-importer = CodeImporter()
-add_module = importer.add_module
-sys.meta_path.insert(0, importer)
+def install():
+importer = CodeImporter()
+global add_module
+add_module = importer.add_module
+import sys
+sys.meta_path.insert(0, importer)
+
+# Injected into this module's namespace by the c++ code that loads it.
+_init_all_embedded()
diff --git a/src/sim/init.cc b/src/sim/init.cc
index 5067604..d612b0b 100644
--- a/src/sim/init.cc
+++ b/src/sim/init.cc
@@ -202,7 +202,7 @@
  * main function.
  */
 int
-m5Main(int argc, char **argv)
+gem5Main(int argc, char **argv)
 {
 #if HAVE_PROTOBUF
 // Verify that the version of the protobuf library that we linked
diff --git a/src/sim/init.hh b/src/sim/init.hh
index 6613a20..b4c248d 100644
--- a/src/sim/init.hh
+++ b/src/sim/init.hh
@@ -98,7 +98,7 @@
 static std::map ();
 };

-int m5Main(int argc, char **argv);
+int gem5Main(int argc, char **argv);

 } // namespace gem5

diff --git a/src/sim/main.cc b/src/sim/main.cc
index 5e31933..c89e67f 100644
--- a/src/sim/main.cc
+++ b/src/sim/main.cc
@@ -28,45 +28,40 @@

 #include 

+#include "pybind11/embed.h"
+#include "pybind11/pybind11.h"
+
 #include "sim/init.hh"
 #include "sim/init_signals.hh"

 using namespace gem5;

+namespace py = pybind11;
+
 // main() is now pretty stripped down and just sets up python and then
-// calls initM5Python which loads the various embedded python modules
-// into the python environment and then starts things running by
-// calling m5Main.
+// calls EmbeddedPython::initAll which loads the various embedded python
+// modules into the python environment and then starts things running by
+// calling gem5Main.
 int
 main(int argc, char **argv)
 {
-int ret;
-
-// Initialize m5 special signal handling.
+// Initialize gem5 special signal handling.
 initSignals();

-#if PY_MAJOR_VERSION >= 3
+// Convert argv[0] to a wchar_t string, using python's locale and  
cleanup

+// functions.
 std::unique_ptr program(
-Py_DecodeLocale(argv[0], NULL),
+Py_DecodeLocale(argv[0], nullptr),
 _RawFree);
+
+// This can help python find libraries at run time relative to this  
binary.
+// It's probably not necessary, but is mostly harmless and might be  
useful.

 Py_SetProgramName(program.get());
-#else
-Py_SetProgramName(argv[0]);
-#endif

-// initialize embedded Python interpreter
-Py_Initialize();
+py::scoped_interpreter guard;

-// Initialize the embedded m5 python library
-ret = EmbeddedPython::initAll();
+auto importer = py::module_::import("importer");
+importer.attr("install")();

-if (ret == 0) {
-// start m5
-ret = m5Main(argc, argv);
-}
-
-// clean up Python intepreter.
-Py_Finalize();
-
-return ret;
+return gem5Main(argc, argv);
 }

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


Gerrit-Project: public/gem5
Gerrit-Branch: develop