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:
Tiago Mück
2022-09-08 16:17:35 -05:00
parent d8a04f902e
commit a63ff3c442
2 changed files with 27 additions and 1 deletions

View File

@@ -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"));
}
}

View File

@@ -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;