changeset 6ce719503eae in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=6ce719503eae
description:
        ruby: Fix regressions and make Ruby configs Python packages

        This patch moves the addition of network options into the Ruby module
        to avoid the regressions all having to add it explicitly. Doing this
        exposes an issue in our current config system though, namely the fact
        that addtoPath is relative to the Python script being executed. Since
        both example and regression scripts use the Ruby module we would end
        up with two different (relative) paths being added. Instead we take a
        first step at turning the config modules into Python packages, simply
        by adding a __init__.py in the configs/ruby, configs/topologies and
        configs/network subdirectories.

        As a result, we can now add the top-level configs directory to the
        Python search path, and then use the package names in the various
        modules. The example scripts are also updated, and the messy
        path-deducing variations in the scripts are unified.

diffstat:

 configs/example/apu_se.py               |   9 ++-----
 configs/example/fs.py                   |   7 +----
 configs/example/garnet_synth_traffic.py |   8 +-----
 configs/example/ruby_direct_test.py     |   8 +-----
 configs/example/ruby_gpu_random_test.py |   8 +-----
 configs/example/ruby_mem_test.py        |   8 +-----
 configs/example/ruby_random_test.py     |   8 +-----
 configs/example/se.py                   |   8 ++----
 configs/network/__init__.py             |  36 +++++++++++++++++++++++++++++++++
 configs/ruby/AMD_Base_Constructor.py    |   2 +-
 configs/ruby/GPU_RfO.py                 |   4 +-
 configs/ruby/GPU_VIPER.py               |   4 +-
 configs/ruby/GPU_VIPER_Baseline.py      |   4 +-
 configs/ruby/GPU_VIPER_Region.py        |   2 +-
 configs/ruby/MOESI_AMD_Base.py          |   4 +-
 configs/ruby/Ruby.py                    |   8 +++---
 configs/ruby/__init__.py                |  36 +++++++++++++++++++++++++++++++++
 configs/topologies/__init__.py          |  36 +++++++++++++++++++++++++++++++++
 tests/configs/gpu-randomtest-ruby.py    |  11 ++-------
 tests/configs/gpu-ruby.py               |  10 ++------
 tests/configs/memtest-ruby.py           |  11 ++-------
 tests/configs/o3-timing-mp-ruby.py      |   1 -
 tests/configs/o3-timing-ruby.py         |   1 -
 tests/configs/pc-simple-timing-ruby.py  |   5 +--
 tests/configs/rubytest-ruby.py          |  11 ++-------
 tests/configs/simple-atomic-mp-ruby.py  |   2 -
 tests/configs/simple-timing-mp-ruby.py  |  11 ++-------
 tests/configs/simple-timing-ruby.py     |  10 ++------
 28 files changed, 160 insertions(+), 113 deletions(-)

diffs (truncated from 631 to 300 lines):

diff -r 220fa4099b9a -r 6ce719503eae configs/example/apu_se.py
--- a/configs/example/apu_se.py Fri Oct 07 23:56:48 2016 -0400
+++ b/configs/example/apu_se.py Thu Oct 13 03:17:19 2016 -0400
@@ -42,14 +42,12 @@
 from m5.objects import *
 from m5.util import addToPath
 
-addToPath('../ruby')
-addToPath('../network')
+addToPath('../')
 addToPath('../common')
-addToPath('../topologies')
+
+from ruby import Ruby
 
 import Options
-import Ruby
-import Network
 import Simulation
 import GPUTLBOptions, GPUTLBConfig
 
@@ -159,7 +157,6 @@
 
 
 Ruby.define_options(parser)
-Network.define_options(parser)
 
 #add TLB options to the parser
 GPUTLBOptions.tlb_options(parser)
diff -r 220fa4099b9a -r 6ce719503eae configs/example/fs.py
--- a/configs/example/fs.py     Fri Oct 07 23:56:48 2016 -0400
+++ b/configs/example/fs.py     Thu Oct 13 03:17:19 2016 -0400
@@ -49,12 +49,10 @@
 from m5.objects import *
 from m5.util import addToPath, fatal
 
+addToPath('../')
 addToPath('../common')
-addToPath('../ruby')
-addToPath('../network')
 
-import Ruby
-import Network
+from ruby import Ruby
 
 from FSConfig import *
 from SysPaths import *
