diff options
author | Tushar Krishna <tushar@csail.mit.edu> | 2011-03-21 22:51:59 -0400 |
---|---|---|
committer | Tushar Krishna <tushar@csail.mit.edu> | 2011-03-21 22:51:59 -0400 |
commit | 1b9002eefc39654b18547d7adb77b6fec77d883e (patch) | |
tree | 1d99b7f7254cb1ca1f64078c438f94e2c39664b1 | |
parent | 09c3a97a4c9aace6e2c52823679b31323cab42f6 (diff) | |
download | gem5-1b9002eefc39654b18547d7adb77b6fec77d883e.tar.xz |
fix garnet fleible pipeline
6 files changed, 61 insertions, 5 deletions
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc index 20ddf86e5..8280360c4 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc +++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc @@ -30,7 +30,6 @@ #include <cassert> -#include "base/cprintf.hh" #include "base/stl_helpers.hh" #include "mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh" #include "mem/protocol/MachineType.hh" @@ -50,6 +49,10 @@ GarnetNetwork::GarnetNetwork(const Params *p) : BaseGarnetNetwork(p) { m_ruby_start = 0; + m_flits_received = 0; + m_flits_injected = 0; + m_network_latency = 0.0; + m_queueing_latency = 0.0; // Allocate to and from queues @@ -191,7 +194,6 @@ void GarnetNetwork::checkNetworkAllocation(NodeID id, bool ordered, int network_num) { - cprintf ("id = %i, m_nodes = %i \n", id, m_nodes); assert(id < m_nodes); assert(network_num < m_virtual_networks); @@ -264,6 +266,18 @@ GarnetNetwork::printStats(ostream& out) const " flits/cycle" << 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; + out << "-------------" << endl; + m_topology_ptr->printStats(out); } diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh index 96aa5fd10..51a9380cb 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh +++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh @@ -65,6 +65,21 @@ class GarnetNetwork : public BaseGarnetNetwork 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]; } @@ -92,6 +107,8 @@ class GarnetNetwork : public BaseGarnetNetwork // int m_virtual_networks; // int m_nodes; + int m_flits_received, m_flits_injected; + double m_network_latency, m_queueing_latency; std::vector<bool> m_in_use; std::vector<bool> m_ordered; diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc index 60ec09e58..11da465a8 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc +++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc @@ -162,7 +162,9 @@ 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(); 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); } @@ -269,6 +271,12 @@ NetworkInterface::wakeup() inNetLink->release_vc_link(t_flit->get_vc(), g_eventQueue_ptr->getTime() + 1); } + m_net_ptr->increment_received_flits(); + 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); delete t_flit; } } diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc b/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc index ce90c9748..fef6b00a1 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc +++ b/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc @@ -99,8 +99,11 @@ Router::addOutPort(NetworkLink *out_link, const NetDest& routing_table_entry, vector<flitBuffer *> intermediateQueues; for (int i = 0; i < m_num_vcs; i++) { - intermediateQueues.push_back(new flitBuffer( - m_net_ptr->getBufferSize())); + int buffer_size = m_net_ptr->getBufferSize(); + if (buffer_size > 0) // finite size + intermediateQueues.push_back(new flitBuffer(buffer_size)); + else // infinite size + intermediateQueues.push_back(new flitBuffer()); } m_router_buffers.push_back(intermediateQueues); diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/flit.cc b/src/mem/ruby/network/garnet/flexible-pipeline/flit.cc index 1227b70f0..2f5944c62 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/flit.cc +++ b/src/mem/ruby/network/garnet/flexible-pipeline/flit.cc @@ -113,6 +113,18 @@ flit::get_type() } void +flit::set_delay(int delay) +{ + src_delay = delay; +} + +int +flit::get_delay() +{ + return src_delay; +} + +void flit::print(std::ostream& out) const { out << "[flit:: "; diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/flit.hh b/src/mem/ruby/network/garnet/flexible-pipeline/flit.hh index 4c072b270..83a6f82aa 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/flit.hh +++ b/src/mem/ruby/network/garnet/flexible-pipeline/flit.hh @@ -52,6 +52,8 @@ class flit void set_vc(int vc); MsgPtr& get_msg_ptr(); flit_type get_type(); + void set_delay(int delay); + int get_delay(); void print(std::ostream& out) const; static bool @@ -72,7 +74,7 @@ class flit Time m_enqueue_time, m_time; flit_type m_type; MsgPtr m_msg_ptr; - + int src_delay; }; inline std::ostream& |