cpu: Change how O3 handles requests for SMT in full system.
authorGabe Black <gabeblack@google.com>
Mon, 12 Oct 2020 00:19:51 +0000 (17:19 -0700)
committerGabe Black <gabeblack@google.com>
Tue, 13 Oct 2020 23:59:43 +0000 (23:59 +0000)
Currently, when the numThreads parameter is set to something larger than
1 in full system mode, the O3 CPU will just silently change it back down
again to 1. This could be confusing to the user since it won't be
immediately apparent, even when looking at config.ini, that their config
isn't being respected.

This change moves that check into the CPU constructor, where CPU
behavior probably should be rather than the create() method which should
just build the object, and also turns it into an error.

Change-Id: I627ff8702b5e8aaad8839aa8d52524690be25619
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/35936
Reviewed-by: Gabe Black <gabeblack@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/cpu/o3/cpu.cc
src/cpu/o3/deriv.cc

index 11fac25a0f6e00ae9e6a7f661dac26d2708d93fc..20274e0102ef654227b40f4645ec14dd2e0ca625 100644 (file)
@@ -129,6 +129,9 @@ FullO3CPU<Impl>::FullO3CPU(DerivO3CPUParams *params)
       system(params->system),
       lastRunningCycle(curCycle())
 {
+    fatal_if(FullSystem && params->numThreads > 1,
+            "SMT is not supported in O3 in full system mode currently.");
+
     if (!params->switched_out) {
         _status = Running;
     } else {
index 757af6f4e3090ded880c80b44a4b04ca1bf7b6ca..68baae4210753d2245cf276f601a89f9e741f08b 100644 (file)
 DerivO3CPU *
 DerivO3CPUParams::create()
 {
-    ThreadID actual_num_threads;
-    if (FullSystem) {
-        // Full-system only supports a single thread for the moment.
-        actual_num_threads = 1;
-    } else {
+    if (!FullSystem) {
         if (workload.size() > numThreads) {
             fatal("Workload Size (%i) > Max Supported Threads (%i) on This CPU",
                   workload.size(), numThreads);
@@ -49,11 +45,9 @@ DerivO3CPUParams::create()
 
         // In non-full-system mode, we infer the number of threads from
         // the workload if it's not explicitly specified.
-        actual_num_threads =
+        numThreads =
             (numThreads >= workload.size()) ? numThreads : workload.size();
     }
 
-    numThreads = actual_num_threads;
-
     return new DerivO3CPU(this);
 }