ruby: change router pipeline stages to 2
authorDavid Hashe <david.hashe@amd.com>
Mon, 20 Jul 2015 14:15:18 +0000 (09:15 -0500)
committerDavid Hashe <david.hashe@amd.com>
Mon, 20 Jul 2015 14:15:18 +0000 (09:15 -0500)
This patch changes the router pipeline stages from 4 to 2. The
canonical 4-stage router is conservative while a lower-latency router
with look ahead routing and speculative allocation is well acknowledged.

src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc
src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc
src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh
src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc
src/mem/ruby/network/garnet/fixed-pipeline/Router_d.hh
src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc
src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc
src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc
src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc
src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh

index fb147babc2ca8cd010a40a8ddfafa6f91be78c36..2f99d387a3251a4d39f308d62e40e6aabac50690 100644 (file)
@@ -81,8 +81,14 @@ InputUnit_d::wakeup()
 
             m_vcs[vc]->set_enqueue_time(m_router->curCycle());
         } else {
-            t_flit->advance_stage(SA_, m_router->curCycle() + Cycles(1));
-            m_router->swarb_req();
+            t_flit->advance_stage(SA_, m_router->curCycle());
+            // Changing router latency to 2 cycles. Input Unit takes 1 cycle for wakeup.
+            // VCalloc, SWalloc, Sw-Xfer and output scheduling takes 1 cycle. The original
+            // design schedules VCallocator for head flit, and Swalloc for non-head flit.
+            // VCalloc now calls SWalloc directly instead of scheduling it for the next cycle,
+            // hence we should not allocate SWalloc, otherwise it might get called twice, once
+            // by the scheduler and once by VCalloc.
+            m_router->vcarb_req();
         }
         // write flit into input buffer
         m_vcs[vc]->insertFlit(t_flit);
