mem-cache: 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
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/47201
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Maintainer: Daniel Carvalho <odanrc@yahoo.com.br>
This commit is contained in:
Nathanael Premillieu
2021-03-30 12:34:39 +02:00
parent 352ae672e2
commit b193c0adfd
4 changed files with 14 additions and 1 deletions

View File

@@ -99,6 +99,8 @@ class BaseCache(ClockedObject):
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(),

View File

@@ -77,6 +77,8 @@ class BasePrefetcher(ClockedObject):
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")

View File

@@ -100,6 +100,7 @@ Base::Base(const BasePrefetcherParams &p)
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)
@@ -153,7 +154,12 @@ Base::observeAccess(const PacketPtr &pkt, bool miss) const
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;

View File

@@ -295,6 +295,9 @@ class Base : public ClockedObject
/** 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;