mem-cache: Fix update of useful prefetches
authorDaniel R. Carvalho <odanrc@yahoo.com.br>
Thu, 3 Dec 2020 11:06:25 +0000 (12:06 +0100)
committerDaniel Carvalho <odanrc@yahoo.com.br>
Wed, 13 Jan 2021 11:12:23 +0000 (11:12 +0000)
The probe notification must be parsed on every hit, even if
the prefetcher is set not to generate prefetches on accesses.
This fixes the calculation of useful prefetches.

Change-Id: Iff298f7bea11013f411f4ba39dba705fd81a0cd4
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38177
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
src/mem/cache/prefetch/base.cc

index 28aaa627d06a4d68a6f142386aa647093070d42a..e3479920d3651c7e8a38d0910a8c53644bb22f69 100644 (file)
@@ -125,6 +125,7 @@ Base::observeAccess(const PacketPtr &pkt, bool miss) const
     bool read = pkt->isRead();
     bool inv = pkt->isInvalidate();
 
+    if (!miss && !prefetchOnAccess) return false;
     if (pkt->req->isUncacheable()) return false;
     if (fetch && !onInst) return false;
     if (!fetch && !onData) return false;
@@ -236,10 +237,8 @@ Base::regProbeListeners()
                                                 true));
         listeners.push_back(new PrefetchListener(*this, pm, "Fill", true,
                                                  false));
-        if (prefetchOnAccess) {
-            listeners.push_back(new PrefetchListener(*this, pm, "Hit", false,
-                                                     false));
-        }
+        listeners.push_back(new PrefetchListener(*this, pm, "Hit", false,
+                                                 false));
     }
 }