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.
This commit is contained in:
Tushar Krishna
2016-10-06 14:35:18 -04:00
parent b9e23a6d74
commit 003c08fa90
20 changed files with 295 additions and 173 deletions

View File

@@ -56,8 +56,6 @@ BasicLinkParams::create()
BasicExtLink::BasicExtLink(const Params *p)
: BasicLink(p)
{
m_int_node = p->int_node;
m_ext_node = p->ext_node;
}
BasicExtLink *
@@ -69,8 +67,6 @@ BasicExtLinkParams::create()
BasicIntLink::BasicIntLink(const Params *p)
: BasicLink(p)
{
m_node_a = p->node_a;
m_node_b = p->node_b;
}
BasicIntLink *

View File

@@ -73,10 +73,6 @@ class BasicExtLink : public BasicLink
const Params *params() const { return (const Params *)_params; }
friend class Topology;
protected:
BasicRouter* m_int_node;
AbstractController* m_ext_node;
};
class BasicIntLink : public BasicLink
@@ -87,10 +83,6 @@ class BasicIntLink : public BasicLink
const Params *params() const { return (const Params *)_params; }
friend class Topology;
protected:
BasicRouter* m_node_a;
BasicRouter* m_node_b;
};
#endif // __MEM_RUBY_NETWORK_BASIC_LINK_HH__

View File

@@ -35,10 +35,9 @@ class BasicLink(SimObject):
cxx_header = "mem/ruby/network/BasicLink.hh"
link_id = Param.Int("ID in relation to other links")
latency = Param.Cycles(1, "latency")
# The following banwidth factor does not translate to the same value for
# both the simple and Garnet models. For the most part, the bandwidth
# factor is the width of the link in bytes, expect for certain situations
# with regard to the simple network.
# Width of the link in bytes
# Only used by simple network.
# Garnet models this by flit size
bandwidth_factor = Param.Int("generic bandwidth factor, usually in bytes")
weight = Param.Int(1, "used to restrict routing in shortest path analysis")
@@ -52,6 +51,6 @@ class BasicExtLink(BasicLink):
class BasicIntLink(BasicLink):
type = 'BasicIntLink'
cxx_header = "mem/ruby/network/BasicLink.hh"
node_a = Param.BasicRouter("Router on one end")
node_b = Param.BasicRouter("Router on other end")
src_node = Param.BasicRouter("Router on src end")
dst_node = Param.BasicRouter("Router on dst end")
bandwidth_factor = 16

View File