@@ -308,7 +306,6 @@
 # Add the ruby specific and protocol specific options
 if '--ruby' in sys.argv:
     Ruby.define_options(parser)
-    Network.define_options(parser)
 
 (options, args) = parser.parse_args()
 
diff -r 220fa4099b9a -r 6ce719503eae configs/example/garnet_synth_traffic.py
--- a/configs/example/garnet_synth_traffic.py   Fri Oct 07 23:56:48 2016 -0400
+++ b/configs/example/garnet_synth_traffic.py   Thu Oct 13 03:17:19 2016 -0400
@@ -32,13 +32,10 @@
 from m5.util import addToPath
 import os, optparse, sys
 addToPath('../common')
-addToPath('../ruby')
-addToPath('../network')
-addToPath('../topologies')
+addToPath('../')
 
 import Options
-import Ruby
-import Network
+from ruby import Ruby
 
 # Get paths we might need.  It's expected this file is in m5/configs/example.
 config_path = os.path.dirname(os.path.abspath(__file__))
@@ -87,7 +84,6 @@
 # Add the ruby specific and protocol specific options
 #
 Ruby.define_options(parser)
-Network.define_options(parser)
 
 execfile(os.path.join(config_root, "common", "Options.py"))
 
diff -r 220fa4099b9a -r 6ce719503eae configs/example/ruby_direct_test.py
--- a/configs/example/ruby_direct_test.py       Fri Oct 07 23:56:48 2016 -0400
+++ b/configs/example/ruby_direct_test.py       Thu Oct 13 03:17:19 2016 -0400
@@ -34,13 +34,10 @@
 from m5.util import addToPath
 import os, optparse, sys
 addToPath('../common')
-addToPath('../ruby')
-addToPath('../network')
-addToPath('../topologies')
+addToPath('../')
 
 import Options
-import Ruby
-import Network
+from ruby import Ruby
 
 # Get paths we might need.  It's expected this file is in m5/configs/example.
 config_path = os.path.dirname(os.path.abspath(__file__))
@@ -65,7 +62,6 @@
 # Add the ruby specific and protocol specific options
 #
 Ruby.define_options(parser)
-Network.define_options(parser)
 (options, args) = parser.parse_args()
 
 if args:
diff -r 220fa4099b9a -r 6ce719503eae configs/example/ruby_gpu_random_test.py
--- a/configs/example/ruby_gpu_random_test.py   Fri Oct 07 23:56:48 2016 -0400
+++ b/configs/example/ruby_gpu_random_test.py   Thu Oct 13 03:17:19 2016 -0400
@@ -39,13 +39,10 @@
 from m5.util import addToPath
 import os, optparse, sys
 addToPath('../common')
-addToPath('../ruby')
-addToPath('../network')
-addToPath('../topologies')
+addToPath('../')
 
 import Options
-import Ruby
-import Network
+from ruby import Ruby
 
 # Get paths we might need.
 config_path = os.path.dirname(os.path.abspath(__file__))
@@ -78,7 +75,6 @@
 # Add the ruby specific and protocol specific options
 #
 Ruby.define_options(parser)
-Network.define_options(parser)
 
 execfile(os.path.join(config_root, "common", "Options.py"))
 
diff -r 220fa4099b9a -r 6ce719503eae configs/example/ruby_mem_test.py
--- a/configs/example/ruby_mem_test.py  Fri Oct 07 23:56:48 2016 -0400
+++ b/configs/example/ruby_mem_test.py  Thu Oct 13 03:17:19 2016 -0400
@@ -34,13 +34,10 @@
 from m5.util import addToPath
 import os, optparse, sys
 addToPath('../common')
-addToPath('../ruby')
-addToPath('../network')
-addToPath('../topologies')
+addToPath('../')
 
 import Options
-import Ruby
-import Network
+from ruby import Ruby
 
 # Get paths we might need.  It's expected this file is in m5/configs/example.
 config_path = os.path.dirname(os.path.abspath(__file__))
@@ -65,7 +62,6 @@
 # Add the ruby specific and protocol specific options
 #
 Ruby.define_options(parser)
-Network.define_options(parser)
 
 execfile(os.path.join(config_root, "common", "Options.py"))
 
