changeset 10d59d546ea2 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=10d59d546ea2
description:
        ruby: garnet2.0
        Revamped version of garnet with more optimized single-cycle routers,
        more configurability, and cleaner code.

diffstat:

 configs/network/Network.py                         |   55 +-
 configs/topologies/Crossbar.py                     |   15 +-
 configs/topologies/MeshDirCorners_XY.py            |   41 +-
 configs/topologies/Mesh_XY.py                      |   21 +-
 configs/topologies/Mesh_westfirst.py               |   20 +-
 configs/topologies/Pt2Pt.py                        |   20 +-
 src/base/statistics.cc                             |    4 +-
 src/mem/ruby/network/BasicRouter.py                |    2 +
 src/mem/ruby/network/garnet2.0/CommonTypes.hh      |   65 ++
 src/mem/ruby/network/garnet2.0/Credit.cc           |   46 ++
 src/mem/ruby/network/garnet2.0/Credit.hh           |   60 ++
 src/mem/ruby/network/garnet2.0/CreditLink.hh       |   47 ++
 src/mem/ruby/network/garnet2.0/CrossbarSwitch.cc   |  112 +++++
 src/mem/ruby/network/garnet2.0/CrossbarSwitch.hh   |   72 +++
 src/mem/ruby/network/garnet2.0/GarnetLink.cc       |   94 ++++
 src/mem/ruby/network/garnet2.0/GarnetLink.hh       |   97 ++++
 src/mem/ruby/network/garnet2.0/GarnetLink.py       |   79 +++
 src/mem/ruby/network/garnet2.0/GarnetNetwork.cc    |  460 +++++++++++++++++++++
 src/mem/ruby/network/garnet2.0/GarnetNetwork.hh    |  208 +++++++++
 src/mem/ruby/network/garnet2.0/GarnetNetwork.py    |   68 +++
 src/mem/ruby/network/garnet2.0/InputUnit.cc        |  171 +++++++
 src/mem/ruby/network/garnet2.0/InputUnit.hh        |  170 +++++++
 src/mem/ruby/network/garnet2.0/NetworkInterface.cc |  443 ++++++++++++++++++++
 src/mem/ruby/network/garnet2.0/NetworkInterface.hh |  108 ++++
 src/mem/ruby/network/garnet2.0/NetworkLink.cc      |   94 ++++
 src/mem/ruby/network/garnet2.0/NetworkLink.hh      |   88 ++++
 src/mem/ruby/network/garnet2.0/OutVcState.cc       |   65 ++
 src/mem/ruby/network/garnet2.0/OutVcState.hh       |   70 +++
 src/mem/ruby/network/garnet2.0/OutputUnit.cc       |  168 +++++++
 src/mem/ruby/network/garnet2.0/OutputUnit.hh       |  113 +++++
 src/mem/ruby/network/garnet2.0/README.txt          |   71 +++
 src/mem/ruby/network/garnet2.0/Router.cc           |  296 +++++++++++++
 src/mem/ruby/network/garnet2.0/Router.hh           |  140 ++++++
 src/mem/ruby/network/garnet2.0/RoutingUnit.cc      |  241 +++++++++++
 src/mem/ruby/network/garnet2.0/RoutingUnit.hh      |   89 ++++
 src/mem/ruby/network/garnet2.0/SConscript          |   53 ++
 src/mem/ruby/network/garnet2.0/SwitchAllocator.cc  |  389 +++++++++++++++++
 src/mem/ruby/network/garnet2.0/SwitchAllocator.hh  |   88 ++++
 src/mem/ruby/network/garnet2.0/VirtualChannel.cc   |   85 +++
 src/mem/ruby/network/garnet2.0/VirtualChannel.hh   |  101 ++++
 src/mem/ruby/network/garnet2.0/flit.cc             |   85 +++
 src/mem/ruby/network/garnet2.0/flit.hh             |  122 +++++
 src/mem/ruby/network/garnet2.0/flitBuffer.cc       |   93 ++++
 src/mem/ruby/network/garnet2.0/flitBuffer.hh       |   93 ++++
 44 files changed, 4982 insertions(+), 40 deletions(-)

diffs (truncated from 5453 to 300 lines):

