changeset 467f34a4dfd8 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=467f34a4dfd8
description:
        inorder: cleanup events in resource pool
        remove events in the resource pool that can be called from the CPU 
event, since the CPU
        event is scheduled at the same time at the resource pool event.
        ----
        Also, match the resPool event function names to the cpu event function 
names
        ----

diffstat:

 src/cpu/inorder/cpu.cc           |    8 ++-
 src/cpu/inorder/resource_pool.cc |  100 +++-----------------------------------
 src/cpu/inorder/resource_pool.hh |   11 ++-
 3 files changed, 22 insertions(+), 97 deletions(-)

diffs (246 lines):

diff -r 9ccf5354e3a4 -r 467f34a4dfd8 src/cpu/inorder/cpu.cc
--- a/src/cpu/inorder/cpu.cc    Sun Jun 19 21:43:38 2011 -0400
+++ b/src/cpu/inorder/cpu.cc    Sun Jun 19 21:43:38 2011 -0400
@@ -117,6 +117,7 @@
     {
       case ActivateThread:
         cpu->activateThread(tid);
+        cpu->resPool->activateThread(tid);
         break;
 
       case ActivateNextReadyThread:
@@ -125,18 +126,23 @@
 
       case DeactivateThread:
         cpu->deactivateThread(tid);
+        cpu->resPool->deactivateThread(tid);
         break;
 
       case HaltThread:
         cpu->haltThread(tid);
+        cpu->resPool->deactivateThread(tid);
         break;
 
       case SuspendThread: 
         cpu->suspendThread(tid);
+        cpu->resPool->suspendThread(tid);
         break;
 
       case SquashFromMemStall:
         cpu->squashDueToMemStall(inst->squashingStage, inst->seqNum, tid);
+        cpu->resPool->squashDueToMemStall(inst, inst->squashingStage,
+                                          inst->seqNum, tid);
         break;
 
       case Trap:
@@ -896,7 +902,7 @@
         activateThread(ready_tid);                        
         
         // Activate in Resource Pool
-        resPool->activateAll(ready_tid);
+        resPool->activateThread(ready_tid);
         
         list<ThreadID>::iterator ready_it =
             std::find(readyThreads.begin(), readyThreads.end(), ready_tid);
diff -r 9ccf5354e3a4 -r 467f34a4dfd8 src/cpu/inorder/resource_pool.cc
--- a/src/cpu/inorder/resource_pool.cc  Sun Jun 19 21:43:38 2011 -0400
+++ b/src/cpu/inorder/resource_pool.cc  Sun Jun 19 21:43:38 2011 -0400
@@ -86,6 +86,7 @@
                                       stage_width * 2 + MaxThreads, 0, _cpu,
                                       params));
 
+    gradObjects.push_back(BPred);
     resources.push_back(new GraduationUnit("graduation_unit", Grad,
                                            stage_width, 0, _cpu,
                                            params));
