ruby: network: remove reconfiguration code

This code seems not to be of any use now. There is no path in the simulator
that allows for reconfiguring the network. A better approach would be to
take a checkpoint and start the simulation from the checkpoint with the new
configuration.
This commit is contained in:
Nilay Vaish 2013-06-28 21:36:37 -05:00
parent 62a93f0bf0
commit b3980cdb9a
9 changed files with 72 additions and 151 deletions

View file

@ -80,16 +80,13 @@ class Network : public ClockedObject
virtual void makeOutLink(SwitchID src, NodeID dest, BasicLink* link, virtual void makeOutLink(SwitchID src, NodeID dest, BasicLink* link,
LinkDirection direction, LinkDirection direction,
const NetDest& routing_table_entry, const NetDest& routing_table_entry) = 0;
bool isReconfiguration) = 0;
virtual void makeInLink(NodeID src, SwitchID dest, BasicLink* link, virtual void makeInLink(NodeID src, SwitchID dest, BasicLink* link,
LinkDirection direction, LinkDirection direction,
const NetDest& routing_table_entry, const NetDest& routing_table_entry) = 0;
bool isReconfiguration) = 0;
virtual void makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link, virtual void makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
LinkDirection direction, LinkDirection direction,
const NetDest& routing_table_entry, const NetDest& routing_table_entry) = 0;
bool isReconfiguration) = 0;
virtual void reset() = 0; virtual void reset() = 0;

View file

@ -121,7 +121,7 @@ Topology::Topology(uint32_t num_routers, vector<BasicExtLink *> ext_links,
} }
void void
Topology::createLinks(Network *net, bool isReconfiguration) Topology::createLinks(Network *net)
{ {
// Find maximum switchID // Find maximum switchID
SwitchID max_switch_id = 0; SwitchID max_switch_id = 0;
@ -179,9 +179,9 @@ Topology::createLinks(Network *net, bool isReconfiguration)
for (int j = 0; j < topology_weights[i].size(); j++) { for (int j = 0; j < topology_weights[i].size(); j++) {
int weight = topology_weights[i][j]; int weight = topology_weights[i][j];
if (weight > 0 && weight != INFINITE_LATENCY) { if (weight > 0 && weight != INFINITE_LATENCY) {
NetDest destination_set = shortest_path_to_node(i, j, NetDest destination_set =
topology_weights, dist); shortest_path_to_node(i, j, topology_weights, dist);
makeLink(net, i, j, destination_set, isReconfiguration); makeLink(net, i, j, destination_set);
} }
} }
} }
@ -206,7 +206,7 @@ Topology::addLink(SwitchID src, SwitchID dest, BasicLink* link,
void void
Topology::makeLink(Network *net, SwitchID src, SwitchID dest, Topology::makeLink(Network *net, SwitchID src, SwitchID dest,
const NetDest& routing_table_entry, bool isReconfiguration) const NetDest& routing_table_entry)
{ {
// Make sure we're not trying to connect two end-point nodes // Make sure we're not trying to connect two end-point nodes
// directly together // directly together
@ -220,9 +220,7 @@ Topology::makeLink(Network *net, SwitchID src, SwitchID dest,
src_dest.second = dest; src_dest.second = dest;
link_entry = m_link_map[src_dest]; link_entry = m_link_map[src_dest];
net->makeInLink(src, dest - (2 * m_nodes), link_entry.link, net->makeInLink(src, dest - (2 * m_nodes), link_entry.link,
link_entry.direction, link_entry.direction, routing_table_entry);
routing_table_entry,
isReconfiguration);
} else if (dest < 2*m_nodes) { } else if (dest < 2*m_nodes) {
assert(dest >= m_nodes); assert(dest >= m_nodes);
NodeID node = dest - m_nodes; NodeID node = dest - m_nodes;
@ -230,9 +228,7 @@ Topology::makeLink(Network *net, SwitchID src, SwitchID dest,
src_dest.second = dest; src_dest.second = dest;
link_entry = m_link_map[src_dest]; link_entry = m_link_map[src_dest];
net->makeOutLink(src - (2 * m_nodes), node, link_entry.link, net->makeOutLink(src - (2 * m_nodes), node, link_entry.link,
link_entry.direction, link_entry.direction, routing_table_entry);
routing_table_entry,
isReconfiguration);
} else { } else {
assert((src >= 2 * m_nodes) && (dest >= 2 * m_nodes)); assert((src >= 2 * m_nodes) && (dest >= 2 * m_nodes));
src_dest.first = src; src_dest.first = src;
@ -240,7 +236,7 @@ Topology::makeLink(Network *net, SwitchID src, SwitchID dest,
link_entry = m_link_map[src_dest]; link_entry = m_link_map[src_dest];
net->makeInternalLink(src - (2 * m_nodes), dest - (2 * m_nodes), net->makeInternalLink(src - (2 * m_nodes), dest - (2 * m_nodes),
link_entry.link, link_entry.direction, link_entry.link, link_entry.direction,
routing_table_entry, isReconfiguration); routing_table_entry);
} }
} }

View file

@ -68,15 +68,14 @@ class Topology
std::vector<BasicIntLink *> int_links); std::vector<BasicIntLink *> int_links);
uint32_t numSwitches() const { return m_number_of_switches; } uint32_t numSwitches() const { return m_number_of_switches; }
void createLinks(Network *net, bool isReconfiguration); void createLinks(Network *net);
void print(std::ostream& out) const { out << "[Topology]"; } void print(std::ostream& out) const { out << "[Topology]"; }
protected: protected:
void addLink(SwitchID src, SwitchID dest, BasicLink* link, void addLink(SwitchID src, SwitchID dest, BasicLink* link,
LinkDirection dir); LinkDirection dir);
void makeLink(Network *net, SwitchID src, SwitchID dest, void makeLink(Network *net, SwitchID src, SwitchID dest,
const NetDest& routing_table_entry, const NetDest& routing_table_entry);
bool isReconfiguration);
NodeID m_nodes; NodeID m_nodes;
uint32_t m_number_of_switches; uint32_t m_number_of_switches;