diff -r 220fa4099b9a -r 6ce719503eae configs/example/ruby_random_test.py
--- a/configs/example/ruby_random_test.py       Fri Oct 07 23:56:48 2016 -0400
+++ b/configs/example/ruby_random_test.py       Thu Oct 13 03:17:19 2016 -0400
@@ -34,13 +34,10 @@
 from m5.util import addToPath
 import os, optparse, sys
 addToPath('../common')
-addToPath('../ruby')
-addToPath('../network')
-addToPath('../topologies')
+addToPath('../')
 
 import Options
-import Ruby
-import Network
+from ruby import Ruby
 
 # Get paths we might need.  It's expected this file is in m5/configs/example.
 config_path = os.path.dirname(os.path.abspath(__file__))
@@ -59,7 +56,6 @@
 # Add the ruby specific and protocol specific options
 #
 Ruby.define_options(parser)
-Network.define_options(parser)
 
 execfile(os.path.join(config_root, "common", "Options.py"))
 
diff -r 220fa4099b9a -r 6ce719503eae configs/example/se.py
--- a/configs/example/se.py     Fri Oct 07 23:56:48 2016 -0400
+++ b/configs/example/se.py     Thu Oct 13 03:17:19 2016 -0400
@@ -51,13 +51,12 @@
 from m5.objects import *
 from m5.util import addToPath, fatal
 
+addToPath('../')
 addToPath('../common')
-addToPath('../ruby')
-addToPath('../network')
+
+from ruby import Ruby
 
 import Options
-import Ruby
-import Network
 import Simulation
 import CacheConfig
 import CpuConfig
@@ -129,7 +128,6 @@
 
 if '--ruby' in sys.argv:
     Ruby.define_options(parser)
-    Network.define_options(parser)
 
 (options, args) = parser.parse_args()
 
diff -r 220fa4099b9a -r 6ce719503eae configs/network/__init__.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/configs/network/__init__.py       Thu Oct 13 03:17:19 2016 -0400
@@ -0,0 +1,36 @@
+# Copyright (c) 2016 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.
+#
+# 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.
+#
+# Authors: Andreas Hansson
diff -r 220fa4099b9a -r 6ce719503eae configs/ruby/AMD_Base_Constructor.py
--- a/configs/ruby/AMD_Base_Constructor.py      Fri Oct 07 23:56:48 2016 -0400
+++ b/configs/ruby/AMD_Base_Constructor.py      Thu Oct 13 03:17:19 2016 -0400
@@ -39,7 +39,7 @@
 from m5.defines import buildEnv
 from m5.util import convert
 from CntrlBase import *
-from Cluster import Cluster
+from topologies.Cluster import Cluster
 
 #
 # Note: the L1 Cache latency is only used by the sequencer on fast path hits
diff -r 220fa4099b9a -r 6ce719503eae configs/ruby/GPU_RfO.py
--- a/configs/ruby/GPU_RfO.py   Fri Oct 07 23:56:48 2016 -0400
+++ b/configs/ruby/GPU_RfO.py   Thu Oct 13 03:17:19 2016 -0400
@@ -40,8 +40,8 @@
 from Ruby import create_topology
 from Ruby import send_evicts
 
-from Cluster import Cluster
-from Crossbar import Crossbar
+from topologies.Cluster import Cluster
+from topologies.Crossbar import Crossbar
 
 class CntrlBase:
     _seqs = 0
diff -r 220fa4099b9a -r 6ce719503eae configs/ruby/GPU_VIPER.py
--- a/configs/ruby/GPU_VIPER.py Fri Oct 07 23:56:48 2016 -0400
+++ b/configs/ruby/GPU_VIPER.py Thu Oct 13 03:17:19 2016 -0400
@@ -40,8 +40,8 @@
 from Ruby import create_topology
 from Ruby import send_evicts
 
-from Cluster import Cluster
-from Crossbar import Crossbar
+from topologies.Cluster import Cluster
+from topologies.Crossbar import Crossbar
 
 class CntrlBase:
     _seqs = 0
diff -r 220fa4099b9a -r 6ce719503eae configs/ruby/GPU_VIPER_Baseline.py
--- a/configs/ruby/GPU_VIPER_Baseline.py        Fri Oct 07 23:56:48 2016 -0400
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to