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/fixed-pipeline/GarnetNetwork_d.cc | 56 ++++------------------ .../garnet/fixed-pipeline/GarnetNetwork_d.hh | 30 +----------- .../garnet/fixed-pipeline/NetworkInterface_d.cc | 9 ++-- 3 files changed, 17 insertions(+), 78 deletions(-) (limited to 'src/mem/ruby/network/garnet/fixed-pipeline') 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 126c5c811..d03a8e125 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc @@ -257,49 +257,17 @@ GarnetNetwork_d::checkNetworkAllocation(NodeID id, bool ordered, m_vnet_type[network_num] = CTRL_VNET_; // carries only ctrl packets } -MessageBuffer* -GarnetNetwork_d::getToNetQueue(NodeID id, bool ordered, int network_num, - string vnet_type) -{ - checkNetworkAllocation(id, ordered, network_num, vnet_type); - return m_toNetQueues[id][network_num]; -} - -MessageBuffer* -GarnetNetwork_d::getFromNetQueue(NodeID id, bool ordered, int network_num, - string vnet_type) -{ - checkNetworkAllocation(id, ordered, network_num, vnet_type); - return m_fromNetQueues[id][network_num]; -} - void -GarnetNetwork_d::clearStats() -{ - m_ruby_start = g_eventQueue_ptr->getTime(); -} - -Time -GarnetNetwork_d::getRubyStartTime() -{ - return m_ruby_start; -} - -void -GarnetNetwork_d::printStats(ostream& out) const +GarnetNetwork_d::printLinkStats(ostream& out) const { double average_link_utilization = 0; vector average_vc_load; average_vc_load.resize(m_virtual_networks*m_vcs_per_vnet); - for (int i = 0; i < m_virtual_networks*m_vcs_per_vnet; i++) - { + for (int i = 0; i < m_virtual_networks*m_vcs_per_vnet; i++) { 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 += @@ -328,18 +296,14 @@ GarnetNetwork_d::printStats(ostream& out) const << " 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_d::printPowerStats(ostream& out) const +{ + out << "Network Power" << endl; out << "-------------" << endl; - double m_total_link_power = 0.0; double m_dynamic_link_power = 0.0; double m_static_link_power = 0.0; @@ -368,7 +332,7 @@ GarnetNetwork_d::printStats(ostream& out) const out << "Router Static Power = " << m_static_router_power << " W" << endl; out << "Total Router Power = " << m_total_router_power << " W " <printStats(out); + out << endl; } void @@ -377,7 +341,7 @@ GarnetNetwork_d::printConfig(ostream& out) const out << endl; out << "Network Configuration" << endl; out << "---------------------" << endl; - out << "network: GarnetNetwork_d" << endl; + out << "network: Garnet Fixed Pipeline" << endl; out << "topology: " << m_topology_ptr->getName() << endl; out << endl; 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 a7fe05a64..37102c577 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh @@ -63,14 +63,8 @@ class GarnetNetwork_d : public BaseGarnetNetwork int getBuffersPerDataVC() {return m_buffers_per_data_vc; } int getBuffersPerCtrlVC() {return m_buffers_per_ctrl_vc; } - // 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 printLinkStats(std::ostream& out) const; + void printPowerStats(std::ostream& out) const; void printConfig(std::ostream& out) const; void print(std::ostream& out) const; @@ -81,26 +75,6 @@ class GarnetNetwork_d : public BaseGarnetNetwork return m_vnet_type[vnet]; } - - 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(); - void reset(); // Methods used by Topology to setup the network diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc index 628c47dda..dd1ced1ad 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc @@ -167,7 +167,7 @@ NetworkInterface_d::flitisizeMessage(MsgPtr msg_ptr, int vnet) } for (int i = 0; i < num_flits; i++) { - m_net_ptr->increment_injected_flits(); + m_net_ptr->increment_injected_flits(vnet); flit_d *fl = new flit_d(i, vc, vnet, num_flits, new_msg_ptr); fl->set_delay(g_eventQueue_ptr->getTime() - msg_ptr->getTime()); m_ni_buffers[vc]->insert(fl); @@ -247,12 +247,13 @@ NetworkInterface_d::wakeup() creditQueue->insert(credit_flit); g_eventQueue_ptr->scheduleEvent(m_ni_credit_link, 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