cpu: Remove the "SingleThreaded" fetch policy from the O3 CPU.
authorGabe Black <gabeblack@google.com>
Mon, 12 Oct 2020 00:03:50 +0000 (17:03 -0700)
committerGabe Black <gabeblack@google.com>
Tue, 13 Oct 2020 20:09:21 +0000 (20:09 +0000)
The fetch policy is only meaningful for SMT simulations. The
"SingleThreaded" value is a placeholder which is the default, and is
only supposed to be used in non-SMT simulations.

Rather than have this enum value and have special checks for it in
various places in O3, we can just eliminate it and set the default,
which is still only meaningful in SMT simulations, be an SMT fetch
policy.

The DerivO3CPUParams::create() function would forcefully change the
the fetch policy from "SingleThreaded" to "RoundRobin" anyway if there
were more than one thread, so that can be the actual default instead of
the shadow effective default.

Change-Id: I458fda00b5bcc246b0957e6c937eab0c5b4563c3
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/35935
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/cpu/o3/O3CPU.py
src/cpu/o3/deriv.cc
src/cpu/o3/fetch.hh
src/cpu/o3/fetch_impl.hh

index 51d912147c43f30c2b2e289d256878758e7f8c03..9f3685dd9621a1bb3d66bbe4085d12d12a8ff6f8 100644 (file)
@@ -47,8 +47,8 @@ from m5.objects.FUPool import *
 from m5.objects.O3Checker import O3Checker
 from m5.objects.BranchPredictor import *
 
-class FetchPolicy(ScopedEnum):
-    vals = [ 'SingleThread', 'RoundRobin', 'Branch', 'IQCount', 'LSQCount' ]
+class SMTFetchPolicy(ScopedEnum):
+    vals = [ 'RoundRobin', 'Branch', 'IQCount', 'LSQCount' ]
 
 class SMTQueuePolicy(ScopedEnum):
     vals = [ 'Dynamic', 'Partitioned', 'Threshold' ]
@@ -159,7 +159,7 @@ class DerivO3CPU(BaseCPU):
     numROBEntries = Param.Unsigned(192, "Number of reorder buffer entries")
 
     smtNumFetchingThreads = Param.Unsigned(1, "SMT Number of Fetching Threads")
-    smtFetchPolicy = Param.FetchPolicy('SingleThread', "SMT Fetch policy")
+    smtFetchPolicy = Param.SMTFetchPolicy('RoundRobin', "SMT Fetch policy")
     smtLSQPolicy    = Param.SMTQueuePolicy('Partitioned',
                                            "SMT LSQ Sharing Policy")
     smtLSQThreshold = Param.Int(100, "SMT LSQ Threshold Sharing Parameter")
index fe1b76b48b7a3189ad2eee635c0b7024fea3256a..757af6f4e3090ded880c80b44a4b04ca1bf7b6ca 100644 (file)
@@ -55,8 +55,5 @@ DerivO3CPUParams::create()
 
     numThreads = actual_num_threads;
 
-    if (actual_num_threads > 1 && smtFetchPolicy == FetchPolicy::SingleThread)
-        smtFetchPolicy = FetchPolicy::RoundRobin;
-
     return new DerivO3CPU(this);
 }
index 16f0c5eb685060590dbb2b70bcc26f71b905811a..e47059a6884b70f4a7dd3a6c58fb28ea2872dd21 100644 (file)
@@ -49,7 +49,7 @@
 #include "cpu/pred/bpred_unit.hh"
 #include "cpu/timebuf.hh"
 #include "cpu/translation.hh"
-#include "enums/FetchPolicy.hh"
+#include "enums/SMTFetchPolicy.hh"
 #include "mem/packet.hh"
 #include "mem/port.hh"
 #include "sim/eventq.hh"
@@ -205,7 +205,7 @@ class DefaultFetch
     ThreadStatus fetchStatus[Impl::MaxThreads];
 
     /** Fetch policy. */
-    FetchPolicy fetchPolicy;
+    SMTFetchPolicy fetchPolicy;
 
     /** List that has the threads organized by priority. */
     std::list<ThreadID> priorityList;
index d38420b7ec0417ff0823b0494620762efac0c87c..28b1357ed8e7919dc889982b2f28e3e5f1532dae 100644 (file)
@@ -111,10 +111,6 @@ DefaultFetch<Impl>::DefaultFetch(O3CPU *_cpu, DerivO3CPUParams *params)
         fatal("cache block (%u bytes) is not a multiple of the "
               "fetch buffer (%u bytes)\n", cacheBlkSize, fetchBufferSize);
 
-    // Figure out fetch policy
-    panic_if(fetchPolicy == FetchPolicy::SingleThread && numThreads > 1,
-             "Invalid Fetch Policy for a SMT workload.");
-
     // Get the size of an instruction.
     instSize = sizeof(TheISA::MachInst);
 
@@ -1415,13 +1411,13 @@ DefaultFetch<Impl>::getFetchingThread()
 {
     if (numThreads > 1) {
         switch (fetchPolicy) {
-          case FetchPolicy::RoundRobin:
+          case SMTFetchPolicy::RoundRobin:
             return roundRobin();
-          case FetchPolicy::IQCount:
+          case SMTFetchPolicy::IQCount:
             return iqCount();
-          case FetchPolicy::LSQCount:
+          case SMTFetchPolicy::LSQCount:
             return lsqCount();
-          case FetchPolicy::Branch:
+          case SMTFetchPolicy::Branch:
             return branchCount();
           default:
             return InvalidThreadID;