@@ -274,59 +275,6 @@
 
     switch ((int)e_type)
     {
-      case InOrderCPU::ActivateThread:
-        {
-            DPRINTF(Resource, "Scheduling Activate Thread Resource Pool Event "
-                    "for tick %i, [tid:%i].\n", curTick() + delay, 
-                    inst->readTid());
-            ResPoolEvent *res_pool_event = 
-                new ResPoolEvent(this,
-                                 e_type,
-                                 inst,
-                                 inst->squashingStage,
-                                 inst->squashSeqNum,
-                                 inst->readTid());
-            cpu->schedule(res_pool_event, when);
-        }
-        break;
-
-      case InOrderCPU::HaltThread:
-      case InOrderCPU::DeactivateThread:
-        {
-
-            DPRINTF(Resource, "Scheduling Deactivate Thread Resource Pool "
-                    "Event for tick %i.\n", curTick() + delay);
-            ResPoolEvent *res_pool_event = 
-                new ResPoolEvent(this,
-                                 e_type,
-                                 inst,
-                                 inst->squashingStage,
-                                 inst->squashSeqNum,
-                                 tid);
-
-            cpu->schedule(res_pool_event, when);
-        }
-        break;
-
-      case InOrderCPU::SuspendThread:
-        {
-            // not sure why we add another nextCycle() call here...
-            Tick sked_tick = cpu->nextCycle(when);
-
-            DPRINTF(Resource, "Scheduling Suspend Thread Resource Pool "
-                    "Event for tick %i.\n", sked_tick);
-
-            ResPoolEvent *res_pool_event = new ResPoolEvent(this,
-                                                            e_type,
-                                                            inst,
-                                                            
inst->squashingStage,
-                                                            inst->squashSeqNum,
-                                                            tid);
-
-            cpu->schedule(res_pool_event, sked_tick);
-        }
-        break;
-
       case ResourcePool::InstGraduated:
         {
             DPRINTF(Resource, "Scheduling Inst-Graduated Resource Pool "
@@ -361,22 +309,6 @@
         }
         break;
 
-      case InOrderCPU::SquashFromMemStall:
-        {
-            DPRINTF(Resource, "Scheduling Squash Due to Memory Stall Resource "
-                    "Pool Event for tick %i.\n",
-                    curTick() + delay);
-            ResPoolEvent *res_pool_event = 
-                new ResPoolEvent(this,
-                                 e_type,
-                                 inst,
-                                 inst->squashingStage,
-                                 inst->seqNum - 1,
-                                 inst->readTid());
-            cpu->schedule(res_pool_event, when);
-        }
-        break;
-
       case ResourcePool::UpdateAfterContextSwitch:
         {
             DPRINTF(Resource, "Scheduling UpdatePC Resource Pool Event "
@@ -436,7 +368,7 @@
 }
 
 void
-ResourcePool::activateAll(ThreadID tid)
+ResourcePool::activateThread(ThreadID tid)
 {
     bool do_activate = cpu->threadModel != InOrderCPU::SwitchOnCacheMiss ||
         cpu->numActiveThreads() < 1 ||
@@ -459,7 +391,7 @@
 }
 
 void
-ResourcePool::deactivateAll(ThreadID tid)
+ResourcePool::deactivateThread(ThreadID tid)
 {
     DPRINTF(Resource, "[tid:%i] Broadcasting Thread Deactivation to all "
             "resources.\n", tid);
@@ -472,7 +404,7 @@
 }
 
 void
-ResourcePool::suspendAll(ThreadID tid)
+ResourcePool::suspendThread(ThreadID tid)
 {
     DPRINTF(Resource, "[tid:%i] Broadcasting Thread Suspension to all "
             "resources.\n", tid);
@@ -487,13 +419,13 @@
 void
 ResourcePool::instGraduated(InstSeqNum seq_num, ThreadID tid)
 {
-    DPRINTF(Resource, "[tid:%i] Broadcasting [sn:%i] graduation to all "
-            "resources.\n", tid, seq_num);
+    DPRINTF(Resource, "[tid:%i] Broadcasting [sn:%i] graduation to "
+            "appropriate resources.\n", tid, seq_num);
 
-    int num_resources = resources.size();
+    int num_resources = gradObjects.size();
 
     for (int idx = 0; idx < num_resources; idx++) {
-        resources[idx]->instGraduated(seq_num, tid);
+        resources[gradObjects[idx]]->instGraduated(seq_num, tid);
     }
 }
 
@@ -528,18 +460,6 @@
 {
     switch ((int)eventType)
     {
-      case InOrderCPU::ActivateThread:
-        resPool->activateAll(tid);
-        break;
-
-      case InOrderCPU::DeactivateThread:
-      case InOrderCPU::HaltThread:
-        resPool->deactivateAll(tid);
-        break;
-
-      case InOrderCPU::SuspendThread:
-        resPool->suspendAll(tid);
-        break;
 
       case ResourcePool::InstGraduated:
         resPool->instGraduated(seqNum, tid);
@@ -549,10 +469,6 @@
         resPool->squashAll(inst, stageNum, seqNum, tid);
         break;
 
-      case InOrderCPU::SquashFromMemStall:
-        resPool->squashDueToMemStall(inst, stageNum, seqNum, tid);
-        break;
-
       case ResourcePool::UpdateAfterContextSwitch:
         resPool->updateAfterContextSwitch(inst, tid);
         break;
diff -r 9ccf5354e3a4 -r 467f34a4dfd8 src/cpu/inorder/resource_pool.hh
--- a/src/cpu/inorder/resource_pool.hh  Sun Jun 19 21:43:38 2011 -0400
+++ b/src/cpu/inorder/resource_pool.hh  Sun Jun 19 21:43:38 2011 -0400
@@ -175,13 +175,13 @@
                              InstSeqNum done_seq_num, ThreadID tid);
 
     /** Activate Thread in all resources */
-    void activateAll(ThreadID tid);
+    void activateThread(ThreadID tid);
 
     /** De-Activate Thread in all resources */
-    void deactivateAll(ThreadID tid);
+    void deactivateThread(ThreadID tid);
 
-    /** De-Activate Thread in all resources */
-    void suspendAll(ThreadID tid);
+    /** Suspend Thread in all resources */
+    void suspendThread(ThreadID tid);
 
     /** Broadcast Context Switch Update to all resources */
     void updateAfterContextSwitch(DynInstPtr inst, ThreadID tid);
@@ -218,8 +218,11 @@
   private:
     std::vector<Resource *> resources;
 
+    /** Resources that interface with memory objects */
     std::vector<int> memObjects;
 
+    /** Resources that need to be updated on an inst. graduation */
+    std::vector<int> gradObjects;
 };
 
 #endif //__CPU_INORDER_RESOURCE_HH__
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to