diff options
author | Nikos Nikoleris <nikos.nikoleris@arm.com> | 2019-01-03 18:48:51 +0000 |
---|---|---|
committer | Nikos Nikoleris <nikos.nikoleris@arm.com> | 2019-01-17 11:09:08 +0000 |
commit | 8c549224a5e7d7a3142a9365d544475601dee41d (patch) | |
tree | 80079c8f1062447cb572e3378e3679e16aaaba0b /src | |
parent | 6825ef194102603831165ae1b1cf86b7c2556d93 (diff) | |
download | gem5-8c549224a5e7d7a3142a9365d544475601dee41d.tar.xz |
cpu-o3: Make the smtROBPolicy a Param.ScopedEnum
The smtROBPolicy is a parameter in the o3 cpu that can have 3
different values. Previously this setting was done through a string
and a parser function would turn it into a c++ enum value. This
changeset turns the string into a python Param.ScopedEnum.
Change-Id: Ie104d055dbbc6e44997ae0c1470de714239be5a3
Signed-off-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/15399
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/cpu/o3/O3CPU.py | 3 | ||||
-rw-r--r-- | src/cpu/o3/rob.hh | 10 | ||||
-rw-r--r-- | src/cpu/o3/rob_impl.hh | 32 |
3 files changed, 15 insertions, 30 deletions
diff --git a/src/cpu/o3/O3CPU.py b/src/cpu/o3/O3CPU.py index 5908260f5..e3704c0fa 100644 --- a/src/cpu/o3/O3CPU.py +++ b/src/cpu/o3/O3CPU.py @@ -160,7 +160,8 @@ class DerivO3CPU(BaseCPU): smtIQPolicy = Param.SMTQueuePolicy('Partitioned', "SMT IQ Sharing Policy") smtIQThreshold = Param.Int(100, "SMT IQ Threshold Sharing Parameter") - smtROBPolicy = Param.String('Partitioned', "SMT ROB Sharing Policy") + smtROBPolicy = Param.SMTQueuePolicy('Partitioned', + "SMT ROB Sharing Policy") smtROBThreshold = Param.Int(100, "SMT ROB Threshold Sharing Parameter") smtCommitPolicy = Param.String('RoundRobin', "SMT Commit Policy") diff --git a/src/cpu/o3/rob.hh b/src/cpu/o3/rob.hh index 1896e62a4..ad7a6d6e7 100644 --- a/src/cpu/o3/rob.hh +++ b/src/cpu/o3/rob.hh @@ -51,6 +51,7 @@ #include "arch/registers.hh" #include "base/types.hh" #include "config/the_isa.hh" +#include "enums/SMTQueuePolicy.hh" struct DerivO3CPUParams; @@ -75,19 +76,12 @@ class ROB ROBSquashing }; - /** SMT ROB Sharing Policy */ - enum ROBPolicy{ - Dynamic, - Partitioned, - Threshold - }; - private: /** Per-thread ROB status. */ Status robStatus[Impl::MaxThreads]; /** ROB resource sharing policy for SMT mode. */ - ROBPolicy robPolicy; + SMTQueuePolicy robPolicy; public: /** ROB constructor. diff --git a/src/cpu/o3/rob_impl.hh b/src/cpu/o3/rob_impl.hh index 3a0140b9f..2942c7ac5 100644 --- a/src/cpu/o3/rob_impl.hh +++ b/src/cpu/o3/rob_impl.hh @@ -56,29 +56,21 @@ using namespace std; template <class Impl> ROB<Impl>::ROB(O3CPU *_cpu, DerivO3CPUParams *params) - : cpu(_cpu), + : robPolicy(params->smtROBPolicy), + cpu(_cpu), numEntries(params->numROBEntries), squashWidth(params->squashWidth), numInstsInROB(0), numThreads(params->numThreads) { - std::string policy = params->smtROBPolicy; - - //Convert string to lowercase - std::transform(policy.begin(), policy.end(), policy.begin(), - (int(*)(int)) tolower); - //Figure out rob policy - if (policy == "dynamic") { - robPolicy = Dynamic; - + if (robPolicy == SMTQueuePolicy::Dynamic) { //Set Max Entries to Total ROB Capacity for (ThreadID tid = 0; tid < numThreads; tid++) { maxEntries[tid] = numEntries; } - } else if (policy == "partitioned") { - robPolicy = Partitioned; + } else if (robPolicy == SMTQueuePolicy::Partitioned) { DPRINTF(Fetch, "ROB sharing policy set to Partitioned\n"); //@todo:make work if part_amt doesnt divide evenly. @@ -89,8 +81,7 @@ ROB<Impl>::ROB(O3CPU *_cpu, DerivO3CPUParams *params) maxEntries[tid] = part_amt; } - } else if (policy == "threshold") { - robPolicy = Threshold; + } else if (robPolicy == SMTQueuePolicy::Threshold) { DPRINTF(Fetch, "ROB sharing policy set to Threshold\n"); int threshold = params->smtROBThreshold;; @@ -99,10 +90,8 @@ ROB<Impl>::ROB(O3CPU *_cpu, DerivO3CPUParams *params) for (ThreadID tid = 0; tid < numThreads; tid++) { maxEntries[tid] = threshold; } - } else { - panic("Invalid ROB sharing policy. Options are: Dynamic, " - "Partitioned, Threshold"); } + for (ThreadID tid = numThreads; tid < Impl::MaxThreads; tid++) { maxEntries[tid] = 0; } @@ -163,7 +152,7 @@ template <class Impl> void ROB<Impl>::resetEntries() { - if (robPolicy != Dynamic || numThreads > 1) { + if (robPolicy != SMTQueuePolicy::Dynamic || numThreads > 1) { int active_threads = activeThreads->size(); list<ThreadID>::iterator threads = activeThreads->begin(); @@ -172,9 +161,10 @@ ROB<Impl>::resetEntries() while (threads != end) { ThreadID tid = *threads++; - if (robPolicy == Partitioned) { + if (robPolicy == SMTQueuePolicy::Partitioned) { maxEntries[tid] = numEntries / active_threads; - } else if (robPolicy == Threshold && active_threads == 1) { + } else if (robPolicy == SMTQueuePolicy::Threshold && + active_threads == 1) { maxEntries[tid] = numEntries; } } @@ -185,7 +175,7 @@ template <class Impl> int ROB<Impl>::entryAmount(ThreadID num_threads) { - if (robPolicy == Partitioned) { + if (robPolicy == SMTQueuePolicy::Partitioned) { return numEntries / num_threads; } else { return 0; |