diff -r db895719c482 -r 10d59d546ea2 configs/network/Network.py
--- a/configs/network/Network.py        Thu Oct 06 14:35:21 2016 -0400
+++ b/configs/network/Network.py        Thu Oct 06 14:35:22 2016 -0400
@@ -38,25 +38,44 @@
 
     parser.add_option("--topology", type="string", default="Crossbar",
                       help="check configs/topologies for complete set")
-    parser.add_option("--mesh-rows", type="int", default=1,
+    parser.add_option("--mesh-rows", type="int", default=0,
                       help="the number of rows in the mesh topology")
-    parser.add_option("--garnet-network", type="choice",
-                      choices=['fixed', 'flexible'], help="'fixed'|'flexible'")
-    parser.add_option("--network-fault-model", action="store_true", 
default=False,
-                      help="enable network fault model: see 
src/mem/ruby/network/fault_model/")
+    parser.add_option("--network", type="choice", default="simple",
+                      choices=['simple', 'garnet2.0'],
+                      help="'simple'|'garnet2.0'")
+    parser.add_option("--router-latency", action="store", type="int",
+                      default=1,
+                      help="""number of pipeline stages in the garnet router.
+                            Has to be >= 1.
+                            Can be over-ridden on a per router basis
+                            in the topology file.""")
+    parser.add_option("--link-latency", action="store", type="int", default=1,
+                      help="""latency of each link the simple/garnet networks.
+                            Has to be >= 1.
+                            Can be over-ridden on a per link basis
+                            in the topology file.""")
+    parser.add_option("--link-width-bits", action="store", type="int",
+                      default=128,
+                      help="width in bits for all links inside garnet.")
+    parser.add_option("--vcs-per-vnet", action="store", type="int", default=4,
+                      help="""number of virtual channels per virtual network
+                            inside garnet network.""")
+    parser.add_option("--routing-algorithm", action="store", type="int",
+                      default=0,
+                      help="""routing algorithm in network.
+                            0: weight-based table
+                            1: XY (for Mesh. see garnet2.0/RoutingUnit.cc)
+                            2: Custom (see garnet2.0/RoutingUnit.cc""")
+    parser.add_option("--network-fault-model", action="store_true",
+                      default=False,
+                      help="""enable network fault model:
+                            see src/mem/ruby/network/fault_model/""")
 
 
 def create_network(options, ruby):
 
     # Set the network classes based on the command line options
-    if options.garnet_network == "fixed":
-        NetworkClass = GarnetNetwork_d
-        IntLinkClass = GarnetIntLink_d
-        ExtLinkClass = GarnetExtLink_d
-        RouterClass = GarnetRouter_d
-        InterfaceClass = GarnetNetworkInterface_d
-
-    elif options.garnet_network == "flexible":
+    if options.network == "garnet2.0":
         NetworkClass = GarnetNetwork
         IntLinkClass = GarnetIntLink
         ExtLinkClass = GarnetExtLink
@@ -79,7 +98,13 @@
 
 def init_network(options, network, InterfaceClass):
 
-    if options.garnet_network is None:
+    if options.network == "garnet2.0":
+        network.num_rows = options.mesh_rows
+        network.vcs_per_vnet = options.vcs_per_vnet
+        network.ni_flit_size = options.link_width_bits / 8
+        network.routing_algorithm = options.routing_algorithm
+
+    if options.network == "simple":
         network.setup_buffers()
 
     if InterfaceClass != None:
@@ -88,6 +113,6 @@
         network.netifs = netifs
 
     if options.network_fault_model:
-        assert(options.garnet_network == "fixed")
+        assert(options.network == "garnet2.0")
         network.enable_fault_model = True
         network.fault_model = FaultModel()
diff -r db895719c482 -r 10d59d546ea2 configs/topologies/Crossbar.py
--- a/configs/topologies/Crossbar.py    Thu Oct 06 14:35:21 2016 -0400
+++ b/configs/topologies/Crossbar.py    Thu Oct 06 14:35:22 2016 -0400
@@ -35,6 +35,12 @@
     description='Crossbar'
 
     def makeTopology(self, options, network, IntLink, ExtLink, Router):
+
+        # default values for link latency and router latency.
+        # Can be over-ridden on a per link/router basis
+        link_latency = options.link_latency # used by simple and garnet
+        router_latency = options.router_latency # only used by garnet
+
         # Create an individual router for each controller plus one more for
         # the centralized crossbar.  The large numbers of routers are needed
         # because external links do not model outgoing bandwidth in the
@@ -45,7 +51,8 @@
         xbar = routers[len(self.nodes)] # the crossbar router is the last 
router created
         network.routers = routers
 
-        ext_links = [ExtLink(link_id=i, ext_node=n, int_node=routers[i])
+        ext_links = [ExtLink(link_id=i, ext_node=n, int_node=routers[i],
+                             latency = link_latency)
                         for (i, n) in enumerate(self.nodes)]
         network.ext_links = ext_links
 
@@ -55,13 +62,15 @@
         for i in range(len(self.nodes)):
             int_links.append(IntLink(link_id=(link_count+i),
                                      src_node=routers[i],
-                                     dst_node=xbar))
+                                     dst_node=xbar,
+                                     latency = link_latency))
 
         link_count += len(self.nodes)
 
         for i in range(len(self.nodes)):
             int_links.append(IntLink(link_id=(link_count+i),
                                      src_node=xbar,
-                                     dst_node=routers[i]))
+                                     dst_node=routers[i],
+                                     latency = link_latency))
 
         network.int_links = int_links
