From: Gabe Black Date: Mon, 12 Oct 2020 00:03:50 +0000 (-0700) Subject: cpu: Remove the "SingleThreaded" fetch policy from the O3 CPU. X-Git-Tag: develop-gem5-snapshot~628 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=539247a4c76bc648e5128e5722935c8bdcb83d04;p=gem5.git cpu: Remove the "SingleThreaded" fetch policy from the O3 CPU. 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 Maintainer: Gabe Black Tested-by: kokoro --- diff --git a/src/cpu/o3/O3CPU.py b/src/cpu/o3/O3CPU.py index 51d912147..9f3685dd9 100644 --- a/src/cpu/o3/O3CPU.py +++ b/src/cpu/o3/O3CPU.py @@ -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") diff --git a/src/cpu/o3/deriv.cc b/src/cpu/o3/deriv.cc index fe1b76b48..757af6f4e 100644 --- a/src/cpu/o3/deriv.cc +++ b/src/cpu/o3/deriv.cc @@ -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); } diff --git a/src/cpu/o3/fetch.hh b/src/cpu/o3/fetch.hh index 16f0c5eb6..e47059a68 100644 --- a/src/cpu/o3/fetch.hh +++ b/src/cpu/o3/fetch.hh @@ -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 priorityList; diff --git a/src/cpu/o3/fetch_impl.hh b/src/cpu/o3/fetch_impl.hh index d38420b7e..28b1357ed 100644 --- a/src/cpu/o3/fetch_impl.hh +++ b/src/cpu/o3/fetch_impl.hh @@ -111,10 +111,6 @@ DefaultFetch::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::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;