fix garnet fleible pipeline

This commit is contained in:
Tushar Krishna 2011-03-21 22:51:59 -04:00
parent 09c3a97a4c
commit 1b9002eefc
6 changed files with 61 additions and 5 deletions

View file

@ -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);
}

View file

@ -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;

View file

@ -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;
}
}

View file

@ -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);

View file

@ -112,6 +112,18 @@ flit::get_type()
return m_type;
}
void
flit::set_delay(int delay)
{
src_delay = delay;
}
int
flit::get_delay()
{
return src_delay;
}
void
flit::print(std::ostream& out) const
{

View file

@ -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&