diff -r db895719c482 -r 10d59d546ea2 configs/topologies/MeshDirCorners_XY.py
--- a/configs/topologies/MeshDirCorners_XY.py   Thu Oct 06 14:35:21 2016 -0400
+++ b/configs/topologies/MeshDirCorners_XY.py   Thu Oct 06 14:35:22 2016 -0400
@@ -47,6 +47,12 @@
         num_routers = options.num_cpus
         num_rows = options.mesh_rows
 
+        # default values for link latency and router latency.
+        # Can be over-ridden on a per link/router basis
+        link_latency = options.link_latency # used by simple and garnet
+        router_latency = options.router_latency # only used by garnet
+
+
         # First determine which nodes are cache cntrls vs. dirs vs. dma
         cache_nodes = []
         dir_nodes = []
@@ -64,7 +70,7 @@
         # and evenly divisible.  Also the number of caches must be a
         # multiple of the number of routers and the number of directories
         # must be four.
-        assert(num_rows <= num_routers)
+        assert(num_rows > 0 and num_rows <= num_routers)
         num_columns = int(num_routers / num_rows)
         assert(num_columns * num_rows == num_routers)
         caches_per_router, remainder = divmod(len(cache_nodes), num_routers)
@@ -72,7 +78,8 @@
         assert(len(dir_nodes) == 4)
 
         # Create the routers in the mesh
-        routers = [Router(router_id=i) for i in range(num_routers)]
+        routers = [Router(router_id=i, latency = router_latency) \
+            for i in range(num_routers)]
         network.routers = routers
 
         # link counter to set unique link ids
@@ -84,28 +91,34 @@
             cntrl_level, router_id = divmod(i, num_routers)
             assert(cntrl_level < caches_per_router)
             ext_links.append(ExtLink(link_id=link_count, ext_node=n,
-                                    int_node=routers[router_id]))
+                                    int_node=routers[router_id],
+                                    latency = link_latency))
             link_count += 1
 
         # Connect the dir nodes to the corners.
         ext_links.append(ExtLink(link_id=link_count, ext_node=dir_nodes[0],
-                                int_node=routers[0]))
+                                int_node=routers[0],
+                                latency = link_latency))
         link_count += 1
         ext_links.append(ExtLink(link_id=link_count, ext_node=dir_nodes[1],
-                                int_node=routers[num_columns - 1]))
+                                int_node=routers[num_columns - 1],
+                                latency = link_latency))
         link_count += 1
         ext_links.append(ExtLink(link_id=link_count, ext_node=dir_nodes[2],
-                                int_node=routers[num_routers - num_columns]))
+                                int_node=routers[num_routers - num_columns],
+                                latency = link_latency))
         link_count += 1
         ext_links.append(ExtLink(link_id=link_count, ext_node=dir_nodes[3],
-                                int_node=routers[num_routers - 1]))
+                                int_node=routers[num_routers - 1],
+                                latency = link_latency))
         link_count += 1
 
         # Connect the dma nodes to router 0.  These should only be DMA nodes.
         for (i, node) in enumerate(dma_nodes):
             assert(node.type == 'DMA_Controller')
             ext_links.append(ExtLink(link_id=link_count, ext_node=node,
-                                     int_node=routers[0]))
+                                     int_node=routers[0],
+                                     latency = link_latency))
 
         network.ext_links = ext_links
 
