From c9e4bca8d8deea063a09bf852b0d37dc129bc227 Mon Sep 17 00:00:00 2001 From: Tushar Krishna Date: Mon, 19 Mar 2012 17:34:17 -0400 Subject: Garnet: Stats at vnet granularity + code cleanup This patch (1) Moves redundant code from fixed and flexible networks to BaseGarnetNetwork. (2) Prints network stats at vnet granularity. --- .../garnet/flexible-pipeline/GarnetNetwork.cc | 72 ++++++---------------- .../garnet/flexible-pipeline/GarnetNetwork.hh | 38 +++--------- .../garnet/flexible-pipeline/NetworkInterface.cc | 9 +-- 3 files changed, 32 insertions(+), 87 deletions(-) (limited to 'src/mem/ruby/network/garnet/flexible-pipeline') diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc index 4fc2662ba..020792a21 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc +++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc @@ -181,7 +181,7 @@ GarnetNetwork::makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link, void GarnetNetwork::checkNetworkAllocation(NodeID id, bool ordered, - int network_num) + int network_num, std::string vnet_type) { assert(id < m_nodes); assert(network_num < m_virtual_networks); @@ -192,36 +192,8 @@ GarnetNetwork::checkNetworkAllocation(NodeID id, bool ordered, m_in_use[network_num] = true; } -MessageBuffer* -GarnetNetwork::getToNetQueue(NodeID id, bool ordered, int network_num, - std::string vnet_type) -{ - checkNetworkAllocation(id, ordered, network_num); - return m_toNetQueues[id][network_num]; -} - -MessageBuffer* -GarnetNetwork::getFromNetQueue(NodeID id, bool ordered, int network_num, - std::string vnet_type) -{ - checkNetworkAllocation(id, ordered, network_num); - return m_fromNetQueues[id][network_num]; -} - -void -GarnetNetwork::clearStats() -{ - m_ruby_start = g_eventQueue_ptr->getTime(); -} - -Time -GarnetNetwork::getRubyStartTime() -{ - return m_ruby_start; -} - void -GarnetNetwork::printStats(ostream& out) const +GarnetNetwork::printLinkStats(ostream& out) const { double average_link_utilization = 0; vector average_vc_load; @@ -231,13 +203,12 @@ GarnetNetwork::printStats(ostream& out) const average_vc_load[i] = 0; } - out << endl; - out << "Network Stats" << endl; - out << "-------------" << endl; out << endl; for (int i = 0; i < m_link_ptr_vector.size(); i++) { average_link_utilization += - m_link_ptr_vector[i]->getLinkUtilization(); + (double(m_link_ptr_vector[i]->getLinkUtilization())) / + (double(g_eventQueue_ptr->getTime()-m_ruby_start)); + vector vc_load = m_link_ptr_vector[i]->getVcLoad(); for (int j = 0; j < vc_load.size(); j++) { assert(vc_load.size() == m_vcs_per_vnet*m_virtual_networks); @@ -246,8 +217,8 @@ GarnetNetwork::printStats(ostream& out) const } average_link_utilization = average_link_utilization/m_link_ptr_vector.size(); - out << "Average Link Utilization :: " << average_link_utilization << - " flits/cycle" <getTime()) - m_ruby_start)); - out << "Average VC Load [" << i << "] = " << average_vc_load[i] << - " flits/cycle" << endl; + out << "Average VC Load [" << i << "] = " << average_vc_load[i] + << " flits/cycle " << endl; } out << "-------------" << endl; + out << endl; +} - out << "Total flits injected = " << m_flits_injected << endl; - out << "Total flits received = " << m_flits_received << endl; - out << "Average network latency = " - << ((double) m_network_latency/ (double) m_flits_received)<< endl; - out << "Average queueing (at source NI) latency = " - << ((double) m_queueing_latency/ (double) m_flits_received)<< endl; - out << "Average latency = " - << ((double) (m_queueing_latency + m_network_latency) / - (double) m_flits_received)<< endl; +void +GarnetNetwork::printPowerStats(ostream& out) const +{ + out << "Network Power" << endl; out << "-------------" << endl; - - m_topology_ptr->printStats(out); + out << "Orion does not work with flexible pipeline" << endl; + out << endl; } void @@ -281,7 +249,7 @@ GarnetNetwork::printConfig(ostream& out) const out << endl; out << "Network Configuration" << endl; out << "---------------------" << endl; - out << "network: GARNET_NETWORK" << endl; + out << "network: Garnet Flexible Pipeline" << endl; out << "topology: " << m_topology_ptr->getName() << endl; out << endl; @@ -291,10 +259,10 @@ GarnetNetwork::printConfig(ostream& out) const out << "active, "; if (m_ordered[i]) { out << "ordered" << endl; - } else { + } else { out << "unordered" << endl; } - } else { + } else { out << "inactive" << endl; } } diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh index 5c7959131..fe29ef960 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh +++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh @@ -59,40 +59,15 @@ class GarnetNetwork : public BaseGarnetNetwork int getBufferSize() { return m_buffer_size; } int getNumPipeStages() {return m_number_of_pipe_stages; } - // returns the queue requested for the given component - MessageBuffer* getToNetQueue(NodeID id, bool ordered, int network_num, - std::string vnet_type); - MessageBuffer* getFromNetQueue(NodeID id, bool ordered, int network_num, - std::string vnet_type); - - void clearStats(); - void printStats(std::ostream& out) const; - void printConfig(std::ostream& out) const; - void print(std::ostream& out) const; - - inline void increment_injected_flits() { m_flits_injected++; } - inline void increment_received_flits() { m_flits_received++; } - - inline void - increment_network_latency(Time latency) - { - m_network_latency += latency; - } - - inline void - increment_queueing_latency(Time latency) - { - m_queueing_latency += latency; - } - - bool isVNetOrdered(int vnet) { return m_ordered[vnet]; } - bool validVirtualNetwork(int vnet) { return m_in_use[vnet]; } - - Time getRubyStartTime(); int getNumNodes(){ return m_nodes; } void reset(); + void printLinkStats(std::ostream& out) const; + void printPowerStats(std::ostream& out) const; + void printConfig(std::ostream& out) const; + void print(std::ostream& out) const; + // Methods used by Topology to setup the network void makeOutLink(SwitchID src, NodeID dest, BasicLink* link, LinkDirection direction, @@ -108,7 +83,8 @@ class GarnetNetwork : public BaseGarnetNetwork bool isReconfiguration); private: - void checkNetworkAllocation(NodeID id, bool ordered, int network_num); + 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/NetworkInterface.cc b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc index b38e2b1d6..07a58de58 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc +++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc @@ -164,7 +164,7 @@ NetworkInterface::flitisizeMessage(MsgPtr msg_ptr, int vnet) net_msg_ptr->getInternalDestination().removeNetDest(personal_dest); } for (int i = 0; i < num_flits; i++) { - m_net_ptr->increment_injected_flits(); + m_net_ptr->increment_injected_flits(vnet); flit *fl = new flit(i, vc, vnet, num_flits, new_msg_ptr); fl->set_delay(g_eventQueue_ptr->getTime() - msg_ptr->getTime()); m_ni_buffers[vc]->insert(fl); @@ -273,12 +273,13 @@ NetworkInterface::wakeup() inNetLink->release_vc_link(t_flit->get_vc(), g_eventQueue_ptr->getTime() + 1); } - m_net_ptr->increment_received_flits(); + int vnet = t_flit->get_vnet(); + m_net_ptr->increment_received_flits(vnet); int network_delay = g_eventQueue_ptr->getTime() - t_flit->get_enqueue_time(); int queueing_delay = t_flit->get_delay(); - m_net_ptr->increment_network_latency(network_delay); - m_net_ptr->increment_queueing_latency(queueing_delay); + m_net_ptr->increment_network_latency(network_delay, vnet); + m_net_ptr->increment_queueing_latency(queueing_delay, vnet); delete t_flit; } } -- cgit v1.2.3