mem-cache: add prefetcher listener for evictions
Listener to data update probe notifies prefetcher of evictions. Prefetchers need to implement notifyEvict to make use of this information. Related JIRA: https://gem5.atlassian.net/browse/GEM5-457 https://gem5.atlassian.net/browse/GEM5-1112 Change-Id: I052cfdeba1e40ede077554ada104522f6a0cb2c7 Signed-off-by: Tiago Mück <tiago.muck@arm.com>
This commit is contained in:
9
src/mem/cache/prefetch/base.cc
vendored
9
src/mem/cache/prefetch/base.cc
vendored
@@ -92,6 +92,13 @@ Base::PrefetchListener::notify(const CacheAccessProbeArg &arg)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Base::PrefetchEvictListener::notify(const EvictionInfo &info)
|
||||
{
|
||||
if (info.newData.empty())
|
||||
parent.notifyEvict(info);
|
||||
}
|
||||
|
||||
Base::Base(const BasePrefetcherParams &p)
|
||||
: ClockedObject(p), listeners(), system(nullptr), probeManager(nullptr),
|
||||
blkSize(p.block_size), lBlkSize(floorLog2(blkSize)),
|
||||
@@ -274,6 +281,8 @@ Base::regProbeListeners()
|
||||
"Fill", true, false));
|
||||
listeners.push_back(new PrefetchListener(*this, probeManager,
|
||||
"Hit", false, false));
|
||||
listeners.push_back(new PrefetchEvictListener(*this, probeManager,
|
||||
"Data Update"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
19
src/mem/cache/prefetch/base.hh
vendored
19
src/mem/cache/prefetch/base.hh
vendored
@@ -86,7 +86,20 @@ class Base : public ClockedObject
|
||||
const bool miss;
|
||||
};
|
||||
|
||||
std::vector<PrefetchListener *> listeners;
|
||||
using EvictionInfo = CacheDataUpdateProbeArg;
|
||||
|
||||
class PrefetchEvictListener : public ProbeListenerArgBase<EvictionInfo>
|
||||
{
|
||||
public:
|
||||
PrefetchEvictListener(Base &_parent, ProbeManager *pm,
|
||||
const std::string &name)
|
||||
: ProbeListenerArgBase(pm, name), parent(_parent) {}
|
||||
void notify(const EvictionInfo &info) override;
|
||||
protected:
|
||||
Base &parent;
|
||||
};
|
||||
|
||||
std::vector<ProbeListener *> listeners;
|
||||
|
||||
public:
|
||||
|
||||
@@ -381,6 +394,10 @@ class Base : public ClockedObject
|
||||
virtual void notifyFill(const CacheAccessProbeArg &acc)
|
||||
{}
|
||||
|
||||
/** Notify prefetcher of cache eviction */
|
||||
virtual void notifyEvict(const EvictionInfo &info)
|
||||
{}
|
||||
|
||||
virtual PacketPtr getPacket() = 0;
|
||||
|
||||
virtual Tick nextPrefetchReadyTime() const = 0;
|
||||
|
||||
Reference in New Issue
Block a user