Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/18208

Change subject: mem-cache: Fix increasing replacement count
......................................................................

mem-cache: Fix increasing replacement count

Replacements should be increased when there is any evicted
block, which does not necessarily have to be the victim.

For example, assume a superblock contains 4 blocks, and both
A and C are stored compressed (belonging to SB_1). Then F,
from SB2 needs to make room by replacing SB1. If F map to
location 2, the number of replacements should be increased,
even though 2 had no valid blocks:

 Tag      Data          Tag     Data
|SB_1|--|A|X|C|X|  --> |SB_2| |X|F|X|X|
         1 2 3 4               1 2 3 4

Change-Id: I7b3735d28a35faa8d8fa613a1555bb258da65859
Signed-off-by: Daniel R. Carvalho <[email protected]>
---
M src/mem/cache/base.cc
1 file changed, 8 insertions(+), 6 deletions(-)



diff --git a/src/mem/cache/base.cc b/src/mem/cache/base.cc
index 4be839b..10575b4 100644
--- a/src/mem/cache/base.cc
+++ b/src/mem/cache/base.cc
@@ -1328,12 +1328,14 @@

// The victim will be replaced by a new entry, so increase the replacement
     // counter if a valid block is being replaced
-    if (victim->isValid()) {
-        DPRINTF(Cache, "replacement: replacing %#llx (%s) with %#llx "
-                "(%s): %s\n", regenerateBlkAddr(victim),
-                victim->isSecure() ? "s" : "ns",
-                addr, is_secure ? "s" : "ns",
-                victim->isDirty() ? "writeback" : "clean");
+    if (evict_blks.size() > 0) {
+        for (const auto& blk : evict_blks) {
+            if (blk->isValid()) {
+ DPRINTF(CacheRepl, "Evicting %s (%#llx) to make room for " \ + "%#llx (%s)\n", blk->print(), regenerateBlkAddr(blk),
+                        addr, is_secure);
+            }
+        }

         replacements++;
     }

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/18208
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: I7b3735d28a35faa8d8fa613a1555bb258da65859
Gerrit-Change-Number: 18208
Gerrit-PatchSet: 1
Gerrit-Owner: Daniel Carvalho <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to