diff --git a/src/mem/ruby/network/Network.hh b/src/mem/ruby/network/Network.hh --- a/src/mem/ruby/network/Network.hh +++ b/src/mem/ruby/network/Network.hh @@ -73,9 +73,12 @@ // returns the queue requested for the given component virtual void setToNetQueue(NodeID id, bool ordered, int netNumber, - std::string vnet_type, MessageBuffer *b) = 0; + std::string vnet_type, MessageBuffer *b); virtual void setFromNetQueue(NodeID id, bool ordered, int netNumber, - std::string vnet_type, MessageBuffer *b) = 0; + std::string vnet_type, MessageBuffer *b); + + 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, @@ -107,6 +110,7 @@ uint32_t m_nodes; static uint32_t m_virtual_networks; + std::vector m_vnet_type_names; Topology* m_topology_ptr; static uint32_t m_control_msg_size; static uint32_t m_data_msg_size; # Node ID d1f176c269162323599ad963c91351722ed0bad2 # Parent 1a9ecb4fe05e86fc7af4e4dcf616412274a3e7cd diff --git a/src/mem/ruby/network/Network.cc b/src/mem/ruby/network/Network.cc --- a/src/mem/ruby/network/Network.cc +++ b/src/mem/ruby/network/Network.cc @@ -58,6 +58,7 @@ m_fromNetQueues.resize(m_nodes); m_ordered.resize(m_virtual_networks); + m_vnet_type_names.resize(m_virtual_networks); for (int i = 0; i < m_virtual_networks; i++) { m_ordered[i] = false; @@ -75,6 +76,10 @@ // Register a callback function for combining the statistics Stats::registerDumpCallback(new StatsCallback(this)); + + for (auto &it : dynamic_cast(this)->params()->ext_links) { + it->params()->ext_node->initNetQueues(); + } } Network::~Network() @@ -128,3 +133,41 @@ break; } } + +void +Network::checkNetworkAllocation(NodeID id, bool ordered, + int network_num, + std::string vnet_type) +{ + fatal_if(id >= m_nodes, "Node ID is out of range"); + fatal_if(network_num >= m_virtual_networks, "Network id is out of range"); + + if (ordered) { + m_ordered[network_num] = true; + } + + m_vnet_type_names[network_num] = vnet_type; +} + + +void +Network::setToNetQueue(NodeID id, bool ordered, int network_num, + std::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 +Network::setFromNetQueue(NodeID id, bool ordered, int network_num, + std::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; +} diff --git a/src/mem/ruby/network/garnet/BaseGarnetNetwork.hh b/src/mem/ruby/network/garnet/BaseGarnetNetwork.hh --- a/src/mem/ruby/network/garnet/BaseGarnetNetwork.hh +++ b/src/mem/ruby/network/garnet/BaseGarnetNetwork.hh @@ -68,15 +68,7 @@ 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/BaseGarnetNetwork.cc b/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc --- a/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc +++ b/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc @@ -67,28 +67,6 @@ } 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/fixed-pipeline/GarnetNetwork_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh --- 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 @@ 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/fixed-pipeline/GarnetNetwork_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc --- 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 @@ 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 @@ } 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/flexible-pipeline/GarnetNetwork.hh b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh --- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh +++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh @@ -79,9 +79,6 @@ 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); diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc --- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc +++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc @@ -143,18 +143,6 @@ 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/simple/SimpleNetwork.hh b/src/mem/ruby/network/simple/SimpleNetwork.hh --- a/src/mem/ruby/network/simple/SimpleNetwork.hh +++ b/src/mem/ruby/network/simple/SimpleNetwork.hh @@ -56,12 +56,6 @@ void collateStats(); void regStats(); - // sets the queue requested - 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]; } // Methods used by Topology to setup the network @@ -81,7 +75,6 @@ uint32_t functionalWrite(Packet *pkt); private: - void checkNetworkAllocation(NodeID id, bool ordered, int network_num); void addLink(SwitchID src, SwitchID dest, int link_latency); void makeLink(SwitchID src, SwitchID dest, const NetDest& routing_table_entry, int link_latency); diff --git a/src/mem/ruby/network/simple/SimpleNetwork.cc b/src/mem/ruby/network/simple/SimpleNetwork.cc --- a/src/mem/ruby/network/simple/SimpleNetwork.cc +++ b/src/mem/ruby/network/simple/SimpleNetwork.cc @@ -140,39 +140,6 @@ } void -SimpleNetwork::checkNetworkAllocation(NodeID id, bool ordered, int network_num) -{ - assert(id < m_nodes); - assert(network_num < m_virtual_networks); - - if (ordered) { - m_ordered[network_num] = true; - } -} - -void -SimpleNetwork::setToNetQueue(NodeID id, bool ordered, int network_num, - std::string vnet_type, MessageBuffer *b) -{ - checkNetworkAllocation(id, ordered, network_num); - while (m_toNetQueues[id].size() <= network_num) { - m_toNetQueues[id].push_back(nullptr); - } - m_toNetQueues[id][network_num] = b; -} - -void -SimpleNetwork::setFromNetQueue(NodeID id, bool ordered, int network_num, - std::string vnet_type, MessageBuffer *b) -{ - checkNetworkAllocation(id, ordered, network_num); - while (m_fromNetQueues[id].size() <= network_num) { - m_fromNetQueues[id].push_back(nullptr); - } - m_fromNetQueues[id][network_num] = b; -} - -void SimpleNetwork::regStats() { for (MessageSizeType type = MessageSizeType_FIRST; diff --git a/src/mem/slicc/symbols/StateMachine.py b/src/mem/slicc/symbols/StateMachine.py --- a/src/mem/slicc/symbols/StateMachine.py +++ b/src/mem/slicc/symbols/StateMachine.py @@ -296,7 +296,7 @@ MessageBuffer *getMandatoryQueue() const; MessageBuffer *getMemoryQueue() const; - void initNetQueues(); + virtual void initNetQueues(); void print(std::ostream& out) const; void wakeup(); @@ -606,7 +606,6 @@ $c_ident::init() { // initialize objects - initNetQueues(); ''') code.indent()