changeset bdb039c42553 in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=bdb039c42553
description:
        fix garnet fleible pipeline

diffstat:

 src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc    |  18 
++++++++-
 src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh    |  17 
+++++++++
 src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc |   8 ++++
 src/mem/ruby/network/garnet/flexible-pipeline/Router.cc           |   7 ++-
 src/mem/ruby/network/garnet/flexible-pipeline/flit.cc             |  12 ++++++
 src/mem/ruby/network/garnet/flexible-pipeline/flit.hh             |   4 +-
 6 files changed, 61 insertions(+), 5 deletions(-)

diffs (169 lines):

diff -r 19444b1f092c -r bdb039c42553 
src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc
--- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc    Mon Mar 
21 22:51:58 2011 -0400
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc    Mon Mar 
21 22:51:59 2011 -0400
@@ -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 @@
     : 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 @@
 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 @@
                " 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 -r 19444b1f092c -r bdb039c42553 
src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh
--- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh    Mon Mar 
21 22:51:58 2011 -0400
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh    Mon Mar 
21 22:51:59 2011 -0400
@@ -65,6 +65,21 @@
     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 @@
 
     // 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 -r 19444b1f092c -r bdb039c42553 
src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc
--- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc Mon Mar 
21 22:51:58 2011 -0400
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc Mon Mar 
21 22:51:59 2011 -0400
@@ -162,7 +162,9 @@
             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 @@
             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 -r 19444b1f092c -r bdb039c42553 
src/mem/ruby/network/garnet/flexible-pipeline/Router.cc
--- a/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc   Mon Mar 21 
22:51:58 2011 -0400
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc   Mon Mar 21 
22:51:59 2011 -0400
@@ -99,8 +99,11 @@
 
     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 -r 19444b1f092c -r bdb039c42553 
src/mem/ruby/network/garnet/flexible-pipeline/flit.cc
--- a/src/mem/ruby/network/garnet/flexible-pipeline/flit.cc     Mon Mar 21 
22:51:58 2011 -0400
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/flit.cc     Mon Mar 21 
22:51:59 2011 -0400
@@ -113,6 +113,18 @@
 }
 
 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 -r 19444b1f092c -r bdb039c42553 
src/mem/ruby/network/garnet/flexible-pipeline/flit.hh
--- a/src/mem/ruby/network/garnet/flexible-pipeline/flit.hh     Mon Mar 21 
22:51:58 2011 -0400
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/flit.hh     Mon Mar 21 
22:51:59 2011 -0400
@@ -52,6 +52,8 @@
     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 @@
     Time m_enqueue_time, m_time;
     flit_type m_type;
     MsgPtr m_msg_ptr;
-
+    int src_delay;
 };
 
 inline std::ostream&
_______________________________________________
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to