Nathanael Premillieu has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/47201 )

Change subject: mem: add option to send pf on hit on pf
......................................................................

mem: add option to send pf on hit on pf

From the point of view of the prefetchers, a hit on a prefetched block
should be considered the same as a miss: a new prefetch should be
generated.

Change-Id: If865324502b81cfd3ae8c009666d3f498092b90f
---
M src/mem/cache/Cache.py
M src/mem/cache/prefetch/Prefetcher.py
M src/mem/cache/prefetch/base.cc
M src/mem/cache/prefetch/base.hh
4 files changed, 14 insertions(+), 1 deletion(-)



diff --git a/src/mem/cache/Cache.py b/src/mem/cache/Cache.py
index a99d549..1398134 100644
--- a/src/mem/cache/Cache.py
+++ b/src/mem/cache/Cache.py
@@ -97,6 +97,8 @@
     prefetcher = Param.BasePrefetcher(NULL,"Prefetcher attached to cache")
     prefetch_on_access = Param.Bool(False,
"Notify the hardware prefetcher on every access (not just misses)")
+    prefetch_on_pf_hit = Param.Bool(False,
+        "Notify the hardware prefetcher on hit on prefetched lines")

     tags = Param.BaseTags(BaseSetAssoc(), "Tag store")
     replacement_policy = Param.BaseReplacementPolicy(LRURP(),
diff --git a/src/mem/cache/prefetch/Prefetcher.py b/src/mem/cache/prefetch/Prefetcher.py
index 0098763..048feb9 100644
--- a/src/mem/cache/prefetch/Prefetcher.py
+++ b/src/mem/cache/prefetch/Prefetcher.py
@@ -77,6 +77,8 @@
on_inst = Param.Bool(True, "Notify prefetcher on instruction accesses")
     prefetch_on_access = Param.Bool(Parent.prefetch_on_access,
         "Notify the hardware prefetcher on every access (not just misses)")
+    prefetch_on_pf_hit = Param.Bool(Parent.prefetch_on_pf_hit,
+        "Notify the hardware prefetcher on hit on prefetched lines")
     use_virtual_addresses = Param.Bool(False,
         "Use virtual addresses for prefetching")

diff --git a/src/mem/cache/prefetch/base.cc b/src/mem/cache/prefetch/base.cc
index 8c04033..3009feb 100644
--- a/src/mem/cache/prefetch/base.cc
+++ b/src/mem/cache/prefetch/base.cc
@@ -97,6 +97,7 @@
       requestorId(p.sys->getRequestorId(this)),
       pageBytes(p.sys->getPageBytes()),
       prefetchOnAccess(p.prefetch_on_access),
+      prefetchOnPfHit(p.prefetch_on_pf_hit),
       useVirtualAddresses(p.use_virtual_addresses),
       prefetchStats(this), issuedPrefetches(0),
       usefulPrefetches(0), tlb(nullptr)
@@ -151,7 +152,12 @@
     bool read = pkt->isRead();
     bool inv = pkt->isInvalidate();

-    if (!miss && !prefetchOnAccess) return false;
+    if (!miss) {
+        if (prefetchOnPfHit)
+            return hasBeenPrefetched(pkt->getAddr(), pkt->isSecure());
+        if (!prefetchOnAccess)
+            return false;
+    }
     if (pkt->req->isUncacheable()) return false;
     if (fetch && !onInst) return false;
     if (!fetch && !onData) return false;
diff --git a/src/mem/cache/prefetch/base.hh b/src/mem/cache/prefetch/base.hh
index c865da7..90c3f00 100644
--- a/src/mem/cache/prefetch/base.hh
+++ b/src/mem/cache/prefetch/base.hh
@@ -292,6 +292,9 @@
     /** Prefetch on every access, not just misses */
     const bool prefetchOnAccess;

+    /** Prefetch on hit on prefetched lines */
+    const bool prefetchOnPfHit;
+
     /** Use Virtual Addresses for prefetching */
     const bool useVirtualAddresses;


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/47201
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: If865324502b81cfd3ae8c009666d3f498092b90f
Gerrit-Change-Number: 47201
Gerrit-PatchSet: 1
Gerrit-Owner: Nathanael Premillieu <nathanael.premill...@huawei.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to