Tom Rollet has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/50729 )

Change subject: cpu-o3: replace 'loads' counter per loadQueue.size()
......................................................................

cpu-o3: replace 'loads' counter per loadQueue.size()

Change-Id: Id65776b385f571e4e325b0ffa022bfa765c224bf
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/50729
Maintainer: Bobby R. Bruce <[email protected]>
Tested-by: kokoro <[email protected]>
Reviewed-by: Gabe Black <[email protected]>
---
M src/cpu/o3/lsq_unit.cc
M src/cpu/o3/lsq_unit.hh
2 files changed, 26 insertions(+), 21 deletions(-)

Approvals:
  Gabe Black: Looks good to me, approved
  Bobby R. Bruce: Looks good to me, approved
  kokoro: Regressions pass




diff --git a/src/cpu/o3/lsq_unit.cc b/src/cpu/o3/lsq_unit.cc
index dc84bf3..a559d58 100644
--- a/src/cpu/o3/lsq_unit.cc
+++ b/src/cpu/o3/lsq_unit.cc
@@ -201,7 +201,7 @@

 LSQUnit::LSQUnit(uint32_t lqEntries, uint32_t sqEntries)
     : lsqID(-1), storeQueue(sqEntries+1), loadQueue(lqEntries+1),
-      loads(0), stores(0), storesToWB(0),
+      stores(0), storesToWB(0),
       htmStarts(0), htmStops(0),
       lastRetiredHtmUid(0),
       cacheBlockMask(0), stalled(false),
@@ -235,7 +235,7 @@
 void
 LSQUnit::resetState()
 {
-    loads = stores = storesToWB = 0;
+    stores = storesToWB = 0;

     // hardware transactional memory
     // nesting depth
@@ -329,7 +329,7 @@
 LSQUnit::insertLoad(const DynInstPtr &load_inst)
 {
     assert(!loadQueue.full());
-    assert(loads < loadQueue.capacity());
+    assert(loadQueue.size() < loadQueue.capacity());

     DPRINTF(LSQUnit, "Inserting load PC %s, idx:%i [sn:%lli]\n",
             load_inst->pcState(), loadQueue.tail(), load_inst->seqNum);
@@ -345,8 +345,6 @@
     assert(load_inst->lqIdx > 0);
     load_inst->lqIt = loadQueue.getIterator(load_inst->lqIdx);

-    ++loads;
-
     // hardware transactional memory
     // transactional state and nesting depth must be tracked
     // in the in-order part of the core.
@@ -424,8 +422,8 @@
         //LQ has an extra dummy entry to differentiate
         //empty/full conditions. Subtract 1 from the free entries.
         DPRINTF(LSQUnit, "LQ size: %d, #loads occupied: %d\n",
-                1 + loadQueue.capacity(), loads);
-        return loadQueue.capacity() - loads;
+                1 + loadQueue.capacity(), loadQueue.size());
+        return loadQueue.capacity() - loadQueue.size();
 }

 unsigned
@@ -751,16 +749,14 @@

     loadQueue.front().clear();
     loadQueue.pop_front();
-
-    --loads;
 }

 void
 LSQUnit::commitLoads(InstSeqNum &youngest_inst)
 {
-    assert(loads == 0 || loadQueue.front().valid());
+    assert(loadQueue.size() == 0 || loadQueue.front().valid());

-    while (loads != 0 && loadQueue.front().instruction()->seqNum
+    while (loadQueue.size() != 0 && loadQueue.front().instruction()->seqNum
             <= youngest_inst) {
         commitLoad();
     }
@@ -951,9 +947,9 @@
 LSQUnit::squash(const InstSeqNum &squashed_num)
 {
     DPRINTF(LSQUnit, "Squashing until [sn:%lli]!"
-            "(Loads:%i Stores:%i)\n", squashed_num, loads, stores);
+ "(Loads:%i Stores:%i)\n", squashed_num, loadQueue.size(), stores);

-    while (loads != 0 &&
+    while (loadQueue.size() != 0 &&
             loadQueue.back().instruction()->seqNum > squashed_num) {
         DPRINTF(LSQUnit,"Load Instruction PC %s squashed, "
                 "[sn:%lli]\n",
@@ -985,8 +981,6 @@
         loadQueue.back().instruction()->setSquashed();
         loadQueue.back().clear();

-        --loads;
-
         loadQueue.pop_back();
         ++stats.squashedLoads;
     }
@@ -1284,7 +1278,7 @@
 LSQUnit::dumpInsts() const
 {
     cprintf("Load store queue: Dumping instructions.\n");
-    cprintf("Load queue size: %i\n", loads);
+    cprintf("Load queue size: %i\n", loadQueue.size());
     cprintf("Load queue: ");

     for (const auto& e: loadQueue) {
diff --git a/src/cpu/o3/lsq_unit.hh b/src/cpu/o3/lsq_unit.hh
index 686ca16..19f190b 100644
--- a/src/cpu/o3/lsq_unit.hh
+++ b/src/cpu/o3/lsq_unit.hh
@@ -301,7 +301,7 @@
     unsigned numFreeStoreEntries();

     /** Returns the number of loads in the LQ. */
-    int numLoads() { return loads; }
+    int numLoads() { return loadQueue.size(); }

     /** Returns the number of stores in the SQ. */
     int numStores() { return stores; }
@@ -331,13 +331,13 @@
     bool sqFull() { return storeQueue.full(); }

     /** Returns if the LQ is empty. */
-    bool lqEmpty() const { return loads == 0; }
+    bool lqEmpty() const { return loadQueue.size() == 0; }

     /** Returns if the SQ is empty. */
     bool sqEmpty() const { return stores == 0; }

     /** Returns the number of instructions in the LSQ. */
-    unsigned getCount() { return loads + stores; }
+    unsigned getCount() { return loadQueue.size() + stores; }

     /** Returns if there are any stores to writeback. */
     bool hasStoresToWB() { return storesToWB; }
@@ -495,8 +495,6 @@
     /** Should loads be checked for dependency issues */
     bool checkLoads;

-    /** The number of load instructions in the LQ. */
-    int loads;
     /** The number of store instructions in the SQ. */
     int stores;
     /** The number of store instructions in the SQ waiting to writeback. */

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/50729
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Id65776b385f571e4e325b0ffa022bfa765c224bf
Gerrit-Change-Number: 50729
Gerrit-PatchSet: 2
Gerrit-Owner: Tom Rollet <[email protected]>
Gerrit-Reviewer: Bobby R. Bruce <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Tom Rollet <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to