diff options
author | Joe Gross <joe.gross@amd.com> | 2015-09-16 13:10:42 -0400 |
---|---|---|
committer | Joe Gross <joe.gross@amd.com> | 2015-09-16 13:10:42 -0400 |
commit | 950e431d8766a8cf3b897965c1726e6d2576c6dc (patch) | |
tree | 9fdb60b695b97e276aaec84ed4024a943ddd851e /src/mem/ruby/network/garnet | |
parent | c5058c0c007532c4c2dda5f8e24a92cccc010508 (diff) | |
download | gem5-950e431d8766a8cf3b897965c1726e6d2576c6dc.tar.xz |
ruby: fix message buffer init order
The recent changes to make MessageBuffers SimObjects required them to be
initialized in a particular order, which could break some protocols. Fix this
by calling initNetQueues on the external nodes of each external link in the
constructor of Network.
This patch also refactors the duplicated code for checking network allocation
and setting net queues (which are called by initNetQueues) from the simple and
garnet networks to be in Network.
Diffstat (limited to 'src/mem/ruby/network/garnet')
6 files changed, 7 insertions, 67 deletions
diff --git a/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc b/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc index ed4679c63..1213073e9 100644 --- a/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc +++ b/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc @@ -67,28 +67,6 @@ BaseGarnetNetwork::init() } void -BaseGarnetNetwork::setToNetQueue(NodeID id, bool ordered, int network_num, - string vnet_type, MessageBuffer *b) -{ - checkNetworkAllocation(id, ordered, network_num, vnet_type); - while (m_toNetQueues[id].size() <= network_num) { - m_toNetQueues[id].push_back(nullptr); - } - m_toNetQueues[id][network_num] = b; -} - -void -BaseGarnetNetwork::setFromNetQueue(NodeID id, bool ordered, int network_num, - string vnet_type, MessageBuffer *b) -{ - checkNetworkAllocation(id, ordered, network_num, vnet_type); - while (m_fromNetQueues[id].size() <= network_num) { - m_fromNetQueues[id].push_back(nullptr); - } - m_fromNetQueues[id][network_num] = b; -} - -void BaseGarnetNetwork::regStats() { m_flits_received diff --git a/src/mem/ruby/network/garnet/BaseGarnetNetwork.hh b/src/mem/ruby/network/garnet/BaseGarnetNetwork.hh index e2c843e10..fe2cbacc3 100644 --- a/src/mem/ruby/network/garnet/BaseGarnetNetwork.hh +++ b/src/mem/ruby/network/garnet/BaseGarnetNetwork.hh @@ -68,15 +68,7 @@ class BaseGarnetNetwork : public Network m_queueing_latency[vnet] += latency; } - // set the queue - void setToNetQueue(NodeID id, bool ordered, int network_num, - std::string vnet_type, MessageBuffer *b); - void setFromNetQueue(NodeID id, bool ordered, int network_num, - std::string vnet_type, MessageBuffer *b); - bool isVNetOrdered(int vnet) const { return m_ordered[vnet]; } - virtual void checkNetworkAllocation(NodeID id, bool ordered, - int network_num, std::string vnet_type) = 0; virtual void regStats(); virtual void collateStats() {} diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc index 4d5846f55..f6fe6f586 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc @@ -51,8 +51,13 @@ GarnetNetwork_d::GarnetNetwork_d(const Params *p) m_buffers_per_ctrl_vc = p->buffers_per_ctrl_vc; m_vnet_type.resize(m_virtual_networks); - for (int i = 0; i < m_vnet_type.size(); i++) { - m_vnet_type[i] = NULL_VNET_; // default + + for(int i = 0 ; i < m_virtual_networks ; i++) + { + if (m_vnet_type_names[i] == "response") + m_vnet_type[i] = DATA_VNET_; // carries data (and ctrl) packets + else + m_vnet_type[i] = CTRL_VNET_; // carries only ctrl packets } // record the routers @@ -188,23 +193,6 @@ GarnetNetwork_d::makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link, } void -GarnetNetwork_d::checkNetworkAllocation(NodeID id, bool ordered, - int network_num, string vnet_type) -{ - assert(id < m_nodes); - assert(network_num < m_virtual_networks); - - if (ordered) { - m_ordered[network_num] = true; - } - - if (vnet_type == "response") - m_vnet_type[network_num] = DATA_VNET_; // carries data (and ctrl) packets - else - m_vnet_type[network_num] = CTRL_VNET_; // carries only ctrl packets -} - -void GarnetNetwork_d::regStats() { BaseGarnetNetwork::regStats(); diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh index efd70c3a0..99ecc02da 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh @@ -84,9 +84,6 @@ class GarnetNetwork_d : public BaseGarnetNetwork uint32_t functionalWrite(Packet *pkt); private: - void checkNetworkAllocation(NodeID id, bool ordered, int network_num, - std::string vnet_type); - GarnetNetwork_d(const GarnetNetwork_d& obj); GarnetNetwork_d& operator=(const GarnetNetwork_d& obj); diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc index 83cbe8d51..bd96fc2ed 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc +++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc @@ -143,18 +143,6 @@ GarnetNetwork::makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link, link->m_weight); } -void -GarnetNetwork::checkNetworkAllocation(NodeID id, bool ordered, - int network_num, std::string vnet_type) -{ - assert(id < m_nodes); - assert(network_num < m_virtual_networks); - - if (ordered) { - m_ordered[network_num] = true; - } -} - /* * Go through all the routers, network interfaces and the interconnecting * links for reading/writing all the messages. diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh index 906e7eb3a..46f62c04f 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh +++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh @@ -79,9 +79,6 @@ class GarnetNetwork : public BaseGarnetNetwork uint32_t functionalWrite(Packet *pkt); private: - void checkNetworkAllocation(NodeID id, bool ordered, int network_num, - std::string vnet_type); - GarnetNetwork(const GarnetNetwork& obj); GarnetNetwork& operator=(const GarnetNetwork& obj); |