View file

@ -88,8 +88,7 @@ GarnetNetwork_d::init()
ni->addNode(m_toNetQueues[i], m_fromNetQueues[i]); ni->addNode(m_toNetQueues[i], m_fromNetQueues[i]);
m_ni_ptr_vector.push_back(ni); m_ni_ptr_vector.push_back(ni);
} }
// false because this isn't a reconfiguration m_topology_ptr->createLinks(this);
m_topology_ptr->createLinks(this, false);
// initialize the link's network pointers // initialize the link's network pointers
for (vector<NetworkLink_d*>::const_iterator i = m_link_ptr_vector.begin(); for (vector<NetworkLink_d*>::const_iterator i = m_link_ptr_vector.begin();
@ -150,26 +149,19 @@ GarnetNetwork_d::reset()
void void
GarnetNetwork_d::makeInLink(NodeID src, SwitchID dest, BasicLink* link, GarnetNetwork_d::makeInLink(NodeID src, SwitchID dest, BasicLink* link,
LinkDirection direction, LinkDirection direction,
const NetDest& routing_table_entry, const NetDest& routing_table_entry)
bool isReconfiguration)
{ {
assert(src < m_nodes); assert(src < m_nodes);
GarnetExtLink_d* garnet_link = safe_cast<GarnetExtLink_d*>(link); 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];
if (!isReconfiguration) { m_link_ptr_vector.push_back(net_link);
NetworkLink_d* net_link = garnet_link->m_network_links[direction]; m_creditlink_ptr_vector.push_back(credit_link);
CreditLink_d* credit_link = garnet_link->m_credit_links[direction];
m_link_ptr_vector.push_back(net_link); m_router_ptr_vector[dest]->addInPort(net_link, credit_link);
m_creditlink_ptr_vector.push_back(credit_link); m_ni_ptr_vector[src]->addOutPort(net_link, credit_link);
m_router_ptr_vector[dest]->addInPort(net_link, credit_link);
m_ni_ptr_vector[src]->addOutPort(net_link, credit_link);
} else {
panic("Fatal Error:: Reconfiguration not allowed here");
// do nothing
}
} }
/* /*
@ -181,30 +173,22 @@ GarnetNetwork_d::makeInLink(NodeID src, SwitchID dest, BasicLink* link,
void void
GarnetNetwork_d::makeOutLink(SwitchID src, NodeID dest, BasicLink* link, GarnetNetwork_d::makeOutLink(SwitchID src, NodeID dest, BasicLink* link,
LinkDirection direction, LinkDirection direction,
const NetDest& routing_table_entry, const NetDest& routing_table_entry)
bool isReconfiguration)
{ {
assert(dest < m_nodes); assert(dest < m_nodes);
assert(src < m_router_ptr_vector.size()); assert(src < m_router_ptr_vector.size());
assert(m_router_ptr_vector[src] != NULL); assert(m_router_ptr_vector[src] != NULL);
GarnetExtLink_d* garnet_link = safe_cast<GarnetExtLink_d*>(link); 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];
if (!isReconfiguration) { m_link_ptr_vector.push_back(net_link);
NetworkLink_d* net_link = garnet_link->m_network_links[direction]; m_creditlink_ptr_vector.push_back(credit_link);
CreditLink_d* credit_link = garnet_link->m_credit_links[direction];
m_link_ptr_vector.push_back(net_link); m_router_ptr_vector[src]->addOutPort(net_link, routing_table_entry,
m_creditlink_ptr_vector.push_back(credit_link); link->m_weight, credit_link);
m_ni_ptr_vector[dest]->addInPort(net_link, credit_link);
m_router_ptr_vector[src]->addOutPort(net_link, routing_table_entry,
link->m_weight,
credit_link);
m_ni_ptr_vector[dest]->addInPort(net_link, credit_link);
} else {
fatal("Fatal Error:: Reconfiguration not allowed here");
// do nothing
}
} }
/* /*
@ -214,26 +198,18 @@ GarnetNetwork_d::makeOutLink(SwitchID src, NodeID dest, BasicLink* link,
void void
GarnetNetwork_d::makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link, GarnetNetwork_d::makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
LinkDirection direction, LinkDirection direction,
const NetDest& routing_table_entry, const NetDest& routing_table_entry)
bool isReconfiguration)
{ {
GarnetIntLink_d* garnet_link = safe_cast<GarnetIntLink_d*>(link); 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];
if (!isReconfiguration) { m_link_ptr_vector.push_back(net_link);
NetworkLink_d* net_link = garnet_link->m_network_links[direction]; m_creditlink_ptr_vector.push_back(credit_link);
CreditLink_d* credit_link = garnet_link->m_credit_links[direction];
m_link_ptr_vector.push_back(net_link); m_router_ptr_vector[dest]->addInPort(net_link, credit_link);
m_creditlink_ptr_vector.push_back(credit_link); m_router_ptr_vector[src]->addOutPort(net_link, routing_table_entry,
link->m_weight, credit_link);
m_router_ptr_vector[dest]->addInPort(net_link, credit_link);
m_router_ptr_vector[src]->addOutPort(net_link, routing_table_entry,
link->m_weight,
credit_link);
} else {
fatal("Fatal Error:: Reconfiguration not allowed here");
// do nothing
}
} }
void void

View file

@ -79,16 +79,13 @@ class GarnetNetwork_d : public BaseGarnetNetwork
// Methods used by Topology to setup the network // Methods used by Topology to setup the network
void makeOutLink(SwitchID src, NodeID dest, BasicLink* link, void makeOutLink(SwitchID src, NodeID dest, BasicLink* link,
LinkDirection direction, LinkDirection direction,
const NetDest& routing_table_entry, const NetDest& routing_table_entry);
bool isReconfiguration);
void makeInLink(NodeID src, SwitchID dest, BasicLink* link, void makeInLink(NodeID src, SwitchID dest, BasicLink* link,
LinkDirection direction, LinkDirection direction,
const NetDest& routing_table_entry, const NetDest& routing_table_entry);
bool isReconfiguration);
void makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link, void makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
LinkDirection direction, LinkDirection direction,
const NetDest& routing_table_entry, const NetDest& routing_table_entry);
bool isReconfiguration);
//! Function for performing a functional write. The return value //! Function for performing a functional write. The return value
//! indicates the number of messages that were written. //! indicates the number of messages that were written.

View file

@ -82,8 +82,7 @@ GarnetNetwork::init()
m_ni_ptr_vector.push_back(ni); m_ni_ptr_vector.push_back(ni);
} }
// false because this isn't a reconfiguration : m_topology_ptr->createLinks(this);
m_topology_ptr->createLinks(this, false);
} }
GarnetNetwork::~GarnetNetwork() GarnetNetwork::~GarnetNetwork()
@ -112,69 +111,51 @@ GarnetNetwork::reset()
void void
GarnetNetwork::makeInLink(NodeID src, SwitchID dest, BasicLink* link, GarnetNetwork::makeInLink(NodeID src, SwitchID dest, BasicLink* link,
LinkDirection direction, LinkDirection direction,
const NetDest& routing_table_entry, const NetDest& routing_table_entry)
bool isReconfiguration)
{ {
assert(src < m_nodes); assert(src < m_nodes);
GarnetExtLink* garnet_link = safe_cast<GarnetExtLink*>(link); GarnetExtLink* garnet_link = safe_cast<GarnetExtLink*>(link);
NetworkLink *net_link = garnet_link->m_network_links[direction];
if (!isReconfiguration) { net_link->init_net_ptr(this);
NetworkLink *net_link = garnet_link->m_network_links[direction]; m_link_ptr_vector.push_back(net_link);
net_link->init_net_ptr(this); m_router_ptr_vector[dest]->addInPort(net_link);
m_link_ptr_vector.push_back(net_link); m_ni_ptr_vector[src]->addOutPort(net_link);
m_router_ptr_vector[dest]->addInPort(net_link);
m_ni_ptr_vector[src]->addOutPort(net_link);
} else {
fatal("Fatal Error:: Reconfiguration not allowed here");
// do nothing
}
} }
void void
GarnetNetwork::makeOutLink(SwitchID src, NodeID dest, BasicLink* link, GarnetNetwork::makeOutLink(SwitchID src, NodeID dest, BasicLink* link,
LinkDirection direction, LinkDirection direction,
const NetDest& routing_table_entry, const NetDest& routing_table_entry)
bool isReconfiguration)
{ {
assert(dest < m_nodes); assert(dest < m_nodes);
assert(src < m_router_ptr_vector.size()); assert(src < m_router_ptr_vector.size());
assert(m_router_ptr_vector[src] != NULL); assert(m_router_ptr_vector[src] != NULL);
GarnetExtLink* garnet_link = safe_cast<GarnetExtLink*>(link); GarnetExtLink* garnet_link = safe_cast<GarnetExtLink*>(link);
NetworkLink *net_link = garnet_link->m_network_links[direction];
if (!isReconfiguration) { net_link->init_net_ptr(this);
NetworkLink *net_link = garnet_link->m_network_links[direction]; m_link_ptr_vector.push_back(net_link);
net_link->init_net_ptr(this); m_router_ptr_vector[src]->addOutPort(net_link, routing_table_entry,
m_link_ptr_vector.push_back(net_link); link->m_weight);
m_router_ptr_vector[src]->addOutPort(net_link, routing_table_entry, m_ni_ptr_vector[dest]->addInPort(net_link);
link->m_weight);
m_ni_ptr_vector[dest]->addInPort(net_link);
} else {
fatal("Fatal Error:: Reconfiguration not allowed here");
//do nothing
}
} }
void void
GarnetNetwork::makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link, GarnetNetwork::makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
LinkDirection direction, LinkDirection direction,
const NetDest& routing_table_entry, const NetDest& routing_table_entry)
bool isReconfiguration)
{ {
GarnetIntLink* garnet_link = safe_cast<GarnetIntLink*>(link); GarnetIntLink* garnet_link = safe_cast<GarnetIntLink*>(link);
NetworkLink *net_link = garnet_link->m_network_links[direction];
if (!isReconfiguration) { net_link->init_net_ptr(this);
NetworkLink *net_link = garnet_link->m_network_links[direction]; m_link_ptr_vector.push_back(net_link);
net_link->init_net_ptr(this); m_router_ptr_vector[dest]->addInPort(net_link);
m_link_ptr_vector.push_back(net_link); m_router_ptr_vector[src]->addOutPort(net_link, routing_table_entry,
m_router_ptr_vector[dest]->addInPort(net_link); link->m_weight);
m_router_ptr_vector[src]->addOutPort(net_link, routing_table_entry,
link->m_weight);
} else {
fatal("Fatal Error:: Reconfiguration not allowed here");
// do nothing
}
} }

View file

@ -70,16 +70,13 @@ class GarnetNetwork : public BaseGarnetNetwork
// Methods used by Topology to setup the network // Methods used by Topology to setup the network
void makeOutLink(SwitchID src, NodeID dest, BasicLink* link, void makeOutLink(SwitchID src, NodeID dest, BasicLink* link,
LinkDirection direction, LinkDirection direction,
const NetDest& routing_table_entry, const NetDest& routing_table_entry);
bool isReconfiguration);
void makeInLink(NodeID src, SwitchID dest, BasicLink* link, void makeInLink(NodeID src, SwitchID dest, BasicLink* link,
LinkDirection direction, LinkDirection direction,
const NetDest& routing_table_entry, const NetDest& routing_table_entry);
bool isReconfiguration);
void makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link, void makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
LinkDirection direction, LinkDirection direction,
const NetDest& routing_table_entry, const NetDest& routing_table_entry);
bool isReconfiguration);
//! Function for performing a functional read. The return value //! Function for performing a functional read. The return value
//! indicates if a message was found that had the required address. //! indicates if a message was found that had the required address.

View file

@ -96,8 +96,7 @@ SimpleNetwork::init()
// The topology pointer should have already been initialized in // The topology pointer should have already been initialized in
// the parent class network constructor. // the parent class network constructor.
assert(m_topology_ptr != NULL); assert(m_topology_ptr != NULL);
// false because this isn't a reconfiguration m_topology_ptr->createLinks(this);
m_topology_ptr->createLinks(this, false);
} }
void void
@ -130,18 +129,12 @@ SimpleNetwork::~SimpleNetwork()
void void
SimpleNetwork::makeOutLink(SwitchID src, NodeID dest, BasicLink* link, SimpleNetwork::makeOutLink(SwitchID src, NodeID dest, BasicLink* link,
LinkDirection direction, LinkDirection direction,
const NetDest& routing_table_entry, const NetDest& routing_table_entry)
bool isReconfiguration)
{ {
assert(dest < m_nodes); assert(dest < m_nodes);
assert(src < m_switch_ptr_vector.size()); assert(src < m_switch_ptr_vector.size());
assert(m_switch_ptr_vector[src] != NULL); assert(m_switch_ptr_vector[src] != NULL);
if (isReconfiguration) {
m_switch_ptr_vector[src]->reconfigureOutPort(routing_table_entry);
return;
}
SimpleExtLink *simple_link = safe_cast<SimpleExtLink*>(link); SimpleExtLink *simple_link = safe_cast<SimpleExtLink*>(link);
m_switch_ptr_vector[src]->addOutPort(m_fromNetQueues[dest], m_switch_ptr_vector[src]->addOutPort(m_fromNetQueues[dest],
@ -156,15 +149,9 @@ SimpleNetwork::makeOutLink(SwitchID src, NodeID dest, BasicLink* link,
void void
SimpleNetwork::makeInLink(NodeID src, SwitchID dest, BasicLink* link, SimpleNetwork::makeInLink(NodeID src, SwitchID dest, BasicLink* link,
LinkDirection direction, LinkDirection direction,
const NetDest& routing_table_entry, const NetDest& routing_table_entry)
bool isReconfiguration)
{ {
assert(src < m_nodes); assert(src < m_nodes);
if (isReconfiguration) {
// do nothing
return;
}
m_switch_ptr_vector[dest]->addInPort(m_toNetQueues[src]); m_switch_ptr_vector[dest]->addInPort(m_toNetQueues[src]);
} }
@ -172,14 +159,8 @@ SimpleNetwork::makeInLink(NodeID src, SwitchID dest, BasicLink* link,
void void
SimpleNetwork::makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link, SimpleNetwork::makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
LinkDirection direction, LinkDirection direction,
const NetDest& routing_table_entry, const NetDest& routing_table_entry)
bool isReconfiguration)
{ {
if (isReconfiguration) {
m_switch_ptr_vector[src]->reconfigureOutPort(routing_table_entry);
return;
}
// Create a set of new MessageBuffers // Create a set of new MessageBuffers
std::vector<MessageBuffer*> queues; std::vector<MessageBuffer*> queues;
for (int i = 0; i < m_virtual_networks; i++) { for (int i = 0; i < m_virtual_networks; i++) {

View file

@ -73,16 +73,13 @@ class SimpleNetwork : public Network
// Methods used by Topology to setup the network // Methods used by Topology to setup the network
void makeOutLink(SwitchID src, NodeID dest, BasicLink* link, void makeOutLink(SwitchID src, NodeID dest, BasicLink* link,
LinkDirection direction, LinkDirection direction,
const NetDest& routing_table_entry, const NetDest& routing_table_entry);
bool isReconfiguration); void makeInLink(NodeID src, SwitchID dest, BasicLink* link,
void makeInLink(NodeID src, SwitchID dest, BasicLink* link,
LinkDirection direction, LinkDirection direction,
const NetDest& routing_table_entry, const NetDest& routing_table_entry);
bool isReconfiguration);
void makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link, void makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
LinkDirection direction, LinkDirection direction,
const NetDest& routing_table_entry, const NetDest& routing_table_entry);
bool isReconfiguration);
void print(std::ostream& out) const; void print(std::ostream& out) const;