Daniel Carvalho has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/18908 )

Change subject: mem-cache: Move unused prefetches counter update
......................................................................

mem-cache: Move unused prefetches counter update

The number of unused prefetches should be updated every time
a block is invalidated, therefore we move the update to within
the corresponding function.

Change-Id: If3ac2ea43611525bd3c36d628d88382042fcb7dc
Signed-off-by: Daniel R. Carvalho <[email protected]>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18908
Tested-by: kokoro <[email protected]>
Reviewed-by: Nikos Nikoleris <[email protected]>
Maintainer: Nikos Nikoleris <[email protected]>
---
M src/mem/cache/base.cc
1 file changed, 5 insertions(+), 8 deletions(-)

Approvals:
  Nikos Nikoleris: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/mem/cache/base.cc b/src/mem/cache/base.cc
index ebfb092..d56fcbe 100644
--- a/src/mem/cache/base.cc
+++ b/src/mem/cache/base.cc
@@ -883,9 +883,6 @@
     // Evict valid blocks
     for (const auto& evict_blk : evict_blks) {
         if (evict_blk->isValid()) {
-            if (evict_blk->wasPrefetched()) {
-                stats.unusedPrefetches++;
-            }
             evictBlock(evict_blk, writebacks);
         }
     }
@@ -1461,11 +1458,6 @@
DPRINTF(CacheRepl, "Evicting %s (%#llx) to make room for " \ "%#llx (%s)\n", blk->print(), regenerateBlkAddr(blk),
                         addr, is_secure);
-
-                if (blk->wasPrefetched()) {
-                    stats.unusedPrefetches++;
-                }
-
                 evictBlock(blk, writebacks);
             }
         }
@@ -1489,6 +1481,11 @@
 void
 BaseCache::invalidateBlock(CacheBlk *blk)
 {
+    // If block is still marked as prefetched, then it hasn't been used
+    if (blk->wasPrefetched()) {
+        stats.unusedPrefetches++;
+    }
+
     // If handling a block present in the Tags, let it do its invalidation
     // process, which will update stats and invalidate the block itself
     if (blk != tempBlock) {

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

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: If3ac2ea43611525bd3c36d628d88382042fcb7dc
Gerrit-Change-Number: 18908
Gerrit-PatchSet: 4
Gerrit-Owner: Daniel Carvalho <[email protected]>
Gerrit-Reviewer: Daniel Carvalho <[email protected]>
Gerrit-Reviewer: Nikos Nikoleris <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-CC: Javier Bueno Hedo <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to