@@ -121,6 +134,9 @@
                     int_links.append(IntLink(link_id=link_count,
                                              src_node=routers[east_out],
                                              dst_node=routers[west_in],
+                                             src_outport="East",
+                                             dst_inport="West",
+                                             latency = link_latency,
                                              weight=1))
                     link_count += 1
 
@@ -133,6 +149,9 @@
                     int_links.append(IntLink(link_id=link_count,
                                              src_node=routers[west_out],
                                              dst_node=routers[east_in],
+                                             src_outport="West",
+                                             dst_inport="East",
+                                             latency = link_latency,
                                              weight=1))
                     link_count += 1
 
@@ -145,6 +164,9 @@
                     int_links.append(IntLink(link_id=link_count,
                                              src_node=routers[north_out],
                                              dst_node=routers[south_in],
+                                             src_outport="North",
+                                             dst_inport="South",
+                                             latency = link_latency,
                                              weight=2))
                     link_count += 1
 
@@ -157,6 +179,9 @@
                     int_links.append(IntLink(link_id=link_count,
                                              src_node=routers[south_out],
                                              dst_node=routers[north_in],
+                                             src_outport="South",
+                                             dst_inport="North",
+                                             latency = link_latency,
                                              weight=2))
                     link_count += 1
 
diff -r db895719c482 -r 10d59d546ea2 configs/topologies/Mesh_XY.py
--- a/configs/topologies/Mesh_XY.py     Thu Oct 06 14:35:21 2016 -0400
+++ b/configs/topologies/Mesh_XY.py     Thu Oct 06 14:35:22 2016 -0400
@@ -53,15 +53,22 @@
         num_routers = options.num_cpus
         num_rows = options.mesh_rows
 
+        # default values for link latency and router latency.
+        # Can be over-ridden on a per link/router basis
+        link_latency = options.link_latency # used by simple and garnet
+        router_latency = options.router_latency # only used by garnet
+
+
         # There must be an evenly divisible number of cntrls to routers
         # Also, obviously the number or rows must be <= the number of routers
         cntrls_per_router, remainder = divmod(len(nodes), num_routers)
-        assert(num_rows <= num_routers)
+        assert(num_rows > 0 and num_rows <= num_routers)
         num_columns = int(num_routers / num_rows)
         assert(num_columns * num_rows == num_routers)
 
         # Create the routers in the mesh
-        routers = [Router(router_id=i) for i in range(num_routers)]
+        routers = [Router(router_id=i, latency = router_latency) \
+            for i in range(num_routers)]
         network.routers = routers
 
         # link counter to set unique link ids
@@ -83,7 +90,8 @@
             cntrl_level, router_id = divmod(i, num_routers)
             assert(cntrl_level < cntrls_per_router)
             ext_links.append(ExtLink(link_id=link_count, ext_node=n,
-                                    int_node=routers[router_id]))
+                                    int_node=routers[router_id],
+                                    latency = link_latency))
             link_count += 1
 
         # Connect the remainding nodes to router 0.  These should only be
@@ -92,7 +100,8 @@
             assert(node.type == 'DMA_Controller')
             assert(i < remainder)
             ext_links.append(ExtLink(link_id=link_count, ext_node=node,
-                                    int_node=routers[0]))
+                                    int_node=routers[0],
+                                    latency = link_latency))
             link_count += 1
 
         network.ext_links = ext_links
@@ -111,6 +120,7 @@
                                              dst_node=routers[west_in],
                                              src_outport="East",
                                              dst_inport="West",
+                                             latency = link_latency,
                                              weight=1))
                     link_count += 1
 
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to