mem-cache: change hasBeenPrefetched
hasBeenPrefetched can now take a requestor id and returns true only if the block was prefetched by a prefetcher with the same id. This may be necessary to properly train multiple prefetchers attached to the same cache. If returns true if the block was prefetched by any prefetcher when the id is not provided. Related JIRA: https://gem5.atlassian.net/browse/GEM5-457 https://gem5.atlassian.net/browse/GEM5-1112 Change-Id: I205e000fd5ff100e5a5d24d88bca7c6a46689ab2 Signed-off-by: Tiago Mück <tiago.muck@arm.com>
This commit is contained in:
17
src/mem/cache/base.hh
vendored
17
src/mem/cache/base.hh
vendored
@@ -327,6 +327,10 @@ class BaseCache : public ClockedObject
|
||||
bool hasBeenPrefetched(Addr addr, bool is_secure) const override
|
||||
{ return cache.hasBeenPrefetched(addr, is_secure); }
|
||||
|
||||
bool hasBeenPrefetched(Addr addr, bool is_secure,
|
||||
RequestorID requestor) const override
|
||||
{ return cache.hasBeenPrefetched(addr, is_secure, requestor); }
|
||||
|
||||
bool inMissQueue(Addr addr, bool is_secure) const override
|
||||
{ return cache.inMissQueue(addr, is_secure); }
|
||||
|
||||
@@ -1277,11 +1281,14 @@ class BaseCache : public ClockedObject
|
||||
|
||||
bool hasBeenPrefetched(Addr addr, bool is_secure) const {
|
||||
CacheBlk *block = tags->findBlock(addr, is_secure);
|
||||
if (block) {
|
||||
return block->wasPrefetched();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return block && block->wasPrefetched();
|
||||
}
|
||||
|
||||
bool hasBeenPrefetched(Addr addr, bool is_secure,
|
||||
RequestorID requestor) const {
|
||||
CacheBlk *block = tags->findBlock(addr, is_secure);
|
||||
return block && block->wasPrefetched() &&
|
||||
(block->getSrcRequestorId() == requestor);
|
||||
}
|
||||
|
||||
bool inMissQueue(Addr addr, bool is_secure) const {
|
||||
|
||||
4
src/mem/cache/cache_probe_arg.hh
vendored
4
src/mem/cache/cache_probe_arg.hh
vendored
@@ -59,6 +59,10 @@ struct CacheAccessor
|
||||
/** Determine if address has been prefetched */
|
||||
virtual bool hasBeenPrefetched(Addr addr, bool is_secure) const = 0;
|
||||
|
||||
/** Determine if address has been prefetched by the requestor */
|
||||
virtual bool hasBeenPrefetched(Addr addr, bool is_secure,
|
||||
RequestorID requestor) const = 0;
|
||||
|
||||
/** Determine if address is in cache miss queue */
|
||||
virtual bool inMissQueue(Addr addr, bool is_secure) const = 0;
|
||||
|
||||
|
||||
3
src/mem/cache/prefetch/base.cc
vendored
3
src/mem/cache/prefetch/base.cc
vendored
@@ -244,7 +244,8 @@ Base::probeNotify(const CacheAccessProbeArg &acc, bool miss)
|
||||
}
|
||||
|
||||
bool has_been_prefetched =
|
||||
acc.cache.hasBeenPrefetched(pkt->getAddr(), pkt->isSecure());
|
||||
acc.cache.hasBeenPrefetched(pkt->getAddr(), pkt->isSecure(),
|
||||
requestorId);
|
||||
if (has_been_prefetched) {
|
||||
usefulPrefetches += 1;
|
||||
prefetchStats.pfUseful++;
|
||||
|
||||
Reference in New Issue
Block a user