mem-garnet: Add a check to see if router is already scheduled
authorSrikant Bharadwaj <srikant.bharadwaj@amd.com>
Tue, 16 Jul 2019 20:34:31 +0000 (16:34 -0400)
committerSrikant Bharadwaj <srikant.bharadwaj@amd.com>
Fri, 4 Sep 2020 22:17:36 +0000 (22:17 +0000)
Currently the Switch Allocator takes up most of the simulation
wall clock time. This function checks for all VCs to see if it
should wakeup next. The input units which are simulated before
the switch allocator could have scheduled it already. This patch
adds a check for it.

Change-Id: I8609d4e7f925aa5e97198f6cd07466530f6fcf4c
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/32600
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 144f2085b5bbbe552777b90ca203090eeff60bd2..324134306e14a2fe2ad78b71c8bb854ad0170088 100644 (file)
@@ -350,6 +350,10 @@ SwitchAllocator::check_for_wakeup()
 {
     Tick nextCycle = m_router->clockEdge(Cycles(1));
 
+    if (m_router->alreadyScheduled(nextCycle)) {
+        return;
+    }
+
     for (int i = 0; i < m_num_inports; i++) {
         for (int j = 0; j < m_num_vcs; j++) {
             if (m_router->getInputUnit(i)->need_stage(j, SA_, nextCycle)) {