index f090e2a63bdcd6c983e08ad76eeb0f4d5b7b39db..9ef2ca27150bf27a07e7672870a9331dd202b02e 100644 (file)
@@ -102,7 +102,7 @@ OutputUnit_d::set_credit_link(CreditLink_d *credit_link)
 void
 OutputUnit_d::update_vc(int vc, int in_port, int in_vc)
 {
-    m_outvc_state[vc]->setState(ACTIVE_, m_router->curCycle() + Cycles(1));
+  m_outvc_state[vc]->setState(ACTIVE_, m_router->curCycle());
     m_outvc_state[vc]->set_inport(in_port);
     m_outvc_state[vc]->set_invc(in_vc);
     m_router->update_incredit(in_port, in_vc,
index f0b0fc64f415e6dc08a92d7dfa085f461100bfe4..85b0f6a3883f81abd943bccce7feb306539070fb 100644 (file)
@@ -70,7 +70,7 @@ class OutputUnit_d : public Consumer
     inline void
     set_vc_state(VC_state_type state, int vc, Cycles curTime)
     {
-        m_outvc_state[vc]->setState(state, curTime + Cycles(1));
+      m_outvc_state[vc]->setState(state, curTime);
     }
 
     inline bool
index 126cf79e6a8f375d9dd5cdab2587fded6fd9c8c0..97bc1abdd3d9e987158383714710fbed3c4f85fe 100644 (file)
@@ -130,6 +130,18 @@ Router_d::swarb_req()
     m_sw_alloc->scheduleEventAbsolute(clockEdge(Cycles(1)));
 }
 
+void
+Router_d::call_sw_alloc()
+{
+    m_sw_alloc->wakeup();
+}
+
+void
+Router_d::call_switch()
+{
+    m_switch->wakeup();
+}
+
 void
 Router_d::update_incredit(int in_port, int in_vc, int credit)
 {
index 5d09fb045eb97cbc62b53e062c94efa0d49f705d..9b384596e05daef7f6928636f8f800fca4252b91 100644 (file)
@@ -85,6 +85,8 @@ class Router_d : public BasicRouter
     void route_req(flit_d *t_flit, InputUnit_d* in_unit, int invc);
     void vcarb_req();
     void swarb_req();
+    void call_sw_alloc();
+    void call_switch();
 
     void printFaultVector(std::ostream& out);
     void printAggregateFaultProbability(std::ostream& out);
index 21fbfe6e5b7cc36035e670f8503a2a087e6bd88d..1e636b589646bfa27e82984a61f96f68ced5b643 100644 (file)
@@ -82,6 +82,7 @@ SWallocator_d::wakeup()
 
     clear_request_vector();
     check_for_wakeup();
+    m_router->call_switch();
 
 }
 
@@ -178,10 +179,10 @@ SWallocator_d::arbitrate_outports()
 
                 // remove flit from Input Unit
                 flit_d *t_flit = m_input_unit[inport]->getTopFlit(invc);
-                t_flit->advance_stage(ST_, m_router->curCycle() + Cycles(1));
+                t_flit->advance_stage(ST_, m_router->curCycle());
                 t_flit->set_vc(outvc);
                 t_flit->set_outport(outport);
-                t_flit->set_time(m_router->curCycle() + Cycles(1));
+                t_flit->set_time(m_router->curCycle());
 
                 m_output_unit[outport]->decrement_credit(outvc);
                 m_router->update_sw_winner(inport, t_flit);
@@ -223,7 +224,7 @@ SWallocator_d::check_for_wakeup()
     for (int i = 0; i < m_num_inports; i++) {
         for (int j = 0; j < m_num_vcs; j++) {
             if (m_input_unit[i]->need_stage(j, ACTIVE_, SA_, nextCycle)) {
-                scheduleEvent(Cycles(1));
+                m_router->vcarb_req();
                 return;
             }
         }
index 911c5a6ebc63fddb933e4f94c49946c963b1bed1..25dc26e5174b14277acfc6c56ef9364e6ed1f173 100644 (file)
@@ -73,8 +73,8 @@ Switch_d::wakeup()
         flit_d *t_flit = m_switch_buffer[inport]->peekTopFlit();
         if (t_flit->is_stage(ST_, m_router->curCycle())) {
             int outport = t_flit->get_outport();
-            t_flit->advance_stage(LT_, m_router->curCycle() + Cycles(1));
-            t_flit->set_time(m_router->curCycle() + Cycles(1));
+            t_flit->advance_stage(LT_, m_router->curCycle());
+            t_flit->set_time(m_router->curCycle());
 
             // This will take care of waking up the Network Link
             m_output_unit[outport]->insert_flit(t_flit);
@@ -92,7 +92,7 @@ Switch_d::check_for_wakeup()
 
     for (int inport = 0; inport < m_num_inports; inport++) {
         if (m_switch_buffer[inport]->isReady(nextCycle)) {
-            scheduleEvent(Cycles(1));
+            m_router->vcarb_req();
             break;
         }
     }
index 395b1a9c5065f87ee8a9ac18b658fd6e82d36043..a7430b06e30468df80eb345420c90860ad727e30 100644 (file)
@@ -117,6 +117,7 @@ VCallocator_d::wakeup()
 
     clear_request_vector();
     check_for_wakeup();
+    m_router->call_sw_alloc();
 }
 
 bool
@@ -236,7 +237,6 @@ VCallocator_d::arbitrate_outvcs()
                         m_router->curCycle());
                     m_output_unit[outport_iter]->update_vc(
                         outvc_iter, inport, invc);
-                    m_router->swarb_req();
                     break;
                 }
             }
@@ -261,7 +261,7 @@ VCallocator_d::check_for_wakeup()
     for (int i = 0; i < m_num_inports; i++) {
         for (int j = 0; j < m_num_vcs; j++) {
             if (m_input_unit[i]->need_stage(j, VC_AB_, VA_, nextCycle)) {
-                scheduleEvent(Cycles(1));
+                m_router->vcarb_req();
                 return;
             }
         }
index 4db087188c34e8550ca792ff4e0c96b1f9df3391..996837b1bfd020e16ae5d7e53eaf970957b8f093 100644 (file)
@@ -55,9 +55,9 @@ VirtualChannel_d::grant_vc(int out_vc, Cycles curTime)
 {
     m_output_vc = out_vc;
     m_vc_state.first = ACTIVE_;
-    m_vc_state.second = curTime + Cycles(1);
+    m_vc_state.second = curTime;
     flit_d *t_flit = m_input_buffer->peekTopFlit();
-    t_flit->advance_stage(SA_, curTime + Cycles(1));
+    t_flit->advance_stage(SA_, curTime);
 }
 
 bool
index b46a095e6fde04ad330769def5672a1d70db620f..b55b87febc7b3ac8682a321189dff7af74f3bb64 100644 (file)
@@ -70,7 +70,7 @@ class VirtualChannel_d
     set_state(VC_state_type m_state, Cycles curTime)
     {
         m_vc_state.first = m_state;
-        m_vc_state.second = curTime + Cycles(1);
+        m_vc_state.second = curTime;
     }
 
     inline flit_d*