summaryrefslogtreecommitdiff
path: root/configs/topologies
diff options
context:
space:
mode:
authorTushar Krishna <tushar@ece.gatech.edu>2016-10-06 14:35:18 -0400
committerTushar Krishna <tushar@ece.gatech.edu>2016-10-06 14:35:18 -0400
commit003c08fa90f8b3eb7fbbbc96e0caa5f46bf58196 (patch)
tree13b408554ffbebd11ae2322e8a070a0c4d5b9c56 /configs/topologies
parentb9e23a6d741cdcdf0ffb7364c6aae36a487335ef (diff)
downloadgem5-003c08fa90f8b3eb7fbbbc96e0caa5f46bf58196.tar.xz
config: make internal links in network topology unidirectional.
This patch makes the internal links within the network topology unidirectional, thus allowing any deadlock-free routing algorithms to be specified from the topology itself using weights. This patch also renames Mesh.py and MeshDirCorners.py to Mesh_XY.py and MeshDirCorners_XY.py (Mesh with XY routing). It also adds a Mesh_westfirst.py and CrossbarGarnet.py topologies.
Diffstat (limited to 'configs/topologies')
-rw-r--r--configs/topologies/Cluster.py23
-rw-r--r--configs/topologies/Crossbar.py18
-rw-r--r--configs/topologies/CrossbarGarnet.py50
-rw-r--r--configs/topologies/MeshDirCorners_XY.py (renamed from configs/topologies/MeshDirCorners.py)64
-rw-r--r--configs/topologies/Mesh_XY.py (renamed from configs/topologies/Mesh.py)65
-rw-r--r--configs/topologies/Mesh_westfirst.py (renamed from configs/topologies/Torus.py)93
-rw-r--r--configs/topologies/Pt2Pt.py4
7 files changed, 238 insertions, 79 deletions
diff --git a/configs/topologies/Cluster.py b/configs/topologies/Cluster.py
index b146d8675..fad90856d 100644
--- a/configs/topologies/Cluster.py
+++ b/configs/topologies/Cluster.py
@@ -86,23 +86,30 @@ class Cluster(BaseTopology):
node.makeTopology(options, network, IntLink, ExtLink, Router)
# connect this cluster to the router
- link = IntLink(link_id=self.num_int_links(), node_a=self.router,
- node_b=node.router)
+ link_out = IntLink(link_id=self.num_int_links(), src_node=self.router,
+ dst_node_=node.router)
+ link_in = IntLink(link_id=self.num_int_links(), src_node=node.router,
+ dst_node_=self.router)
if node.extBW:
- link.bandwidth_factor = node.extBW
+ link_out.bandwidth_factor = node.extBW
+ link_in.bandwidth_factor = node.extBW
- # if there is an interanl b/w for this node
+ # if there is an internal b/w for this node
# and no ext b/w to override
elif self.intBW:
- link.bandwidth_factor = self.intBW
+ link_out.bandwidth_factor = self.intBW
+ link_in.bandwidth_factor = self.intBW
if node.extLatency:
- link.latency = node.extLatency
+ link_out.latency = node.extLatency
+ link_in.latency = node.extLatency
elif self.intLatency:
- link.latency = self.intLatency
+ link_out.latency = self.intLatency
+ link_in.latency = self.intLatency
- network.int_links.append(link)
+ network.int_links.append(link_out)
+ network.int_links.append(link_in)
else:
# node is just a controller,
# connect it to the router via a ext_link
diff --git a/configs/topologies/Crossbar.py b/configs/topologies/Crossbar.py
index e3dd431e7..35d20de34 100644
--- a/configs/topologies/Crossbar.py
+++ b/configs/topologies/Crossbar.py
@@ -39,6 +39,7 @@ class Crossbar(SimpleTopology):
# the centralized crossbar. The large numbers of routers are needed
# because external links do not model outgoing bandwidth in the
# simple network, but internal links do.
+ # For garnet, one router suffices, use CrossbarGarnet.py
routers = [Router(router_id=i) for i in range(len(self.nodes)+1)]
xbar = routers[len(self.nodes)] # the crossbar router is the last router created
@@ -49,7 +50,18 @@ class Crossbar(SimpleTopology):
network.ext_links = ext_links
link_count = len(self.nodes)
- int_links = [IntLink(link_id=(link_count+i),
- node_a=routers[i], node_b=xbar)
- for i in range(len(self.nodes))]
+
+ int_links = []
+ for i in range(len(self.nodes)):
+ int_links.append(IntLink(link_id=(link_count+i),
+ src_node=routers[i],
+ dst_node=xbar))
+
+ 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]))
+
network.int_links = int_links
diff --git a/configs/topologies/CrossbarGarnet.py b/configs/topologies/CrossbarGarnet.py
new file mode 100644
index 000000000..64f8001e2
--- /dev/null
+++ b/configs/topologies/CrossbarGarnet.py
@@ -0,0 +1,50 @@
+# Copyright (c) 2016 Georgia Institute of Technology
+# 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.
+#
+# Authors: Tushar Krishna
+
+from m5.params import *
+from m5.objects import *
+
+from BaseTopology import SimpleTopology
+
+class CrossbarGarnet(SimpleTopology):
+ description='CrossbarGarnet'
+
+ def makeTopology(self, options, network, IntLink, ExtLink, Router):
+ # Create one router in Garnet. Internally models a crossbar and
+ # the associated allocator.
+ # For simple network, use Crossbar.py
+
+ xbar = Router(router_id=0)
+ network.routers = xbar
+
+ ext_links = [ExtLink(link_id=i, ext_node=n, int_node=xbar)
+ for (i, n) in enumerate(self.nodes)]
+ network.ext_links = ext_links
+
+ int_links = []
+ network.int_links = int_links
diff --git a/configs/topologies/MeshDirCorners.py b/configs/topologies/MeshDirCorners_XY.py
index 40720004e..47eb48086 100644
--- a/configs/topologies/MeshDirCorners.py
+++ b/configs/topologies/MeshDirCorners_XY.py
@@ -31,17 +31,16 @@ from m5.objects import *
from BaseTopology import SimpleTopology
-class MeshDirCorners(SimpleTopology):
- description='MeshDirCorners'
+# Creates a Mesh topology with 4 directories, one at each corner.
+# One L1 (and L2, depending on the protocol) are connected to each router.
+# XY routing is enforced (using link weights) to guarantee deadlock freedom.
+
+class MeshDirCorners_XY(SimpleTopology):
+ description='MeshDirCorners_XY'
def __init__(self, controllers):
self.nodes = controllers
- # This file contains a special network creation function. This
- # networks is not general and will only work with specific system
- # configurations. The network specified is similar to GEMS old file
- # specified network.
-
def makeTopology(self, options, network, IntLink, ExtLink, Router):
nodes = self.nodes
@@ -110,29 +109,56 @@ class MeshDirCorners(SimpleTopology):
network.ext_links = ext_links
- # Create the mesh links. First row (east-west) links then column
- # (north-south) links
+ # Create the mesh links.
int_links = []
+
+ # East output to West input links (weight = 1)
+ for row in xrange(num_rows):
+ for col in xrange(num_columns):
+ if (col + 1 < num_columns):
+ east_out = col + (row * num_columns)
+ west_in = (col + 1) + (row * num_columns)
+ int_links.append(IntLink(link_id=link_count,
+ src_node=routers[east_out],
+ dst_node=routers[west_in],
+ weight=1))
+ link_count += 1
+
+ # West output to East input links (weight = 1)
for row in xrange(num_rows):
for col in xrange(num_columns):
if (col + 1 < num_columns):
- east_id = col + (row * num_columns)
- west_id = (col + 1) + (row * num_columns)
+ east_in = col + (row * num_columns)
+ west_out = (col + 1) + (row * num_columns)
+ int_links.append(IntLink(link_id=link_count,
+ src_node=routers[west_out],
+ dst_node=routers[east_in],
+ weight=1))
+ link_count += 1
+
+ # North output to South input links (weight = 2)
+ for col in xrange(num_columns):
+ for row in xrange(num_rows):
+ if (row + 1 < num_rows):
+ north_out = col + (row * num_columns)
+ south_in = col + ((row + 1) * num_columns)
int_links.append(IntLink(link_id=link_count,
- node_a=routers[east_id],
- node_b=routers[west_id],
- weight=1))
+ src_node=routers[north_out],
+ dst_node=routers[south_in],
+ weight=2))
link_count += 1
+ # South output to North input links (weight = 2)
for col in xrange(num_columns):
for row in xrange(num_rows):
if (row + 1 < num_rows):
- north_id = col + (row * num_columns)
- south_id = col + ((row + 1) * num_columns)
+ north_in = col + (row * num_columns)
+ south_out = col + ((row + 1) * num_columns)
int_links.append(IntLink(link_id=link_count,
- node_a=routers[north_id],
- node_b=routers[south_id],
- weight=2))
+ src_node=routers[south_out],
+ dst_node=routers[north_in],
+ weight=2))
link_count += 1
+
network.int_links = int_links
diff --git a/configs/topologies/Mesh.py b/configs/topologies/Mesh_XY.py
index 446fc4a18..adf3ebe49 100644
--- a/configs/topologies/Mesh.py
+++ b/configs/topologies/Mesh_XY.py
@@ -1,4 +1,5 @@
# Copyright (c) 2010 Advanced Micro Devices, Inc.
+# 2016 Georgia Institute of Technology
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -25,19 +26,26 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Authors: Brad Beckmann
+# Tushar Krishna
from m5.params import *
from m5.objects import *
from BaseTopology import SimpleTopology
-class Mesh(SimpleTopology):
- description='Mesh'
+# Creates a generic Mesh assuming an equal number of cache
+# and directory controllers.
+# XY routing is enforced (using link weights)
+# to guarantee deadlock freedom.
+
+class Mesh_XY(SimpleTopology):
+ description='Mesh_XY'
def __init__(self, controllers):
self.nodes = controllers
- # Makes a generic mesh assuming an equal number of cache and directory cntrls
+ # Makes a generic mesh
+ # assuming an equal number of cache and directory cntrls
def makeTopology(self, options, network, IntLink, ExtLink, Router):
nodes = self.nodes
@@ -89,29 +97,56 @@ class Mesh(SimpleTopology):
network.ext_links = ext_links
- # Create the mesh links. First row (east-west) links then column
- # (north-south) links
+ # Create the mesh links.
int_links = []
+
+ # East output to West input links (weight = 1)
+ for row in xrange(num_rows):
+ for col in xrange(num_columns):
+ if (col + 1 < num_columns):
+ east_out = col + (row * num_columns)
+ west_in = (col + 1) + (row * num_columns)
+ int_links.append(IntLink(link_id=link_count,
+ src_node=routers[east_out],
+ dst_node=routers[west_in],
+ weight=1))
+ link_count += 1
+
+ # West output to East input links (weight = 1)
for row in xrange(num_rows):
for col in xrange(num_columns):
if (col + 1 < num_columns):
- east_id = col + (row * num_columns)
- west_id = (col + 1) + (row * num_columns)
+ east_in = col + (row * num_columns)
+ west_out = (col + 1) + (row * num_columns)
int_links.append(IntLink(link_id=link_count,
- node_a=routers[east_id],
- node_b=routers[west_id],
- weight=1))
+ src_node=routers[west_out],
+ dst_node=routers[east_in],
+ weight=1))
link_count += 1
+ # North output to South input links (weight = 2)
for col in xrange(num_columns):
for row in xrange(num_rows):
if (row + 1 < num_rows):
- north_id = col + (row * num_columns)
- south_id = col + ((row + 1) * num_columns)
+ north_out = col + (row * num_columns)
+ south_in = col + ((row + 1) * num_columns)
int_links.append(IntLink(link_id=link_count,
- node_a=routers[north_id],
- node_b=routers[south_id],
- weight=2))
+ src_node=routers[north_out],
+ dst_node=routers[south_in],
+ weight=2))
link_count += 1
+ # South output to North input links (weight = 2)
+ for col in xrange(num_columns):
+ for row in xrange(num_rows):
+ if (row + 1 < num_rows):
+ north_in = col + (row * num_columns)
+ south_out = col + ((row + 1) * num_columns)
+ int_links.append(IntLink(link_id=link_count,
+ src_node=routers[south_out],
+ dst_node=routers[north_in],
+ weight=2))
+ link_count += 1
+
+
network.int_links = int_links
diff --git a/configs/topologies/Torus.py b/configs/topologies/Mesh_westfirst.py
index db67d3ede..3af894f93 100644
--- a/configs/topologies/Torus.py
+++ b/configs/topologies/Mesh_westfirst.py
@@ -1,5 +1,5 @@
-# Copyright (c) 2011 Advanced Micro Devices, Inc.
-# 2011 Massachusetts Institute of Technology
+# Copyright (c) 2010 Advanced Micro Devices, Inc.
+# 2016 Georgia Institute of Technology
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -33,16 +33,24 @@ from m5.objects import *
from BaseTopology import SimpleTopology
-class Torus(SimpleTopology):
- description='Torus'
+# Creates a generic Mesh assuming an equal number of cache
+# and directory controllers.
+# West-first routing is enforced (using link weights)
+# to guarantee deadlock freedom.
+# The network randomly chooses between links with the same
+# weight for messages within unordered virtual networks.
+# Within ordered virtual networks, a fixed link direction
+# is always chosen based on which appears first inside the
+# routing table.
+
+class Mesh_westfirst(SimpleTopology):
+ description='Mesh_westfirst'
def __init__(self, controllers):
self.nodes = controllers
- # Makes a generic torus assuming an equal number of cache and directory cntrls
- # Assuming a folded-torus on-chip layout (as shown on gem5 wiki).
- # All links (including the wrap-around ones) are of equal length, double that
- # of a mesh. Thus, each link is assigned a latency of 2 cycles.
+ # Makes a generic mesh
+ # assuming an equal number of cache and directory cntrls
def makeTopology(self, options, network, IntLink, ExtLink, Router):
nodes = self.nodes
@@ -57,7 +65,7 @@ class Torus(SimpleTopology):
num_columns = int(num_routers / num_rows)
assert(num_columns * num_rows == num_routers)
- # Create the routers in the torus
+ # Create the routers in the mesh
routers = [Router(router_id=i) for i in range(num_routers)]
network.routers = routers
@@ -94,36 +102,57 @@ class Torus(SimpleTopology):
network.ext_links = ext_links
- # Create the torus links. First row (east-west) links then column
- # (north-south) links
- # column links are given higher weights to implement XY routing
+ # Create the mesh links.
int_links = []
+
+ # East output to West input links (weight = 2)
+ for row in xrange(num_rows):
+ for col in xrange(num_columns):
+ if (col + 1 < num_columns):
+ east_out = col + (row * num_columns)
+ west_in = (col + 1) + (row * num_columns)
+ int_links.append(IntLink(link_id=link_count,
+ src_node=routers[east_out],
+ dst_node=routers[west_in],
+ weight=2))
+ link_count += 1
+
+ # West output to East input links (weight = 1)
for row in xrange(num_rows):
for col in xrange(num_columns):
- west_id = col + (row * num_columns)
if (col + 1 < num_columns):
- east_id = (col + 1) + (row * num_columns)
- else:
- east_id = (row * num_columns)
- int_links.append(IntLink(link_id=link_count,
- node_a=routers[east_id],
- node_b=routers[west_id],
- latency=2,
- weight=1))
- link_count += 1
+ east_in = col + (row * num_columns)
+ west_out = (col + 1) + (row * num_columns)
+ int_links.append(IntLink(link_id=link_count,
+ src_node=routers[west_out],
+ dst_node=routers[east_in],
+ weight=1))
+ link_count += 1
+
+ # North output to South input links (weight = 2)
for col in xrange(num_columns):
for row in xrange(num_rows):
- north_id = col + (row * num_columns)
if (row + 1 < num_rows):
- south_id = col + ((row + 1) * num_columns)
- else:
- south_id = col
- int_links.append(IntLink(link_id=link_count,
- node_a=routers[north_id],
- node_b=routers[south_id],
- latency=2,
- weight=2))
- link_count += 1
+ north_out = col + (row * num_columns)
+ south_in = col + ((row + 1) * num_columns)
+ int_links.append(IntLink(link_id=link_count,
+ src_node=routers[north_out],
+ dst_node=routers[south_in],
+ weight=2))
+ link_count += 1
+
+ # South output to North input links (weight = 2)
+ for col in xrange(num_columns):
+ for row in xrange(num_rows):
+ if (row + 1 < num_rows):
+ north_in = col + (row * num_columns)
+ south_out = col + ((row + 1) * num_columns)
+ int_links.append(IntLink(link_id=link_count,
+ src_node=routers[south_out],
+ dst_node=routers[north_in],
+ weight=2))
+ link_count += 1
+
network.int_links = int_links
diff --git a/configs/topologies/Pt2Pt.py b/configs/topologies/Pt2Pt.py
index 8fada26bf..006d00c2f 100644
--- a/configs/topologies/Pt2Pt.py
+++ b/configs/topologies/Pt2Pt.py
@@ -57,7 +57,7 @@ class Pt2Pt(SimpleTopology):
if (i != j):
link_count += 1
int_links.append(IntLink(link_id=link_count,
- node_a=routers[i],
- node_b=routers[j]))
+ src_node=routers[i],
+ dst_node=routers[j]))
network.int_links = int_links