@@ -80,14 +80,11 @@ class Network : public ClockedObject
virtual void checkNetworkAllocation(NodeID id, bool ordered,
int network_num, std::string vnet_type);
virtual void makeOutLink(SwitchID src, NodeID dest, BasicLink* link,
LinkDirection direction,
virtual void makeExtOutLink(SwitchID src, NodeID dest, BasicLink* link,
const NetDest& routing_table_entry) = 0;
virtual void makeInLink(NodeID src, SwitchID dest, BasicLink* link,
LinkDirection direction,
virtual void makeExtInLink(NodeID src, SwitchID dest, BasicLink* link,
const NetDest& routing_table_entry) = 0;
virtual void makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
LinkDirection direction,
const NetDest& routing_table_entry) = 0;
virtual void collateStats() = 0;

View File

@@ -55,10 +55,14 @@ Topology::Topology(uint32_t num_routers,
// Total nodes/controllers in network
assert(m_nodes > 1);
// analyze both the internal and external links, create data structures
// Note that the python created links are bi-directional, but that the
// topology and networks utilize uni-directional links. Thus each
// BasicLink is converted to two calls to add link, on for each direction
// analyze both the internal and external links, create data structures.
// The python created external links are bi-directional,
// and the python created internal links are uni-directional.
// The networks and topology utilize uni-directional links.
// Thus each external link is converted to two calls to addLink,
// one for each direction.
//
// External Links
for (vector<BasicExtLink*>::const_iterator i = ext_links.begin();
i != ext_links.end(); ++i) {
BasicExtLink *ext_link = (*i);
@@ -71,29 +75,27 @@ Topology::Topology(uint32_t num_routers,
int int_idx = router->params()->router_id + 2*m_nodes;
// create the internal uni-directional links in both directions
// the first direction is marked: In
addLink(ext_idx1, int_idx, ext_link, LinkDirection_In);
// the first direction is marked: Out
addLink(int_idx, ext_idx2, ext_link, LinkDirection_Out);
// ext to int
addLink(ext_idx1, int_idx, ext_link);
// int to ext
addLink(int_idx, ext_idx2, ext_link);
}
// Internal Links
for (vector<BasicIntLink*>::const_iterator i = int_links.begin();
i != int_links.end(); ++i) {
BasicIntLink *int_link = (*i);
BasicRouter *router_a = int_link->params()->node_a;
BasicRouter *router_b = int_link->params()->node_b;
BasicRouter *router_src = int_link->params()->src_node;
BasicRouter *router_dst = int_link->params()->dst_node;
// Store the IntLink pointers for later
m_int_link_vector.push_back(int_link);
int a = router_a->params()->router_id + 2*m_nodes;
int b = router_b->params()->router_id + 2*m_nodes;
int src = router_src->params()->router_id + 2*m_nodes;
int dst = router_dst->params()->router_id + 2*m_nodes;
// create the internal uni-directional links in both directions
// the first direction is marked: In
addLink(a, b, int_link, LinkDirection_In);
// the second direction is marked: Out
addLink(b, a, int_link, LinkDirection_Out);
// create the internal uni-directional link from src to dst
addLink(src, dst, int_link);
}
}
@@ -151,8 +153,7 @@ Topology::createLinks(Network *net)
}
void
Topology::addLink(SwitchID src, SwitchID dest, BasicLink* link,
LinkDirection dir)
Topology::addLink(SwitchID src, SwitchID dest, BasicLink* link)
{
assert(src <= m_number_of_switches+m_nodes+m_nodes);
assert(dest <= m_number_of_switches+m_nodes+m_nodes);
@@ -162,7 +163,6 @@ Topology::addLink(SwitchID src, SwitchID dest, BasicLink* link,
src_dest_pair.first = src;
src_dest_pair.second = dest;
link_entry.direction = dir;
link_entry.link = link;
m_link_map[src_dest_pair] = link_entry;
}
@@ -182,23 +182,23 @@ Topology::makeLink(Network *net, SwitchID src, SwitchID dest,
src_dest.first = src;
src_dest.second = dest;
link_entry = m_link_map[src_dest];
net->makeInLink(src, dest - (2 * m_nodes), link_entry.link,
link_entry.direction, routing_table_entry);
net->makeExtInLink(src, dest - (2 * m_nodes), link_entry.link,
routing_table_entry);
} else if (dest < 2*m_nodes) {
assert(dest >= m_nodes);
NodeID node = dest - m_nodes;
src_dest.first = src;
src_dest.second = dest;
link_entry = m_link_map[src_dest];
net->makeOutLink(src - (2 * m_nodes), node, link_entry.link,
link_entry.direction, routing_table_entry);
net->makeExtOutLink(src - (2 * m_nodes), node, link_entry.link,
routing_table_entry);
} else {
assert((src >= 2 * m_nodes) && (dest >= 2 * m_nodes));
src_dest.first = src;
src_dest.second = dest;
link_entry = m_link_map[src_dest];
net->makeInternalLink(src - (2 * m_nodes), dest - (2 * m_nodes),
link_entry.link, link_entry.direction,
link_entry.link,
routing_table_entry);
}
}

View File

@@ -72,8 +72,7 @@ class Topology
void print(std::ostream& out) const { out << "[Topology]"; }
private:
void addLink(SwitchID src, SwitchID dest, BasicLink* link,
LinkDirection dir);
void addLink(SwitchID src, SwitchID dest, BasicLink* link);
void makeLink(Network *net, SwitchID src, SwitchID dest,
const NetDest& routing_table_entry);

View File

@@ -127,15 +127,14 @@ GarnetNetwork_d::~GarnetNetwork_d()
*/
void
GarnetNetwork_d::makeInLink(NodeID src, SwitchID dest, BasicLink* link,
LinkDirection direction,
GarnetNetwork_d::makeExtInLink(NodeID src, SwitchID dest, BasicLink* link,
const NetDest& routing_table_entry)
{
assert(src < m_nodes);
GarnetExtLink_d* garnet_link = safe_cast<GarnetExtLink_d*>(link);
NetworkLink_d* net_link = garnet_link->m_network_links[direction];
CreditLink_d* credit_link = garnet_link->m_credit_links[direction];
NetworkLink_d* net_link = garnet_link->m_network_links[0];
CreditLink_d* credit_link = garnet_link->m_credit_links[0];
m_links.push_back(net_link);
m_creditlinks.push_back(credit_link);
@@ -151,8 +150,7 @@ GarnetNetwork_d::makeInLink(NodeID src, SwitchID dest, BasicLink* link,
*/
void
GarnetNetwork_d::makeOutLink(SwitchID src, NodeID dest, BasicLink* link,
LinkDirection direction,
GarnetNetwork_d::makeExtOutLink(SwitchID src, NodeID dest, BasicLink* link,
const NetDest& routing_table_entry)
{
assert(dest < m_nodes);
@@ -160,8 +158,8 @@ GarnetNetwork_d::makeOutLink(SwitchID src, NodeID dest, BasicLink* link,
assert(m_routers[src] != NULL);
GarnetExtLink_d* garnet_link = safe_cast<GarnetExtLink_d*>(link);
NetworkLink_d* net_link = garnet_link->m_network_links[direction];
CreditLink_d* credit_link = garnet_link->m_credit_links[direction];
NetworkLink_d* net_link = garnet_link->m_network_links[1];
CreditLink_d* credit_link = garnet_link->m_credit_links[1];
m_links.push_back(net_link);
m_creditlinks.push_back(credit_link);
@@ -177,12 +175,11 @@ GarnetNetwork_d::makeOutLink(SwitchID src, NodeID dest, BasicLink* link,
void
GarnetNetwork_d::makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
LinkDirection direction,
const NetDest& routing_table_entry)
{
GarnetIntLink_d* garnet_link = safe_cast<GarnetIntLink_d*>(link);
NetworkLink_d* net_link = garnet_link->m_network_links[direction];
CreditLink_d* credit_link = garnet_link->m_credit_links[direction];
NetworkLink_d* net_link = garnet_link->m_network_links[0];
CreditLink_d* credit_link = garnet_link->m_credit_links[0];
m_links.push_back(net_link);
m_creditlinks.push_back(credit_link);

View File

@@ -69,14 +69,11 @@ class GarnetNetwork_d : public BaseGarnetNetwork
}
// Methods used by Topology to setup the network
void makeOutLink(SwitchID src, NodeID dest, BasicLink* link,
LinkDirection direction,
void makeExtOutLink(SwitchID src, NodeID dest, BasicLink* link,
const NetDest& routing_table_entry);
void makeInLink(NodeID src, SwitchID dest, BasicLink* link,
LinkDirection direction,
void makeExtInLink(NodeID src, SwitchID dest, BasicLink* link,
const NetDest& routing_table_entry);
void makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
LinkDirection direction,
const NetDest& routing_table_entry);
//! Function for performing a functional write. The return value

View File

@@ -94,14 +94,13 @@ GarnetNetwork::~GarnetNetwork()
}
void
GarnetNetwork::makeInLink(NodeID src, SwitchID dest, BasicLink* link,
LinkDirection direction,
GarnetNetwork::makeExtInLink(NodeID src, SwitchID dest, BasicLink* link,
const NetDest& routing_table_entry)
{
assert(src < m_nodes);
GarnetExtLink* garnet_link = safe_cast<GarnetExtLink*>(link);
NetworkLink *net_link = garnet_link->m_network_links[direction];
NetworkLink *net_link = garnet_link->m_network_links[0];
net_link->init_net_ptr(this);
m_links.push_back(net_link);
@@ -110,8 +109,7 @@ GarnetNetwork::makeInLink(NodeID src, SwitchID dest, BasicLink* link,
}
void
GarnetNetwork::makeOutLink(SwitchID src, NodeID dest, BasicLink* link,
LinkDirection direction,
GarnetNetwork::makeExtOutLink(SwitchID src, NodeID dest, BasicLink* link,
const NetDest& routing_table_entry)
{
assert(dest < m_nodes);
@@ -119,7 +117,7 @@ GarnetNetwork::makeOutLink(SwitchID src, NodeID dest, BasicLink* link,
assert(m_routers[src] != NULL);
GarnetExtLink* garnet_link = safe_cast<GarnetExtLink*>(link);
NetworkLink *net_link = garnet_link->m_network_links[direction];
NetworkLink *net_link = garnet_link->m_network_links[1];
net_link->init_net_ptr(this);
m_links.push_back(net_link);
@@ -130,11 +128,10 @@ GarnetNetwork::makeOutLink(SwitchID src, NodeID dest, BasicLink* link,
void
GarnetNetwork::makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
LinkDirection direction,
const NetDest& routing_table_entry)
{
GarnetIntLink* garnet_link = safe_cast<GarnetIntLink*>(link);
NetworkLink *net_link = garnet_link->m_network_links[direction];
NetworkLink *net_link = garnet_link->m_network_links[0];
net_link->init_net_ptr(this);
m_links.push_back(net_link);

View File

@@ -60,14 +60,11 @@ class GarnetNetwork : public BaseGarnetNetwork
void print(std::ostream& out) const;
// Methods used by Topology to setup the network
void makeOutLink(SwitchID src, NodeID dest, BasicLink* link,
LinkDirection direction,
void makeExtOutLink(SwitchID src, NodeID dest, BasicLink* link,
const NetDest& routing_table_entry);
void makeInLink(NodeID src, SwitchID dest, BasicLink* link,
LinkDirection direction,
void makeExtInLink(NodeID src, SwitchID dest, BasicLink* link,
const NetDest& routing_table_entry);
void makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
LinkDirection direction,
const NetDest& routing_table_entry);
//! Function for performing a functional read. The return value

View File

@@ -78,8 +78,7 @@ SimpleNetwork::~SimpleNetwork()
// From a switch to an endpoint node
void
SimpleNetwork::makeOutLink(SwitchID src, NodeID dest, BasicLink* link,
LinkDirection direction,
SimpleNetwork::makeExtOutLink(SwitchID src, NodeID dest, BasicLink* link,
const NetDest& routing_table_entry)
{
assert(dest < m_nodes);
@@ -95,8 +94,7 @@ SimpleNetwork::makeOutLink(SwitchID src, NodeID dest, BasicLink* link,
// From an endpoint node to a switch
void
SimpleNetwork::makeInLink(NodeID src, SwitchID dest, BasicLink* link,
LinkDirection direction,
SimpleNetwork::makeExtInLink(NodeID src, SwitchID dest, BasicLink* link,
const NetDest& routing_table_entry)
{
assert(src < m_nodes);
@@ -106,7 +104,6 @@ SimpleNetwork::makeInLink(NodeID src, SwitchID dest, BasicLink* link,
// From a switch to a switch
void
SimpleNetwork::makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
LinkDirection direction,
const NetDest& routing_table_entry)
{
// Create a set of new MessageBuffers

View File

@@ -59,14 +59,11 @@ class SimpleNetwork : public Network
bool isVNetOrdered(int vnet) const { return m_ordered[vnet]; }
// Methods used by Topology to setup the network
void makeOutLink(SwitchID src, NodeID dest, BasicLink* link,
LinkDirection direction,
void makeExtOutLink(SwitchID src, NodeID dest, BasicLink* link,
const NetDest& routing_table_entry);
void makeInLink(NodeID src, SwitchID dest, BasicLink* link,
LinkDirection direction,
void makeExtInLink(NodeID src, SwitchID dest, BasicLink* link,
const NetDest& routing_table_entry);
void makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
LinkDirection direction,
const NetDest& routing_table_entry);
void print(std::ostream& out) const;

View File

@@ -56,12 +56,10 @@ class SimpleNetwork(RubyNetwork):
# Also add buffers for all router-link connections
for router in self.routers:
router_buffers = []
# Add message buffers to routers for each internal link connection
# Add message buffers to routers at the end of each
# unidirectional internal link
for link in self.int_links:
if link.node_a == router:
for i in xrange(self.number_of_virtual_networks):
router_buffers.append(MessageBuffer(ordered = True))
if link.node_b == router:
if link.dst_node == router:
for i in xrange(self.number_of_virtual_networks):
router_buffers.append(MessageBuffer(ordered = True))