ruby: network: drop member m_in_use
This member indicates whether or not a particular virtual network is in use. Instead of having a default big value for the number of virtual networks and then checking whether a virtual network is in use, the next patch removes the default value and the protocol configuration file would now specify the number of virtual networks it requires. Additionally, the patch also refactors some of the code used for computing the virtual channel next in the round robin order.
This commit is contained in:
parent
7175db4a3f
commit
bf8ae288fa
11 changed files with 20 additions and 57 deletions
|
@ -57,11 +57,9 @@ Network::Network(const Params *p)
|
||||||
// Queues that are feeding the protocol
|
// Queues that are feeding the protocol
|
||||||
m_fromNetQueues.resize(m_nodes);
|
m_fromNetQueues.resize(m_nodes);
|
||||||
|
|
||||||
m_in_use.resize(m_virtual_networks);
|
|
||||||
m_ordered.resize(m_virtual_networks);
|
m_ordered.resize(m_virtual_networks);
|
||||||
|
|
||||||
for (int i = 0; i < m_virtual_networks; i++) {
|
for (int i = 0; i < m_virtual_networks; i++) {
|
||||||
m_in_use[i] = false;
|
|
||||||
m_ordered[i] = false;
|
m_ordered[i] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -114,8 +114,6 @@ class Network : public ClockedObject
|
||||||
// vector of queues from the components
|
// vector of queues from the components
|
||||||
std::vector<std::vector<MessageBuffer*> > m_toNetQueues;
|
std::vector<std::vector<MessageBuffer*> > m_toNetQueues;
|
||||||
std::vector<std::vector<MessageBuffer*> > m_fromNetQueues;
|
std::vector<std::vector<MessageBuffer*> > m_fromNetQueues;
|
||||||
|
|
||||||
std::vector<bool> m_in_use;
|
|
||||||
std::vector<bool> m_ordered;
|
std::vector<bool> m_ordered;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -74,8 +74,7 @@ class BaseGarnetNetwork : public Network
|
||||||
void setFromNetQueue(NodeID id, bool ordered, int network_num,
|
void setFromNetQueue(NodeID id, bool ordered, int network_num,
|
||||||
std::string vnet_type, MessageBuffer *b);
|
std::string vnet_type, MessageBuffer *b);
|
||||||
|
|
||||||
bool isVNetOrdered(int vnet) { return m_ordered[vnet]; }
|
bool isVNetOrdered(int vnet) const { return m_ordered[vnet]; }
|
||||||
bool validVirtualNetwork(int vnet) { return m_in_use[vnet]; }
|
|
||||||
virtual void checkNetworkAllocation(NodeID id, bool ordered,
|
virtual void checkNetworkAllocation(NodeID id, bool ordered,
|
||||||
int network_num, std::string vnet_type) = 0;
|
int network_num, std::string vnet_type) = 0;
|
||||||
|
|
||||||
|
|
|
@ -189,8 +189,7 @@ GarnetNetwork_d::makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
|
||||||
|
|
||||||
void
|
void
|
||||||
GarnetNetwork_d::checkNetworkAllocation(NodeID id, bool ordered,
|
GarnetNetwork_d::checkNetworkAllocation(NodeID id, bool ordered,
|
||||||
int network_num,
|
int network_num, string vnet_type)
|
||||||
string vnet_type)
|
|
||||||
{
|
{
|
||||||
assert(id < m_nodes);
|
assert(id < m_nodes);
|
||||||
assert(network_num < m_virtual_networks);
|
assert(network_num < m_virtual_networks);
|
||||||
|
@ -198,7 +197,6 @@ GarnetNetwork_d::checkNetworkAllocation(NodeID id, bool ordered,
|
||||||
if (ordered) {
|
if (ordered) {
|
||||||
m_ordered[network_num] = true;
|
m_ordered[network_num] = true;
|
||||||
}
|
}
|
||||||
m_in_use[network_num] = true;
|
|
||||||
|
|
||||||
if (vnet_type == "response")
|
if (vnet_type == "response")
|
||||||
m_vnet_type[network_num] = DATA_VNET_; // carries data (and ctrl) packets
|
m_vnet_type[network_num] = DATA_VNET_; // carries data (and ctrl) packets
|
||||||
|
|
|
@ -95,14 +95,9 @@ SWallocator_d::arbitrate_inports()
|
||||||
|
|
||||||
// Select next round robin vc candidate within valid vnet
|
// Select next round robin vc candidate within valid vnet
|
||||||
int next_round_robin_invc = invc;
|
int next_round_robin_invc = invc;
|
||||||
do {
|
next_round_robin_invc++;
|
||||||
next_round_robin_invc++;
|
if (next_round_robin_invc >= m_num_vcs)
|
||||||
|
next_round_robin_invc = 0;
|
||||||
if (next_round_robin_invc >= m_num_vcs)
|
|
||||||
next_round_robin_invc = 0;
|
|
||||||
} while (!((m_router->get_net_ptr())->validVirtualNetwork(
|
|
||||||
get_vnet(next_round_robin_invc))));
|
|
||||||
|
|
||||||
m_round_robin_inport[inport] = next_round_robin_invc;
|
m_round_robin_inport[inport] = next_round_robin_invc;
|
||||||
|
|
||||||
for (int invc_iter = 0; invc_iter < m_num_vcs; invc_iter++) {
|
for (int invc_iter = 0; invc_iter < m_num_vcs; invc_iter++) {
|
||||||
|
@ -110,10 +105,6 @@ SWallocator_d::arbitrate_inports()
|
||||||
if (invc >= m_num_vcs)
|
if (invc >= m_num_vcs)
|
||||||
invc = 0;
|
invc = 0;
|
||||||
|
|
||||||
if (!((m_router->get_net_ptr())->validVirtualNetwork(
|
|
||||||
get_vnet(invc))))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (m_input_unit[inport]->need_stage(invc, ACTIVE_, SA_,
|
if (m_input_unit[inport]->need_stage(invc, ACTIVE_, SA_,
|
||||||
m_router->curCycle()) &&
|
m_router->curCycle()) &&
|
||||||
m_input_unit[inport]->has_credits(invc)) {
|
m_input_unit[inport]->has_credits(invc)) {
|
||||||
|
|
|
@ -180,10 +180,6 @@ VCallocator_d::arbitrate_invcs()
|
||||||
{
|
{
|
||||||
for (int inport_iter = 0; inport_iter < m_num_inports; inport_iter++) {
|
for (int inport_iter = 0; inport_iter < m_num_inports; inport_iter++) {
|
||||||
for (int invc_iter = 0; invc_iter < m_num_vcs; invc_iter++) {
|
for (int invc_iter = 0; invc_iter < m_num_vcs; invc_iter++) {
|
||||||
if (!((m_router->get_net_ptr())->validVirtualNetwork(
|
|
||||||
get_vnet(invc_iter))))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (m_input_unit[inport_iter]->need_stage(invc_iter, VC_AB_,
|
if (m_input_unit[inport_iter]->need_stage(invc_iter, VC_AB_,
|
||||||
VA_, m_router->curCycle())) {
|
VA_, m_router->curCycle())) {
|
||||||
if (!is_invc_candidate(inport_iter, invc_iter))
|
if (!is_invc_candidate(inport_iter, invc_iter))
|
||||||
|
|
|
@ -153,7 +153,6 @@ GarnetNetwork::checkNetworkAllocation(NodeID id, bool ordered,
|
||||||
if (ordered) {
|
if (ordered) {
|
||||||
m_ordered[network_num] = true;
|
m_ordered[network_num] = true;
|
||||||
}
|
}
|
||||||
m_in_use[network_num] = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -157,27 +157,13 @@ Router::vc_arbitrate()
|
||||||
if (inport >= m_in_link.size())
|
if (inport >= m_in_link.size())
|
||||||
inport = 0;
|
inport = 0;
|
||||||
int invc = m_round_robin_invc[inport];
|
int invc = m_round_robin_invc[inport];
|
||||||
|
m_round_robin_invc[inport] = get_next_round_robin_vc(invc);
|
||||||
int next_round_robin_invc = invc;
|
|
||||||
do {
|
|
||||||
next_round_robin_invc++;
|
|
||||||
|
|
||||||
if (next_round_robin_invc >= m_num_vcs)
|
|
||||||
next_round_robin_invc = 0;
|
|
||||||
|
|
||||||
} while (!(m_net_ptr->validVirtualNetwork(
|
|
||||||
get_vnet(next_round_robin_invc))));
|
|
||||||
|
|
||||||
m_round_robin_invc[inport] = next_round_robin_invc;
|
|
||||||
|
|
||||||
for (int vc_iter = 0; vc_iter < m_num_vcs; vc_iter++) {
|
for (int vc_iter = 0; vc_iter < m_num_vcs; vc_iter++) {
|
||||||
invc++;
|
invc++;
|
||||||
if (invc >= m_num_vcs)
|
if (invc >= m_num_vcs)
|
||||||
invc = 0;
|
invc = 0;
|
||||||
|
|
||||||
if (!(m_net_ptr->validVirtualNetwork(get_vnet(invc))))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
InVcState *in_vc_state = m_in_vc_state[inport][invc];
|
InVcState *in_vc_state = m_in_vc_state[inport][invc];
|
||||||
|
|
||||||
if (in_vc_state->isInState(VC_AB_, curCycle())) {
|
if (in_vc_state->isInState(VC_AB_, curCycle())) {
|
||||||
|
@ -335,17 +321,7 @@ Router::scheduleOutputLinks()
|
||||||
{
|
{
|
||||||
for (int port = 0; port < m_out_link.size(); port++) {
|
for (int port = 0; port < m_out_link.size(); port++) {
|
||||||
int vc_tolookat = m_vc_round_robin[port];
|
int vc_tolookat = m_vc_round_robin[port];
|
||||||
|
m_vc_round_robin[port] = get_next_round_robin_vc(vc_tolookat);
|
||||||
int next_round_robin_vc_tolookat = vc_tolookat;
|
|
||||||
do {
|
|
||||||
next_round_robin_vc_tolookat++;
|
|
||||||
|
|
||||||
if (next_round_robin_vc_tolookat == m_num_vcs)
|
|
||||||
next_round_robin_vc_tolookat = 0;
|
|
||||||
} while (!(m_net_ptr->validVirtualNetwork(
|
|
||||||
get_vnet(next_round_robin_vc_tolookat))));
|
|
||||||
|
|
||||||
m_vc_round_robin[port] = next_round_robin_vc_tolookat;
|
|
||||||
|
|
||||||
for (int i = 0; i < m_num_vcs; i++) {
|
for (int i = 0; i < m_num_vcs; i++) {
|
||||||
vc_tolookat++;
|
vc_tolookat++;
|
||||||
|
@ -374,13 +350,22 @@ Router::scheduleOutputLinks()
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
Router::get_vnet(int vc)
|
Router::get_vnet(int vc) const
|
||||||
{
|
{
|
||||||
int vnet = vc/m_vc_per_vnet;
|
int vnet = vc/m_vc_per_vnet;
|
||||||
assert(vnet < m_virtual_networks);
|
assert(vnet < m_virtual_networks);
|
||||||
return vnet;
|
return vnet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
Router::get_next_round_robin_vc(int vc) const
|
||||||
|
{
|
||||||
|
vc++;
|
||||||
|
if (vc == m_num_vcs)
|
||||||
|
vc = 0;
|
||||||
|
return vc;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Router::checkReschedule()
|
Router::checkReschedule()
|
||||||
{
|
{
|
||||||
|
|
|
@ -65,7 +65,6 @@ class Router : public BasicRouter, public FlexibleConsumer
|
||||||
void grant_vc(int out_port, int vc, Cycles grant_time);
|
void grant_vc(int out_port, int vc, Cycles grant_time);
|
||||||
void release_vc(int out_port, int vc, Cycles release_time);
|
void release_vc(int out_port, int vc, Cycles release_time);
|
||||||
void vc_arbitrate();
|
void vc_arbitrate();
|
||||||
int get_vnet(int vc);
|
|
||||||
|
|
||||||
void print(std::ostream& out) const;
|
void print(std::ostream& out) const;
|
||||||
|
|
||||||
|
@ -104,6 +103,8 @@ class Router : public BasicRouter, public FlexibleConsumer
|
||||||
void checkReschedule();
|
void checkReschedule();
|
||||||
void check_arbiter_reschedule();
|
void check_arbiter_reschedule();
|
||||||
void scheduleOutputLinks();
|
void scheduleOutputLinks();
|
||||||
|
int get_vnet(int vc) const;
|
||||||
|
int get_next_round_robin_vc(int vc) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_ROUTER_HH__
|
#endif // __MEM_RUBY_NETWORK_GARNET_FLEXIBLE_PIPELINE_ROUTER_HH__
|
||||||
|
|
|
@ -148,7 +148,6 @@ SimpleNetwork::checkNetworkAllocation(NodeID id, bool ordered, int network_num)
|
||||||
if (ordered) {
|
if (ordered) {
|
||||||
m_ordered[network_num] = true;
|
m_ordered[network_num] = true;
|
||||||
}
|
}
|
||||||
m_in_use[network_num] = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -62,8 +62,7 @@ class SimpleNetwork : public Network
|
||||||
void setFromNetQueue(NodeID id, bool ordered, int network_num,
|
void setFromNetQueue(NodeID id, bool ordered, int network_num,
|
||||||
std::string vnet_type, MessageBuffer *b);
|
std::string vnet_type, MessageBuffer *b);
|
||||||
|
|
||||||
bool isVNetOrdered(int vnet) { return m_ordered[vnet]; }
|
bool isVNetOrdered(int vnet) const { return m_ordered[vnet]; }
|
||||||
bool validVirtualNetwork(int vnet) { return m_in_use[vnet]; }
|
|
||||||
|
|
||||||
// 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,
|
||||||
|
|
Loading…
Reference in a new issue