mem-garnet: Separable allocator in Garnet not fair enough.
authorSrikant Bharadwaj <srikant.bharadwaj@amd.com>
Tue, 16 Jul 2019 21:15:57 +0000 (17:15 -0400)
committerSrikant Bharadwaj <srikant.bharadwaj@amd.com>
Fri, 4 Sep 2020 22:17:36 +0000 (22:17 +0000)
Currently there are independent round robin arbiter at each
input port and output port. Every time a VC is selected for
output allocation round robin is incremented irrespective of
if it is selected by its output port or not. This leads to
unfair arbitration at input port and is well known[1]. This
patch fixes it to increment only if the output port also
selects it.

[1] D. U. Becker and W. J. Dally, "Allocator implementations
for network-on-chip routers," Proceedings of the Conference
on High Performance Computing Networking, Storage and
Analysis, Portland, OR, 2009, pp. 1-12

Change-Id: I65963fb8082c51c0e3c6e031a8b87b4f5c3626e1
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/32601
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>

src/mem/ruby/network/garnet2.0/SwitchAllocator.cc

index 324134306e14a2fe2ad78b71c8bb854ad0170088..1ed6de1e6198de031c47e5365b63c6fd6b1a17ec 100644 (file)
@@ -130,11 +130,6 @@ SwitchAllocator::arbitrate_inports()
                     m_port_requests[outport][inport] = true;
                     m_vc_winners[outport][inport]= invc;
 
-                    // Update Round Robin pointer to the next VC
-                    m_round_robin_invc[inport] = invc + 1;
-                    if (m_round_robin_invc[inport] >= m_num_vcs)
-                        m_round_robin_invc[inport] = 0;
-
                     break; // got one vc winner for this port
                 }
             }
@@ -248,6 +243,15 @@ SwitchAllocator::arbitrate_outports()
                 if (m_round_robin_inport[outport] >= m_num_inports)
                     m_round_robin_inport[outport] = 0;
 
+                // Update Round Robin pointer to the next VC
+                // We do it here to keep it fair.
+                // Only the VC which got switch traversal
+                // is updated.
+                m_round_robin_invc[inport] = invc + 1;
+                if (m_round_robin_invc[inport] >= m_num_vcs)
+                    m_round_robin_invc[inport] = 0;
+
+
                 break; // got a input winner for this outport
             }