diff options
author | Brad Beckmann <Brad.Beckmann@amd.com> | 2011-04-28 17:18:14 -0700 |
---|---|---|
committer | Brad Beckmann <Brad.Beckmann@amd.com> | 2011-04-28 17:18:14 -0700 |
commit | 40bcbf42539fec83628f2ae2627238adff27f62c (patch) | |
tree | 993083e3b6e5661697261e81869bf40e17027826 /src/mem/ruby/network/topologies | |
parent | bc5eb596053f7f69c88f8218f20709d94b2a331c (diff) | |
download | gem5-40bcbf42539fec83628f2ae2627238adff27f62c.tar.xz |
network: convert links & switches to first class C++ SimObjects
This patch converts links and switches from second class simobjects that were
virtually ignored by the networks (both simple and Garnet) to first class
simobjects that directly correspond to c++ ojbects manipulated by the
topology and network classes. This is especially true for Garnet, where the
links and switches directly correspond to specific C++ objects.
By making this change, many aspects of the Topology class were simplified.
--HG--
rename : src/mem/ruby/network/Network.cc => src/mem/ruby/network/BasicLink.cc
rename : src/mem/ruby/network/Network.hh => src/mem/ruby/network/BasicLink.hh
rename : src/mem/ruby/network/Network.cc => src/mem/ruby/network/garnet/fixed-pipeline/GarnetLink_d.cc
rename : src/mem/ruby/network/Network.hh => src/mem/ruby/network/garnet/fixed-pipeline/GarnetLink_d.hh
rename : src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.py => src/mem/ruby/network/garnet/fixed-pipeline/GarnetLink_d.py
rename : src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.py => src/mem/ruby/network/garnet/fixed-pipeline/GarnetRouter_d.py
rename : src/mem/ruby/network/Network.cc => src/mem/ruby/network/garnet/flexible-pipeline/GarnetLink.cc
rename : src/mem/ruby/network/Network.hh => src/mem/ruby/network/garnet/flexible-pipeline/GarnetLink.hh
rename : src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.py => src/mem/ruby/network/garnet/flexible-pipeline/GarnetLink.py
rename : src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.py => src/mem/ruby/network/garnet/flexible-pipeline/GarnetRouter.py
Diffstat (limited to 'src/mem/ruby/network/topologies')
-rw-r--r-- | src/mem/ruby/network/topologies/Crossbar.py | 17 | ||||
-rw-r--r-- | src/mem/ruby/network/topologies/Mesh.py | 32 | ||||
-rw-r--r-- | src/mem/ruby/network/topologies/MeshDirCorners.py | 50 |
3 files changed, 68 insertions, 31 deletions
diff --git a/src/mem/ruby/network/topologies/Crossbar.py b/src/mem/ruby/network/topologies/Crossbar.py index 77a6fd6f2..8aa6c3504 100644 --- a/src/mem/ruby/network/topologies/Crossbar.py +++ b/src/mem/ruby/network/topologies/Crossbar.py @@ -32,12 +32,19 @@ from m5.objects import * class Crossbar(Topology): description='Crossbar' -def makeTopology(nodes, options): - ext_links = [ExtLink(ext_node=n, int_node=i) +def makeTopology(nodes, options, IntLink, ExtLink, Router): + # 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 simple network, but + # internal links do. + routers = [Router(router_id=i) for i in range(len(nodes)+1)] + ext_links = [ExtLink(link_id=i, ext_node=n, int_node=routers[i]) for (i, n) in enumerate(nodes)] - xbar = len(nodes) # node ID for crossbar switch - int_links = [IntLink(node_a=i, node_b=xbar) for i in range(len(nodes))] + link_count = len(nodes) + xbar = routers[len(nodes)] # the crossbar router is the last router created + int_links = [IntLink(link_id=(link_count+i), node_a=routers[i], node_b=xbar) + for i in range(len(nodes))] return Crossbar(ext_links=ext_links, int_links=int_links, - num_int_nodes=len(nodes)+1) + routers=routers) diff --git a/src/mem/ruby/network/topologies/Mesh.py b/src/mem/ruby/network/topologies/Mesh.py index d9ddc7b17..20f3bba31 100644 --- a/src/mem/ruby/network/topologies/Mesh.py +++ b/src/mem/ruby/network/topologies/Mesh.py @@ -34,7 +34,7 @@ class Mesh(Topology): # Makes a generic mesh assuming an equal number of cache and directory cntrls -def makeTopology(nodes, options): +def makeTopology(nodes, options, IntLink, ExtLink, Router): num_routers = options.num_cpus num_rows = options.mesh_rows @@ -46,6 +46,12 @@ def makeTopology(nodes, options): 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)] + + # link counter to set unique link ids + link_count = 0 + # Add all but the remainder nodes to the list of nodes to be uniformly # distributed across the network. network_nodes = [] @@ -61,14 +67,18 @@ def makeTopology(nodes, options): for (i, n) in enumerate(network_nodes): cntrl_level, router_id = divmod(i, num_routers) assert(cntrl_level < cntrls_per_router) - ext_links.append(ExtLink(ext_node=n, int_node=router_id)) + ext_links.append(ExtLink(link_id=link_count, ext_node=n, + int_node=routers[router_id])) + link_count += 1 # Connect the remainding nodes to router 0. These should only be # DMA nodes. for (i, node) in enumerate(remainder_nodes): assert(node.type == 'DMA_Controller') assert(i < remainder) - ext_links.append(ExtLink(ext_node=node, int_node=0)) + ext_links.append(ExtLink(link_id=link_count, ext_node=node, + int_node=routers[0])) + link_count += 1 # Create the mesh links. First row (east-west) links then column # (north-south) links @@ -78,18 +88,22 @@ def makeTopology(nodes, options): if (col + 1 < num_columns): east_id = col + (row * num_columns) west_id = (col + 1) + (row * num_columns) - int_links.append(IntLink(node_a=east_id, - node_b=west_id, + int_links.append(IntLink(link_id=link_count, + node_a=routers[east_id], + node_b=routers[west_id], weight=1)) + link_count += 1 + 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) - int_links.append(IntLink(node_a=north_id, - node_b=south_id, + int_links.append(IntLink(link_id=link_count, + node_a=routers[north_id], + node_b=routers[south_id], weight=2)) - + link_count += 1 return Mesh(ext_links=ext_links, int_links=int_links, - num_int_nodes=num_routers) + routers=routers) diff --git a/src/mem/ruby/network/topologies/MeshDirCorners.py b/src/mem/ruby/network/topologies/MeshDirCorners.py index e994ad1f9..1234d61c5 100644 --- a/src/mem/ruby/network/topologies/MeshDirCorners.py +++ b/src/mem/ruby/network/topologies/MeshDirCorners.py @@ -37,7 +37,7 @@ class MeshDirCorners(Topology): # configurations. The network specified is similar to GEMS old file # specified network. -def makeTopology(nodes, options): +def makeTopology(nodes, options, IntLink, ExtLink, Router): num_routers = options.num_cpus num_rows = options.mesh_rows @@ -65,28 +65,39 @@ def makeTopology(nodes, options): assert(remainder == 0) assert(len(dir_nodes) == 4) + # Create the routers in the mesh + routers = [Router(router_id=i) for i in range(num_routers)] + + # link counter to set unique link ids + link_count = 0 + # Connect each cache controller to the appropriate router ext_links = [] for (i, n) in enumerate(cache_nodes): cntrl_level, router_id = divmod(i, num_routers) assert(cntrl_level < caches_per_router) - ext_links.append(ExtLink(ext_node=n, int_node=router_id)) + ext_links.append(ExtLink(link_id=link_count, ext_node=n, + int_node=routers[router_id])) + link_count += 1 # Connect the dir nodes to the corners. - ext_links.append(ExtLink(ext_node=dir_nodes[0], int_node=0)) - ext_links.append(ExtLink(ext_node=dir_nodes[1], - int_node=(num_columns - 1))) - - ext_links.append(ExtLink(ext_node=dir_nodes[2], - int_node=(num_routers - num_columns))) - - ext_links.append(ExtLink(ext_node=dir_nodes[3], - int_node=(num_routers - 1))) + ext_links.append(ExtLink(link_id=link_count, ext_node=dir_nodes[0], + int_node=routers[0])) + link_count += 1 + ext_links.append(ExtLink(link_id=link_count, ext_node=dir_nodes[1], + int_node=routers[num_columns - 1])) + link_count += 1 + ext_links.append(ExtLink(link_id=link_count, ext_node=dir_nodes[2], + int_node=routers[num_routers - num_columns])) + link_count += 1 + ext_links.append(ExtLink(link_id=link_count, ext_node=dir_nodes[3], + int_node=routers[num_routers - 1])) + 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(ext_node=node, int_node=0)) + ext_links.append(ExtLink(ext_node=node, int_node=routers[0])) # Create the mesh links. First row (east-west) links then column # (north-south) links @@ -96,19 +107,24 @@ def makeTopology(nodes, options): if (col + 1 < num_columns): east_id = col + (row * num_columns) west_id = (col + 1) + (row * num_columns) - int_links.append(IntLink(node_a=east_id, - node_b=west_id, + int_links.append(IntLink(link_id=link_count, + node_a=routers[east_id], + node_b=routers[west_id], weight=1)) + link_count += 1 + 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) - int_links.append(IntLink(node_a=north_id, - node_b=south_id, + int_links.append(IntLink(link_id=link_count, + node_a=routers[north_id], + node_b=routers[south_id], weight=2)) + link_count += 1 return MeshDirCorners(ext_links=ext_links, int_links=int_links, - num_int_nodes=num_routers) + routers=routers) |