Create a namespace for the Prefetcher classes.
As a side effect the Prefetcher suffix has been removed from the
C++'s classes names, and the memory leaking destructor overrides
have been fixed.
Change-Id: I9bae492d2fd4734bcdfb68c164345898e65102b2
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24537
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
#include "sim/sim_exit.hh"
#include "sim/system.hh"
-class BasePrefetcher;
+namespace Prefetcher {
+ class Base;
+}
class MSHR;
class MasterPort;
class QueueEntry;
BaseCacheCompressor* compressor;
/** Prefetcher */
- BasePrefetcher *prefetcher;
+ Prefetcher::Base *prefetcher;
/** To probe when a cache hit occurs */
ProbePointArg<PacketPtr> *ppHit;
class BasePrefetcher(ClockedObject):
type = 'BasePrefetcher'
abstract = True
+ cxx_class = 'Prefetcher::Base'
cxx_header = "mem/cache/prefetch/base.hh"
cxx_exports = [
PyBindMethod("addEventProbe"),
class MultiPrefetcher(BasePrefetcher):
type = 'MultiPrefetcher'
- cxx_class = 'MultiPrefetcher'
+ cxx_class = 'Prefetcher::Multi'
cxx_header = 'mem/cache/prefetch/multi.hh'
prefetchers = VectorParam.BasePrefetcher([], "Array of prefetchers")
class QueuedPrefetcher(BasePrefetcher):
type = "QueuedPrefetcher"
abstract = True
- cxx_class = "QueuedPrefetcher"
+ cxx_class = "Prefetcher::Queued"
cxx_header = "mem/cache/prefetch/queued.hh"
latency = Param.Int(1, "Latency for generated prefetches")
queue_size = Param.Int(32, "Maximum number of queued prefetches")
class StridePrefetcher(QueuedPrefetcher):
type = 'StridePrefetcher'
- cxx_class = 'StridePrefetcher'
+ cxx_class = 'Prefetcher::Stride'
cxx_header = "mem/cache/prefetch/stride.hh"
# Do not consult stride prefetcher on instruction accesses
class TaggedPrefetcher(QueuedPrefetcher):
type = 'TaggedPrefetcher'
- cxx_class = 'TaggedPrefetcher'
+ cxx_class = 'Prefetcher::Tagged'
cxx_header = "mem/cache/prefetch/tagged.hh"
degree = Param.Int(2, "Number of prefetches to generate")
class IndirectMemoryPrefetcher(QueuedPrefetcher):
type = 'IndirectMemoryPrefetcher'
- cxx_class = 'IndirectMemoryPrefetcher'
+ cxx_class = 'Prefetcher::IndirectMemory'
cxx_header = "mem/cache/prefetch/indirect_memory.hh"
pt_table_entries = Param.MemorySize("16",
"Number of entries of the Prefetch Table")
class SignaturePathPrefetcher(QueuedPrefetcher):
type = 'SignaturePathPrefetcher'
- cxx_class = 'SignaturePathPrefetcher'
+ cxx_class = 'Prefetcher::SignaturePath'
cxx_header = "mem/cache/prefetch/signature_path.hh"
signature_shift = Param.UInt8(3,
class SignaturePathPrefetcherV2(SignaturePathPrefetcher):
type = 'SignaturePathPrefetcherV2'
- cxx_class = 'SignaturePathPrefetcherV2'
+ cxx_class = 'Prefetcher::SignaturePathV2'
cxx_header = "mem/cache/prefetch/signature_path_v2.hh"
signature_table_entries = "256"
class AccessMapPatternMatching(ClockedObject):
type = 'AccessMapPatternMatching'
- cxx_class = 'AccessMapPatternMatching'
+ cxx_class = 'Prefetcher::AccessMapPatternMatching'
cxx_header = "mem/cache/prefetch/access_map_pattern_matching.hh"
block_size = Param.Unsigned(Parent.block_size,
class AMPMPrefetcher(QueuedPrefetcher):
type = 'AMPMPrefetcher'
- cxx_class = 'AMPMPrefetcher'
+ cxx_class = 'Prefetcher::AMPM'
cxx_header = "mem/cache/prefetch/access_map_pattern_matching.hh"
ampm = Param.AccessMapPatternMatching( AccessMapPatternMatching(),
"Access Map Pattern Matching object")
class DeltaCorrelatingPredictionTables(SimObject):
type = 'DeltaCorrelatingPredictionTables'
- cxx_class = 'DeltaCorrelatingPredictionTables'
+ cxx_class = 'Prefetcher::DeltaCorrelatingPredictionTables'
cxx_header = "mem/cache/prefetch/delta_correlating_prediction_tables.hh"
deltas_per_entry = Param.Unsigned(20,
"Number of deltas stored in each table entry")
class DCPTPrefetcher(QueuedPrefetcher):
type = 'DCPTPrefetcher'
- cxx_class = 'DCPTPrefetcher'
+ cxx_class = 'Prefetcher::DCPT'
cxx_header = "mem/cache/prefetch/delta_correlating_prediction_tables.hh"
dcpt = Param.DeltaCorrelatingPredictionTables(
DeltaCorrelatingPredictionTables(),
class IrregularStreamBufferPrefetcher(QueuedPrefetcher):
type = "IrregularStreamBufferPrefetcher"
- cxx_class = "IrregularStreamBufferPrefetcher"
+ cxx_class = "Prefetcher::IrregularStreamBuffer"
cxx_header = "mem/cache/prefetch/irregular_stream_buffer.hh"
num_counter_bits = Param.Unsigned(2,
class SlimAMPMPrefetcher(QueuedPrefetcher):
type = 'SlimAMPMPrefetcher'
- cxx_class = 'SlimAMPMPrefetcher'
+ cxx_class = 'Prefetcher::SlimAMPM'
cxx_header = "mem/cache/prefetch/slim_ampm.hh"
ampm = Param.AccessMapPatternMatching(SlimAccessMapPatternMatching(),
class BOPPrefetcher(QueuedPrefetcher):
type = "BOPPrefetcher"
- cxx_class = "BOPPrefetcher"
+ cxx_class = "Prefetcher::BOP"
cxx_header = "mem/cache/prefetch/bop.hh"
score_max = Param.Unsigned(31, "Max. score to update the best offset")
round_max = Param.Unsigned(100, "Max. round to update the best offset")
class SBOOEPrefetcher(QueuedPrefetcher):
type = 'SBOOEPrefetcher'
- cxx_class = 'SBOOEPrefetcher'
+ cxx_class = 'Prefetcher::SBOOE'
cxx_header = "mem/cache/prefetch/sbooe.hh"
latency_buffer_size = Param.Int(32, "Entries in the latency buffer")
sequential_prefetchers = Param.Int(9, "Number of sequential prefetchers")
class STeMSPrefetcher(QueuedPrefetcher):
type = "STeMSPrefetcher"
- cxx_class = "STeMSPrefetcher"
+ cxx_class = "Prefetcher::STeMS"
cxx_header = "mem/cache/prefetch/spatio_temporal_memory_streaming.hh"
spatial_region_size = Param.MemorySize("2kB",
class PIFPrefetcher(QueuedPrefetcher):
type = 'PIFPrefetcher'
- cxx_class = 'PIFPrefetcher'
+ cxx_class = 'Prefetcher::PIF'
cxx_header = "mem/cache/prefetch/pif.hh"
cxx_exports = [
PyBindMethod("addEventProbeRetiredInsts"),
#include "params/AMPMPrefetcher.hh"
#include "params/AccessMapPatternMatching.hh"
+namespace Prefetcher {
+
AccessMapPatternMatching::AccessMapPatternMatching(
const AccessMapPatternMatchingParams *p)
: ClockedObject(p), blkSize(p->block_size), limitStride(p->limit_stride),
}
void
-AccessMapPatternMatching::calculatePrefetch(
- const BasePrefetcher::PrefetchInfo &pfi,
- std::vector<QueuedPrefetcher::AddrPriority> &addresses)
+AccessMapPatternMatching::calculatePrefetch(const Base::PrefetchInfo &pfi,
+ std::vector<Queued::AddrPriority> &addresses)
{
assert(addresses.empty());
pf_addr = am_addr * hotZoneSize + blk * blkSize;
setEntryState(*am_entry_curr, blk, AM_PREFETCH);
}
- addresses.push_back(QueuedPrefetcher::AddrPriority(pf_addr, 0));
+ addresses.push_back(Queued::AddrPriority(pf_addr, 0));
if (addresses.size() == degree) {
break;
}
pf_addr = am_addr * hotZoneSize + blk * blkSize;
setEntryState(*am_entry_curr, blk, AM_PREFETCH);
}
- addresses.push_back(QueuedPrefetcher::AddrPriority(pf_addr, 0));
+ addresses.push_back(Queued::AddrPriority(pf_addr, 0));
if (addresses.size() == degree) {
break;
}
}
}
-AccessMapPatternMatching*
-AccessMapPatternMatchingParams::create()
-{
- return new AccessMapPatternMatching(this);
-}
-
-AMPMPrefetcher::AMPMPrefetcher(const AMPMPrefetcherParams *p)
- : QueuedPrefetcher(p), ampm(*p->ampm)
+AMPM::AMPM(const AMPMPrefetcherParams *p)
+ : Queued(p), ampm(*p->ampm)
{
}
void
-AMPMPrefetcher::calculatePrefetch(const PrefetchInfo &pfi,
+AMPM::calculatePrefetch(const PrefetchInfo &pfi,
std::vector<AddrPriority> &addresses)
{
ampm.calculatePrefetch(pfi, addresses);
}
-AMPMPrefetcher*
+} // namespace Prefetcher
+
+Prefetcher::AccessMapPatternMatching*
+AccessMapPatternMatchingParams::create()
+{
+ return new Prefetcher::AccessMapPatternMatching(this);
+}
+
+Prefetcher::AMPM*
AMPMPrefetcherParams::create()
{
- return new AMPMPrefetcher(this);
+ return new Prefetcher::AMPM(this);
}
#include "sim/clocked_object.hh"
struct AccessMapPatternMatchingParams;
+struct AMPMPrefetcherParams;
+
+namespace Prefetcher {
class AccessMapPatternMatching : public ClockedObject
{
public:
AccessMapPatternMatching(const AccessMapPatternMatchingParams* p);
- ~AccessMapPatternMatching()
- {}
+ ~AccessMapPatternMatching() = default;
+
void startup() override;
- void calculatePrefetch(const BasePrefetcher::PrefetchInfo &pfi,
- std::vector<QueuedPrefetcher::AddrPriority> &addresses);
+ void calculatePrefetch(const Base::PrefetchInfo &pfi,
+ std::vector<Queued::AddrPriority> &addresses);
};
-struct AMPMPrefetcherParams;
-
-class AMPMPrefetcher : public QueuedPrefetcher
+class AMPM : public Queued
{
AccessMapPatternMatching &m;
public:
- AMPMPrefetcher(const AMPMPrefetcherParams* p);
- ~AMPMPrefetcher()
- {}
+ AMPM(const AMPMPrefetcherParams* p);
+ ~AMPM() = default;
+
void calculatePrefetch(const PrefetchInfo &pfi,
std::vector<AddrPriority> &addresses) override;
};
+
+} // namespace Prefetcher
+
#endif//__MEM_CACHE_PREFETCH_ACCESS_MAP_PATTERN_MATCHING_HH__
#include "params/BasePrefetcher.hh"
#include "sim/system.hh"
-BasePrefetcher::PrefetchInfo::PrefetchInfo(PacketPtr pkt, Addr addr, bool miss)
+namespace Prefetcher {
+
+Base::PrefetchInfo::PrefetchInfo(PacketPtr pkt, Addr addr, bool miss)
: address(addr), pc(pkt->req->hasPC() ? pkt->req->getPC() : 0),
masterId(pkt->req->masterId()), validPC(pkt->req->hasPC()),
secure(pkt->isSecure()), size(pkt->req->getSize()), write(pkt->isWrite()),
}
}
-BasePrefetcher::PrefetchInfo::PrefetchInfo(PrefetchInfo const &pfi, Addr addr)
+Base::PrefetchInfo::PrefetchInfo(PrefetchInfo const &pfi, Addr addr)
: address(addr), pc(pfi.pc), masterId(pfi.masterId), validPC(pfi.validPC),
secure(pfi.secure), size(pfi.size), write(pfi.write),
paddress(pfi.paddress), cacheMiss(pfi.cacheMiss), data(nullptr)
}
void
-BasePrefetcher::PrefetchListener::notify(const PacketPtr &pkt)
+Base::PrefetchListener::notify(const PacketPtr &pkt)
{
if (isFill) {
parent.notifyFill(pkt);
}
}
-BasePrefetcher::BasePrefetcher(const BasePrefetcherParams *p)
+Base::Base(const BasePrefetcherParams *p)
: ClockedObject(p), listeners(), cache(nullptr), blkSize(p->block_size),
lBlkSize(floorLog2(blkSize)), onMiss(p->on_miss), onRead(p->on_read),
onWrite(p->on_write), onData(p->on_data), onInst(p->on_inst),
}
void
-BasePrefetcher::setCache(BaseCache *_cache)
+Base::setCache(BaseCache *_cache)
{
assert(!cache);
cache = _cache;
}
void
-BasePrefetcher::regStats()
+Base::regStats()
{
ClockedObject::regStats();
}
bool
-BasePrefetcher::observeAccess(const PacketPtr &pkt, bool miss) const
+Base::observeAccess(const PacketPtr &pkt, bool miss) const
{
bool fetch = pkt->req->isInstFetch();
bool read = pkt->isRead();
}
bool
-BasePrefetcher::inCache(Addr addr, bool is_secure) const
+Base::inCache(Addr addr, bool is_secure) const
{
return cache->inCache(addr, is_secure);
}
bool
-BasePrefetcher::inMissQueue(Addr addr, bool is_secure) const
+Base::inMissQueue(Addr addr, bool is_secure) const
{
return cache->inMissQueue(addr, is_secure);
}
bool
-BasePrefetcher::hasBeenPrefetched(Addr addr, bool is_secure) const
+Base::hasBeenPrefetched(Addr addr, bool is_secure) const
{
return cache->hasBeenPrefetched(addr, is_secure);
}
bool
-BasePrefetcher::samePage(Addr a, Addr b) const
+Base::samePage(Addr a, Addr b) const
{
return roundDown(a, pageBytes) == roundDown(b, pageBytes);
}
Addr
-BasePrefetcher::blockAddress(Addr a) const
+Base::blockAddress(Addr a) const
{
return a & ~((Addr)blkSize-1);
}
Addr
-BasePrefetcher::blockIndex(Addr a) const
+Base::blockIndex(Addr a) const
{
return a >> lBlkSize;
}
Addr
-BasePrefetcher::pageAddress(Addr a) const
+Base::pageAddress(Addr a) const
{
return roundDown(a, pageBytes);
}
Addr
-BasePrefetcher::pageOffset(Addr a) const
+Base::pageOffset(Addr a) const
{
return a & (pageBytes - 1);
}
Addr
-BasePrefetcher::pageIthBlockAddress(Addr page, uint32_t blockIndex) const
+Base::pageIthBlockAddress(Addr page, uint32_t blockIndex) const
{
return page + (blockIndex << lBlkSize);
}
void
-BasePrefetcher::probeNotify(const PacketPtr &pkt, bool miss)
+Base::probeNotify(const PacketPtr &pkt, bool miss)
{
// Don't notify prefetcher on SWPrefetch, cache maintenance
// operations or for writes that we are coaslescing.
}
void
-BasePrefetcher::regProbeListeners()
+Base::regProbeListeners()
{
/**
* If no probes were added by the configuration scripts, connect to the
}
void
-BasePrefetcher::addEventProbe(SimObject *obj, const char *name)
+Base::addEventProbe(SimObject *obj, const char *name)
{
ProbeManager *pm(obj->getProbeManager());
listeners.push_back(new PrefetchListener(*this, pm, name));
}
void
-BasePrefetcher::addTLB(BaseTLB *t)
+Base::addTLB(BaseTLB *t)
{
fatal_if(tlb != nullptr, "Only one TLB can be registered");
tlb = t;
}
+
+} // namespace Prefetcher
class BaseCache;
struct BasePrefetcherParams;
-class BasePrefetcher : public ClockedObject
+namespace Prefetcher {
+
+class Base : public ClockedObject
{
class PrefetchListener : public ProbeListenerArgBase<PacketPtr>
{
public:
- PrefetchListener(BasePrefetcher &_parent, ProbeManager *pm,
+ PrefetchListener(Base &_parent, ProbeManager *pm,
const std::string &name, bool _isFill = false,
bool _miss = false)
: ProbeListenerArgBase(pm, name),
parent(_parent), isFill(_isFill), miss(_miss) {}
void notify(const PacketPtr &pkt) override;
protected:
- BasePrefetcher &parent;
+ Base &parent;
const bool isFill;
const bool miss;
};
BaseTLB * tlb;
public:
-
- BasePrefetcher(const BasePrefetcherParams *p);
-
- virtual ~BasePrefetcher() {}
+ Base(const BasePrefetcherParams *p);
+ virtual ~Base() = default;
virtual void setCache(BaseCache *_cache);
*/
void addTLB(BaseTLB *tlb);
};
+
+} // namespace Prefetcher
+
#endif //__MEM_CACHE_PREFETCH_BASE_HH__
#include "debug/HWPrefetch.hh"
#include "params/BOPPrefetcher.hh"
-BOPPrefetcher::BOPPrefetcher(const BOPPrefetcherParams *p)
- : QueuedPrefetcher(p),
+namespace Prefetcher {
+
+BOP::BOP(const BOPPrefetcherParams *p)
+ : Queued(p),
scoreMax(p->score_max), roundMax(p->round_max),
badScore(p->bad_score), rrEntries(p->rr_size),
tagMask((1 << p->tag_bits) - 1),
}
void
-BOPPrefetcher::delayQueueEventWrapper()
+BOP::delayQueueEventWrapper()
{
while (!delayQueue.empty() &&
delayQueue.front().processTick <= curTick())
}
unsigned int
-BOPPrefetcher::hash(Addr addr, unsigned int way) const
+BOP::hash(Addr addr, unsigned int way) const
{
Addr hash1 = addr >> way;
Addr hash2 = hash1 >> floorLog2(rrEntries);
}
void
-BOPPrefetcher::insertIntoRR(Addr addr, unsigned int way)
+BOP::insertIntoRR(Addr addr, unsigned int way)
{
switch (way) {
case RRWay::Left:
}
void
-BOPPrefetcher::insertIntoDelayQueue(Addr x)
+BOP::insertIntoDelayQueue(Addr x)
{
if (delayQueue.size() == delayQueueSize) {
return;
}
void
-BOPPrefetcher::resetScores()
+BOP::resetScores()
{
for (auto& it : offsetsList) {
it.second = 0;
}
inline Addr
-BOPPrefetcher::tag(Addr addr) const
+BOP::tag(Addr addr) const
{
return (addr >> blkSize) & tagMask;
}
bool
-BOPPrefetcher::testRR(Addr addr) const
+BOP::testRR(Addr addr) const
{
for (auto& it : rrLeft) {
if (it == addr) {
}
void
-BOPPrefetcher::bestOffsetLearning(Addr x)
+BOP::bestOffsetLearning(Addr x)
{
Addr offset_addr = (*offsetsListIterator).first;
Addr lookup_addr = x - offset_addr;
}
void
-BOPPrefetcher::calculatePrefetch(const PrefetchInfo &pfi,
+BOP::calculatePrefetch(const PrefetchInfo &pfi,
std::vector<AddrPriority> &addresses)
{
Addr addr = pfi.getAddr();
}
void
-BOPPrefetcher::notifyFill(const PacketPtr& pkt)
+BOP::notifyFill(const PacketPtr& pkt)
{
// Only insert into the RR right way if it's the pkt is a HWP
if (!pkt->cmd.isHWPrefetch()) return;
}
}
-BOPPrefetcher*
+} // namespace Prefetcher
+
+Prefetcher::BOP*
BOPPrefetcherParams::create()
{
- return new BOPPrefetcher(this);
+ return new Prefetcher::BOP(this);
}
struct BOPPrefetcherParams;
-class BOPPrefetcher : public QueuedPrefetcher
+namespace Prefetcher {
+
+class BOP : public Queued
{
private:
public:
- BOPPrefetcher(const BOPPrefetcherParams *p);
- ~BOPPrefetcher() {}
+ BOP(const BOPPrefetcherParams *p);
+ ~BOP() = default;
void calculatePrefetch(const PrefetchInfo &pfi,
std::vector<AddrPriority> &addresses) override;
};
+} // namespace Prefetcher
+
#endif /* __MEM_CACHE_PREFETCH_BOP_HH__ */
#include "params/DCPTPrefetcher.hh"
#include "params/DeltaCorrelatingPredictionTables.hh"
+namespace Prefetcher {
+
DeltaCorrelatingPredictionTables::DeltaCorrelatingPredictionTables(
DeltaCorrelatingPredictionTablesParams *p) : SimObject(p),
deltaBits(p->delta_bits), deltaMaskBits(p->delta_mask_bits),
void
DeltaCorrelatingPredictionTables::DCPTEntry::getCandidates(
- std::vector<QueuedPrefetcher::AddrPriority> &pfs, unsigned int mask) const
+ std::vector<Queued::AddrPriority> &pfs, unsigned int mask) const
{
// most recent index
unsigned int last = (deltaPointer - 1) % deltas.size();
do {
int pf_delta = deltas[(idx_0 + i) % deltas.size()];
addr += pf_delta;
- pfs.push_back(QueuedPrefetcher::AddrPriority(addr, 0));
+ pfs.push_back(Queued::AddrPriority(addr, 0));
i += 1;
} while (i < deltas.size() - 2);
}
void
DeltaCorrelatingPredictionTables::calculatePrefetch(
- const BasePrefetcher::PrefetchInfo &pfi,
- std::vector<QueuedPrefetcher::AddrPriority> &addresses)
+ const Base::PrefetchInfo &pfi,
+ std::vector<Queued::AddrPriority> &addresses)
{
if (!pfi.hasPC()) {
DPRINTF(HWPrefetch, "Ignoring request with no PC.\n");
}
}
-DeltaCorrelatingPredictionTables *
-DeltaCorrelatingPredictionTablesParams::create()
-{
- return new DeltaCorrelatingPredictionTables(this);
-}
-
-DCPTPrefetcher::DCPTPrefetcher(const DCPTPrefetcherParams *p)
- : QueuedPrefetcher(p), dcpt(*p->dcpt)
+DCPT::DCPT(const DCPTPrefetcherParams *p)
+ : Queued(p), dcpt(*p->dcpt)
{
}
void
-DCPTPrefetcher::calculatePrefetch(const PrefetchInfo &pfi,
+DCPT::calculatePrefetch(const PrefetchInfo &pfi,
std::vector<AddrPriority> &addresses)
{
dcpt.calculatePrefetch(pfi, addresses);
}
-DCPTPrefetcher*
+} // namespace Prefetcher
+
+Prefetcher::DeltaCorrelatingPredictionTables*
+DeltaCorrelatingPredictionTablesParams::create()
+{
+ return new Prefetcher::DeltaCorrelatingPredictionTables(this);
+}
+
+Prefetcher::DCPT*
DCPTPrefetcherParams::create()
{
- return new DCPTPrefetcher(this);
+ return new Prefetcher::DCPT(this);
}
#include "mem/cache/prefetch/queued.hh"
struct DeltaCorrelatingPredictionTablesParams;
+struct DCPTPrefetcherParams;
+
+namespace Prefetcher {
/**
* Delta Correlating Prediction Tables Prefetcher
* @param mask_bits the number of lower bits that should be masked
* (ignored) when comparing deltas
*/
- void getCandidates(std::vector<QueuedPrefetcher::AddrPriority> &pfs,
+ void getCandidates(std::vector<Queued::AddrPriority> &pfs,
unsigned int mask_bits) const;
};
public:
DeltaCorrelatingPredictionTables(
DeltaCorrelatingPredictionTablesParams *p);
- ~DeltaCorrelatingPredictionTables()
- {}
+ ~DeltaCorrelatingPredictionTables() = default;
/**
* Computes the prefetch candidates given a prefetch event.
* @param pfi The prefetch event information
* @param addresses prefetch candidates generated
*/
- void calculatePrefetch(const BasePrefetcher::PrefetchInfo &pfi,
- std::vector<QueuedPrefetcher::AddrPriority> &addresses);
+ void calculatePrefetch(const Base::PrefetchInfo &pfi,
+ std::vector<Queued::AddrPriority> &addresses);
};
-struct DCPTPrefetcherParams;
-
/** The prefetcher object using the DCPT */
-class DCPTPrefetcher : public QueuedPrefetcher
+class DCPT : public Queued
{
/** DCPT object */
DeltaCorrelatingPredictionTables &dcpt;
public:
- DCPTPrefetcher(const DCPTPrefetcherParams *p);
- ~DCPTPrefetcher()
- {}
+ DCPT(const DCPTPrefetcherParams *p);
+ ~DCPT() = default;
+
void calculatePrefetch(const PrefetchInfo &pfi,
std::vector<AddrPriority> &addresses) override;
};
+
+} // namespace Prefetcher
+
#endif//__MEM_CACHE_PREFETCH_DELTA_CORRELATING_PREDICTION_TABLES_HH_
#include "mem/cache/prefetch/associative_set_impl.hh"
#include "params/IndirectMemoryPrefetcher.hh"
-IndirectMemoryPrefetcher::IndirectMemoryPrefetcher(
- const IndirectMemoryPrefetcherParams *p) : QueuedPrefetcher(p),
+namespace Prefetcher {
+
+IndirectMemory::IndirectMemory(const IndirectMemoryPrefetcherParams *p)
+ : Queued(p),
maxPrefetchDistance(p->max_prefetch_distance),
shiftValues(p->shift_values), prefetchThreshold(p->prefetch_threshold),
streamCounterThreshold(p->stream_counter_threshold),
}
void
-IndirectMemoryPrefetcher::calculatePrefetch(const PrefetchInfo &pfi,
+IndirectMemory::calculatePrefetch(const PrefetchInfo &pfi,
std::vector<AddrPriority> &addresses)
{
// This prefetcher requires a PC
}
void
-IndirectMemoryPrefetcher::allocateOrUpdateIPDEntry(
+IndirectMemory::allocateOrUpdateIPDEntry(
const PrefetchTableEntry *pt_entry, int64_t index)
{
// The address of the pt_entry is used to index the IPD
}
void
-IndirectMemoryPrefetcher::trackMissIndex1(Addr miss_addr)
+IndirectMemory::trackMissIndex1(Addr miss_addr)
{
IndirectPatternDetectorEntry *entry = ipdEntryTrackingMisses;
// If the second index is not set, we are just filling the baseAddr
}
}
void
-IndirectMemoryPrefetcher::trackMissIndex2(Addr miss_addr)
+IndirectMemory::trackMissIndex2(Addr miss_addr)
{
IndirectPatternDetectorEntry *entry = ipdEntryTrackingMisses;
// Second index is filled, compare the addresses generated during
}
void
-IndirectMemoryPrefetcher::checkAccessMatchOnActiveEntries(Addr addr)
+IndirectMemory::checkAccessMatchOnActiveEntries(Addr addr)
{
for (auto &pt_entry : prefetchTable) {
if (pt_entry.enabled) {
}
}
-IndirectMemoryPrefetcher*
+} // namespace Prefetcher
+
+Prefetcher::IndirectMemory*
IndirectMemoryPrefetcherParams::create()
{
- return new IndirectMemoryPrefetcher(this);
+ return new Prefetcher::IndirectMemory(this);
}
struct IndirectMemoryPrefetcherParams;
-class IndirectMemoryPrefetcher : public QueuedPrefetcher
+namespace Prefetcher {
+
+class IndirectMemory : public Queued
{
/** Maximum number of prefetches generated per event */
const unsigned int maxPrefetchDistance;
void checkAccessMatchOnActiveEntries(Addr addr);
public:
- IndirectMemoryPrefetcher(const IndirectMemoryPrefetcherParams *p);
- ~IndirectMemoryPrefetcher() {}
+ IndirectMemory(const IndirectMemoryPrefetcherParams *p);
+ ~IndirectMemory() = default;
void calculatePrefetch(const PrefetchInfo &pfi,
std::vector<AddrPriority> &addresses) override;
};
+
+} // namespace Prefetcher
+
#endif//__MEM_CACHE_PREFETCH_INDIRECT_MEMORY_HH__
#include "mem/cache/prefetch/associative_set_impl.hh"
#include "params/IrregularStreamBufferPrefetcher.hh"
-IrregularStreamBufferPrefetcher::IrregularStreamBufferPrefetcher(
+namespace Prefetcher {
+
+IrregularStreamBuffer::IrregularStreamBuffer(
const IrregularStreamBufferPrefetcherParams *p)
- : QueuedPrefetcher(p),
- chunkSize(p->chunk_size),
- prefetchCandidatesPerEntry(p->prefetch_candidates_per_entry),
- degree(p->degree),
- trainingUnit(p->training_unit_assoc, p->training_unit_entries,
- p->training_unit_indexing_policy,
- p->training_unit_replacement_policy),
- psAddressMappingCache(p->address_map_cache_assoc,
- p->address_map_cache_entries,
- p->ps_address_map_cache_indexing_policy,
- p->ps_address_map_cache_replacement_policy,
- AddressMappingEntry(prefetchCandidatesPerEntry,
- p->num_counter_bits)),
- spAddressMappingCache(p->address_map_cache_assoc,
- p->address_map_cache_entries,
- p->sp_address_map_cache_indexing_policy,
- p->sp_address_map_cache_replacement_policy,
- AddressMappingEntry(prefetchCandidatesPerEntry,
- p->num_counter_bits)),
- structuralAddressCounter(0)
+ : Queued(p),
+ chunkSize(p->chunk_size),
+ prefetchCandidatesPerEntry(p->prefetch_candidates_per_entry),
+ degree(p->degree),
+ trainingUnit(p->training_unit_assoc, p->training_unit_entries,
+ p->training_unit_indexing_policy,
+ p->training_unit_replacement_policy),
+ psAddressMappingCache(p->address_map_cache_assoc,
+ p->address_map_cache_entries,
+ p->ps_address_map_cache_indexing_policy,
+ p->ps_address_map_cache_replacement_policy,
+ AddressMappingEntry(prefetchCandidatesPerEntry,
+ p->num_counter_bits)),
+ spAddressMappingCache(p->address_map_cache_assoc,
+ p->address_map_cache_entries,
+ p->sp_address_map_cache_indexing_policy,
+ p->sp_address_map_cache_replacement_policy,
+ AddressMappingEntry(prefetchCandidatesPerEntry,
+ p->num_counter_bits)),
+ structuralAddressCounter(0)
{
assert(isPowerOf2(prefetchCandidatesPerEntry));
}
void
-IrregularStreamBufferPrefetcher::calculatePrefetch(const PrefetchInfo &pfi,
+IrregularStreamBuffer::calculatePrefetch(const PrefetchInfo &pfi,
std::vector<AddrPriority> &addresses)
{
// This prefetcher requires a PC
}
}
-IrregularStreamBufferPrefetcher::AddressMapping&
-IrregularStreamBufferPrefetcher::getPSMapping(Addr paddr, bool is_secure)
+IrregularStreamBuffer::AddressMapping&
+IrregularStreamBuffer::getPSMapping(Addr paddr, bool is_secure)
{
Addr amc_address = paddr / prefetchCandidatesPerEntry;
Addr map_index = paddr % prefetchCandidatesPerEntry;
}
void
-IrregularStreamBufferPrefetcher::addStructuralToPhysicalEntry(
+IrregularStreamBuffer::addStructuralToPhysicalEntry(
Addr structural_address, bool is_secure, Addr physical_address)
{
Addr amc_address = structural_address / prefetchCandidatesPerEntry;
mapping.counter++;
}
-IrregularStreamBufferPrefetcher*
+} // namespace Prefetcher
+
+Prefetcher::IrregularStreamBuffer*
IrregularStreamBufferPrefetcherParams::create()
{
- return new IrregularStreamBufferPrefetcher(this);
+ return new Prefetcher::IrregularStreamBuffer(this);
}
struct IrregularStreamBufferPrefetcherParams;
-class IrregularStreamBufferPrefetcher : public QueuedPrefetcher
+namespace Prefetcher {
+
+class IrregularStreamBuffer : public Queued
{
/** Size in bytes of a temporal stream */
const size_t chunkSize;
*/
AddressMapping& getPSMapping(Addr paddr, bool is_secure);
public:
- IrregularStreamBufferPrefetcher(
- const IrregularStreamBufferPrefetcherParams *p);
- ~IrregularStreamBufferPrefetcher() {}
+ IrregularStreamBuffer(const IrregularStreamBufferPrefetcherParams *p);
+ ~IrregularStreamBuffer() = default;
+
void calculatePrefetch(const PrefetchInfo &pfi,
std::vector<AddrPriority> &addresses) override;
};
+
+} // namespace Prefetcher
+
#endif//__MEM_CACHE_PREFETCH_IRREGULAR_STREAM_BUFFER_HH__
#include "params/MultiPrefetcher.hh"
-MultiPrefetcher::MultiPrefetcher(const MultiPrefetcherParams *p)
- : BasePrefetcher(p),
- prefetchers(p->prefetchers.begin(), p->prefetchers.end())
+namespace Prefetcher {
+
+Multi::Multi(const MultiPrefetcherParams *p)
+ : Base(p),
+ prefetchers(p->prefetchers.begin(), p->prefetchers.end())
{
}
void
-MultiPrefetcher::setCache(BaseCache *_cache)
+Multi::setCache(BaseCache *_cache)
{
for (auto pf : prefetchers)
pf->setCache(_cache);
}
Tick
-MultiPrefetcher::nextPrefetchReadyTime() const
+Multi::nextPrefetchReadyTime() const
{
Tick next_ready = MaxTick;
}
PacketPtr
-MultiPrefetcher::getPacket()
+Multi::getPacket()
{
for (auto pf : prefetchers) {
if (pf->nextPrefetchReadyTime() <= curTick()) {
return nullptr;
}
+} // namespace Prefetcher
-MultiPrefetcher*
+Prefetcher::Multi*
MultiPrefetcherParams::create()
{
- return new MultiPrefetcher(this);
+ return new Prefetcher::Multi(this);
}
struct MultiPrefetcherParams;
-class MultiPrefetcher : public BasePrefetcher
+namespace Prefetcher {
+
+class Multi : public Base
{
public: // SimObject
- MultiPrefetcher(const MultiPrefetcherParams *p);
+ Multi(const MultiPrefetcherParams *p);
- public: // BasePrefetcher
+ public:
void setCache(BaseCache *_cache) override;
PacketPtr getPacket() override;
Tick nextPrefetchReadyTime() const override;
protected:
/** List of sub-prefetchers ordered by priority. */
- std::list<BasePrefetcher *> prefetchers;
+ std::list<Base*> prefetchers;
};
+} // namespace Prefetcher
+
#endif //__MEM_CACHE_PREFETCH_MULTI_HH__
#include "mem/cache/prefetch/associative_set_impl.hh"
#include "params/PIFPrefetcher.hh"
-PIFPrefetcher::PIFPrefetcher(const PIFPrefetcherParams *p)
- : QueuedPrefetcher(p),
+namespace Prefetcher {
+
+PIF::PIF(const PIFPrefetcherParams *p)
+ : Queued(p),
precSize(p->prec_spatial_region_bits),
succSize(p->succ_spatial_region_bits),
maxCompactorEntries(p->compactor_entries),
{
}
-PIFPrefetcher::CompactorEntry::CompactorEntry(Addr addr,
+PIF::CompactorEntry::CompactorEntry(Addr addr,
unsigned int prec_size, unsigned int succ_size)
{
trigger = addr;
}
Addr
-PIFPrefetcher::CompactorEntry::distanceFromTrigger(Addr target,
+PIF::CompactorEntry::distanceFromTrigger(Addr target,
unsigned int log_blk_size) const
{
const Addr target_blk = target >> log_blk_size;
}
bool
-PIFPrefetcher::CompactorEntry::inSameSpatialRegion(Addr pc,
+PIF::CompactorEntry::inSameSpatialRegion(Addr pc,
unsigned int log_blk_size, bool update)
{
Addr blk_distance = distanceFromTrigger(pc, log_blk_size);
}
bool
-PIFPrefetcher::CompactorEntry::hasAddress(Addr target,
+PIF::CompactorEntry::hasAddress(Addr target,
unsigned int log_blk_size) const
{
Addr blk_distance = distanceFromTrigger(target, log_blk_size);
}
void
-PIFPrefetcher::CompactorEntry::getPredictedAddresses(unsigned int log_blk_size,
+PIF::CompactorEntry::getPredictedAddresses(unsigned int log_blk_size,
std::vector<AddrPriority> &addresses) const
{
// Calculate the addresses of the instruction blocks that are encoded
}
void
-PIFPrefetcher::notifyRetiredInst(const Addr pc)
+PIF::notifyRetiredInst(const Addr pc)
{
// First access to the prefetcher
if (temporalCompactor.size() == 0) {
}
void
-PIFPrefetcher::calculatePrefetch(const PrefetchInfo &pfi,
+PIF::calculatePrefetch(const PrefetchInfo &pfi,
std::vector<AddrPriority> &addresses)
{
const Addr addr = pfi.getAddr();
}
void
-PIFPrefetcher::PrefetchListenerPC::notify(const Addr& pc)
+PIF::PrefetchListenerPC::notify(const Addr& pc)
{
parent.notifyRetiredInst(pc);
}
void
-PIFPrefetcher::addEventProbeRetiredInsts(SimObject *obj, const char *name)
+PIF::addEventProbeRetiredInsts(SimObject *obj, const char *name)
{
ProbeManager *pm(obj->getProbeManager());
listenersPC.push_back(new PrefetchListenerPC(*this, pm, name));
}
-PIFPrefetcher*
+} // namespace Prefetcher
+
+Prefetcher::PIF*
PIFPrefetcherParams::create()
{
- return new PIFPrefetcher(this);
+ return new Prefetcher::PIF(this);
}
struct PIFPrefetcherParams;
-class PIFPrefetcher : public QueuedPrefetcher
+namespace Prefetcher {
+
+class PIF : public Queued
{
private:
/** Number of preceding and subsequent spatial addresses to compact */
class PrefetchListenerPC : public ProbeListenerArgBase<Addr>
{
public:
- PrefetchListenerPC(PIFPrefetcher &_parent, ProbeManager *pm,
+ PrefetchListenerPC(PIF &_parent, ProbeManager *pm,
const std::string &name)
: ProbeListenerArgBase(pm, name),
parent(_parent) {}
void notify(const Addr& pc) override;
protected:
- PIFPrefetcher &parent;
+ PIF &parent;
};
/** Array of probe listeners */
public:
- PIFPrefetcher(const PIFPrefetcherParams *p);
- ~PIFPrefetcher() {}
+ PIF(const PIFPrefetcherParams *p);
+ ~PIF() = default;
void calculatePrefetch(const PrefetchInfo &pfi,
std::vector<AddrPriority> &addresses);
void addEventProbeRetiredInsts(SimObject *obj, const char *name);
};
+} // namespace Prefetcher
+
#endif // __MEM_CACHE_PREFETCH_PIF_HH__
#include "mem/request.hh"
#include "params/QueuedPrefetcher.hh"
+namespace Prefetcher {
+
void
-QueuedPrefetcher::DeferredPacket::createPkt(Addr paddr, unsigned blk_size,
+Queued::DeferredPacket::createPkt(Addr paddr, unsigned blk_size,
MasterID mid, bool tag_prefetch,
Tick t) {
/* Create a prefetch memory request */
}
void
-QueuedPrefetcher::DeferredPacket::startTranslation(BaseTLB *tlb)
+Queued::DeferredPacket::startTranslation(BaseTLB *tlb)
{
assert(translationRequest != nullptr);
if (!ongoingTranslation) {
}
void
-QueuedPrefetcher::DeferredPacket::finish(const Fault &fault,
+Queued::DeferredPacket::finish(const Fault &fault,
const RequestPtr &req, ThreadContext *tc, BaseTLB::Mode mode)
{
assert(ongoingTranslation);
owner->translationComplete(this, failed);
}
-QueuedPrefetcher::QueuedPrefetcher(const QueuedPrefetcherParams *p)
- : BasePrefetcher(p), queueSize(p->queue_size),
+Queued::Queued(const QueuedPrefetcherParams *p)
+ : Base(p), queueSize(p->queue_size),
missingTranslationQueueSize(
p->max_prefetch_requests_with_pending_translation),
latency(p->latency), queueSquash(p->queue_squash),
{
}
-QueuedPrefetcher::~QueuedPrefetcher()
+Queued::~Queued()
{
// Delete the queued prefetch packets
for (DeferredPacket &p : pfq) {
}
size_t
-QueuedPrefetcher::getMaxPermittedPrefetches(size_t total) const
+Queued::getMaxPermittedPrefetches(size_t total) const
{
/**
* Throttle generated prefetches based in the accuracy of the prefetcher.
}
void
-QueuedPrefetcher::notify(const PacketPtr &pkt, const PrefetchInfo &pfi)
+Queued::notify(const PacketPtr &pkt, const PrefetchInfo &pfi)
{
Addr blk_addr = blockAddress(pfi.getAddr());
bool is_secure = pfi.isSecure();
}
PacketPtr
-QueuedPrefetcher::getPacket()
+Queued::getPacket()
{
DPRINTF(HWPrefetch, "Requesting a prefetch to issue.\n");
}
void
-QueuedPrefetcher::regStats()
+Queued::regStats()
{
- BasePrefetcher::regStats();
+ Base::regStats();
pfIdentified
.name(name() + ".pfIdentified")
void
-QueuedPrefetcher::processMissingTranslations(unsigned max)
+Queued::processMissingTranslations(unsigned max)
{
unsigned count = 0;
iterator it = pfqMissingTranslation.begin();
}
void
-QueuedPrefetcher::translationComplete(DeferredPacket *dp, bool failed)
+Queued::translationComplete(DeferredPacket *dp, bool failed)
{
auto it = pfqMissingTranslation.begin();
while (it != pfqMissingTranslation.end()) {
}
bool
-QueuedPrefetcher::alreadyInQueue(std::list<DeferredPacket> &queue,
+Queued::alreadyInQueue(std::list<DeferredPacket> &queue,
const PrefetchInfo &pfi, int32_t priority)
{
bool found = false;
}
RequestPtr
-QueuedPrefetcher::createPrefetchRequest(Addr addr, PrefetchInfo const &pfi,
+Queued::createPrefetchRequest(Addr addr, PrefetchInfo const &pfi,
PacketPtr pkt)
{
RequestPtr translation_req = std::make_shared<Request>(
}
void
-QueuedPrefetcher::insert(const PacketPtr &pkt, PrefetchInfo &new_pfi,
+Queued::insert(const PacketPtr &pkt, PrefetchInfo &new_pfi,
int32_t priority)
{
if (queueFilter) {
}
void
-QueuedPrefetcher::addToQueue(std::list<DeferredPacket> &queue,
+Queued::addToQueue(std::list<DeferredPacket> &queue,
DeferredPacket &dpp)
{
/* Verify prefetch buffer space for request */
queue.insert(it, dpp);
}
}
+
+} // namespace Prefetcher
struct QueuedPrefetcherParams;
-class QueuedPrefetcher : public BasePrefetcher
+namespace Prefetcher {
+
+class Queued : public Base
{
protected:
struct DeferredPacket : public BaseTLB::Translation {
/** Owner of the packet */
- QueuedPrefetcher *owner;
+ Queued *owner;
/** Prefetch info corresponding to this packet */
PrefetchInfo pfInfo;
/** Time when this prefetch becomes ready */
* @param p PacketPtr with the memory request of the prefetch
* @param prio This prefetch priority
*/
- DeferredPacket(QueuedPrefetcher *o, PrefetchInfo const &pfi, Tick t,
+ DeferredPacket(Queued *o, PrefetchInfo const &pfi, Tick t,
int32_t prio) : owner(o), pfInfo(pfi), tick(t), pkt(nullptr),
priority(prio), translationRequest(), tc(nullptr),
ongoingTranslation(false) {
public:
using AddrPriority = std::pair<Addr, int32_t>;
- QueuedPrefetcher(const QueuedPrefetcherParams *p);
- virtual ~QueuedPrefetcher();
+ Queued(const QueuedPrefetcherParams *p);
+ virtual ~Queued();
void notify(const PacketPtr &pkt, const PrefetchInfo &pfi) override;
PacketPtr pkt);
};
+} // namespace Prefetcher
+
#endif //__MEM_CACHE_PREFETCH_QUEUED_HH__
#include "debug/HWPrefetch.hh"
#include "params/SBOOEPrefetcher.hh"
-SBOOEPrefetcher::SBOOEPrefetcher(const SBOOEPrefetcherParams *p)
- : QueuedPrefetcher(p),
+namespace Prefetcher {
+
+SBOOE::SBOOE(const SBOOEPrefetcherParams *p)
+ : Queued(p),
latencyBufferSize(p->latency_buffer_size),
sequentialPrefetchers(p->sequential_prefetchers),
scoreThreshold((p->sandbox_entries*p->score_threshold_pct)/100),
}
void
-SBOOEPrefetcher::Sandbox::insert(Addr addr, Tick tick)
+SBOOE::Sandbox::insert(Addr addr, Tick tick)
{
entries[index].valid = true;
entries[index].line = addr + stride;
}
bool
-SBOOEPrefetcher::access(Addr access_line)
+SBOOE::access(Addr access_line)
{
for (Sandbox &sb : sandboxes) {
// Search for the address in the FIFO queue
}
void
-SBOOEPrefetcher::notifyFill(const PacketPtr& pkt)
+SBOOE::notifyFill(const PacketPtr& pkt)
{
// (1) Look for the address in the demands list
// (2) Calculate the elapsed cycles until it was filled (curTick)
}
void
-SBOOEPrefetcher::calculatePrefetch(const PrefetchInfo &pfi,
+SBOOE::calculatePrefetch(const PrefetchInfo &pfi,
std::vector<AddrPriority> &addresses)
{
const Addr pfi_addr = pfi.getAddr();
}
}
-SBOOEPrefetcher*
+} // namespace Prefetcher
+
+Prefetcher::SBOOE*
SBOOEPrefetcherParams::create()
{
- return new SBOOEPrefetcher(this);
+ return new Prefetcher::SBOOE(this);
}
struct SBOOEPrefetcherParams;
-class SBOOEPrefetcher : public QueuedPrefetcher
+namespace Prefetcher {
+
+class SBOOE : public Queued
{
private:
void notifyFill(const PacketPtr& pkt) override;
public:
- SBOOEPrefetcher(const SBOOEPrefetcherParams *p);
+ SBOOE(const SBOOEPrefetcherParams *p);
void calculatePrefetch(const PrefetchInfo &pfi,
std::vector<AddrPriority> &addresses) override;
};
+} // namespace Prefetcher
+
#endif // __MEM_CACHE_PREFETCH_SBOOE_HH__
#include "mem/cache/prefetch/associative_set_impl.hh"
#include "params/SignaturePathPrefetcher.hh"
-SignaturePathPrefetcher::SignaturePathPrefetcher(
- const SignaturePathPrefetcherParams *p)
- : QueuedPrefetcher(p),
+namespace Prefetcher {
+
+SignaturePath::SignaturePath(const SignaturePathPrefetcherParams *p)
+ : Queued(p),
stridesPerPatternEntry(p->strides_per_pattern_entry),
signatureShift(p->signature_shift),
signatureBits(p->signature_bits),
"The lookahead confidence threshold must be less than 1\n");
}
-SignaturePathPrefetcher::PatternStrideEntry &
-SignaturePathPrefetcher::PatternEntry::getStrideEntry(stride_t stride)
+SignaturePath::PatternStrideEntry &
+SignaturePath::PatternEntry::getStrideEntry(stride_t stride)
{
PatternStrideEntry *pstride_entry = findStride(stride);
if (pstride_entry == nullptr) {
}
void
-SignaturePathPrefetcher::addPrefetch(Addr ppn, stride_t last_block,
+SignaturePath::addPrefetch(Addr ppn, stride_t last_block,
stride_t delta, double path_confidence, signature_t signature,
bool is_secure, std::vector<AddrPriority> &addresses)
{
}
void
-SignaturePathPrefetcher::handleSignatureTableMiss(stride_t current_block,
+SignaturePath::handleSignatureTableMiss(stride_t current_block,
signature_t &new_signature, double &new_conf, stride_t &new_stride)
{
new_signature = current_block;
}
void
-SignaturePathPrefetcher::increasePatternEntryCounter(
+SignaturePath::increasePatternEntryCounter(
PatternEntry &pattern_entry, PatternStrideEntry &pstride_entry)
{
pstride_entry.counter++;
}
void
-SignaturePathPrefetcher::updatePatternTable(Addr signature, stride_t stride)
+SignaturePath::updatePatternTable(Addr signature, stride_t stride)
{
assert(stride != 0);
// The pattern table is indexed by signatures
increasePatternEntryCounter(p_entry, ps_entry);
}
-SignaturePathPrefetcher::SignatureEntry &
-SignaturePathPrefetcher::getSignatureEntry(Addr ppn, bool is_secure,
+SignaturePath::SignatureEntry &
+SignaturePath::getSignatureEntry(Addr ppn, bool is_secure,
stride_t block, bool &miss, stride_t &stride,
double &initial_confidence)
{
return *signature_entry;
}
-SignaturePathPrefetcher::PatternEntry &
-SignaturePathPrefetcher::getPatternEntry(Addr signature)
+SignaturePath::PatternEntry &
+SignaturePath::getPatternEntry(Addr signature)
{
PatternEntry* pattern_entry = patternTable.findEntry(signature, false);
if (pattern_entry != nullptr) {
}
double
-SignaturePathPrefetcher::calculatePrefetchConfidence(PatternEntry const &sig,
+SignaturePath::calculatePrefetchConfidence(PatternEntry const &sig,
PatternStrideEntry const &entry) const
{
return entry.counter.calcSaturation();
}
double
-SignaturePathPrefetcher::calculateLookaheadConfidence(PatternEntry const &sig,
+SignaturePath::calculateLookaheadConfidence(PatternEntry const &sig,
PatternStrideEntry const &lookahead) const
{
double lookahead_confidence = lookahead.counter.calcSaturation();
}
void
-SignaturePathPrefetcher::calculatePrefetch(const PrefetchInfo &pfi,
+SignaturePath::calculatePrefetch(const PrefetchInfo &pfi,
std::vector<AddrPriority> &addresses)
{
Addr request_addr = pfi.getAddr();
}
void
-SignaturePathPrefetcher::auxiliaryPrefetcher(Addr ppn, stride_t current_block,
+SignaturePath::auxiliaryPrefetcher(Addr ppn, stride_t current_block,
bool is_secure, std::vector<AddrPriority> &addresses)
{
if (addresses.empty()) {
}
}
-SignaturePathPrefetcher*
+} // namespace Prefetcher
+
+Prefetcher::SignaturePath*
SignaturePathPrefetcherParams::create()
{
- return new SignaturePathPrefetcher(this);
+ return new Prefetcher::SignaturePath(this);
}
struct SignaturePathPrefetcherParams;
-class SignaturePathPrefetcher : public QueuedPrefetcher
+namespace Prefetcher {
+
+class SignaturePath : public Queued
{
protected:
/** Signature type */
}
public:
- SignaturePathPrefetcher(const SignaturePathPrefetcherParams* p);
- ~SignaturePathPrefetcher() {}
+ SignaturePath(const SignaturePathPrefetcherParams* p);
+ ~SignaturePath() = default;
+
void calculatePrefetch(const PrefetchInfo &pfi,
std::vector<AddrPriority> &addresses) override;
};
+} // namespace Prefetcher
+
#endif//__MEM_CACHE_PREFETCH_SIGNATURE_PATH_HH__
#include "mem/cache/prefetch/associative_set_impl.hh"
#include "params/SignaturePathPrefetcherV2.hh"
-SignaturePathPrefetcherV2::SignaturePathPrefetcherV2(
- const SignaturePathPrefetcherV2Params *p)
- : SignaturePathPrefetcher(p),
+namespace Prefetcher {
+
+SignaturePathV2::SignaturePathV2(const SignaturePathPrefetcherV2Params *p)
+ : SignaturePath(p),
globalHistoryRegister(p->global_history_register_entries,
p->global_history_register_entries,
p->global_history_register_indexing_policy,
}
void
-SignaturePathPrefetcherV2::handleSignatureTableMiss(stride_t current_block,
+SignaturePathV2::handleSignatureTableMiss(stride_t current_block,
signature_t &new_signature, double &new_conf, stride_t &new_stride)
{
bool found = false;
}
double
-SignaturePathPrefetcherV2::calculateLookaheadConfidence(
+SignaturePathV2::calculateLookaheadConfidence(
PatternEntry const &sig, PatternStrideEntry const &lookahead) const
{
if (sig.counter == 0) return 0.0;
}
double
-SignaturePathPrefetcherV2::calculatePrefetchConfidence(PatternEntry const &sig,
+SignaturePathV2::calculatePrefetchConfidence(PatternEntry const &sig,
PatternStrideEntry const &entry) const
{
if (sig.counter == 0) return 0.0;
}
void
-SignaturePathPrefetcherV2::increasePatternEntryCounter(
+SignaturePathV2::increasePatternEntryCounter(
PatternEntry &pattern_entry, PatternStrideEntry &pstride_entry)
{
if (pattern_entry.counter.isSaturated()) {
}
void
-SignaturePathPrefetcherV2::handlePageCrossingLookahead(signature_t signature,
+SignaturePathV2::handlePageCrossingLookahead(signature_t signature,
stride_t last_offset, stride_t delta, double path_confidence)
{
// Always use the replacement policy to assign new entries, as all
gh_entry->confidence = path_confidence;
}
-SignaturePathPrefetcherV2*
+} // namespace Prefetcher
+
+Prefetcher::SignaturePathV2*
SignaturePathPrefetcherV2Params::create()
{
- return new SignaturePathPrefetcherV2(this);
+ return new Prefetcher::SignaturePathV2(this);
}
struct SignaturePathPrefetcherV2Params;
-class SignaturePathPrefetcherV2 : public SignaturePathPrefetcher
+namespace Prefetcher {
+
+class SignaturePathV2 : public SignaturePath
{
/** Global History Register entry datatype */
struct GlobalHistoryEntry : public TaggedEntry
override;
public:
- SignaturePathPrefetcherV2(const SignaturePathPrefetcherV2Params* p);
- ~SignaturePathPrefetcherV2() {}
+ SignaturePathV2(const SignaturePathPrefetcherV2Params* p);
+ ~SignaturePathV2() = default;
};
+} // namespace Prefetcher
+
#endif//__MEM_CACHE_PREFETCH_SIGNATURE_PATH_V2_HH__
#include "params/SlimAMPMPrefetcher.hh"
-SlimAMPMPrefetcher::SlimAMPMPrefetcher(const SlimAMPMPrefetcherParams* p)
- : QueuedPrefetcher(p), ampm(*p->ampm), dcpt(*p->dcpt)
+namespace Prefetcher {
+
+SlimAMPM::SlimAMPM(const SlimAMPMPrefetcherParams* p)
+ : Queued(p), ampm(*p->ampm), dcpt(*p->dcpt)
{
}
void
-SlimAMPMPrefetcher::calculatePrefetch(const PrefetchInfo &pfi,
+SlimAMPM::calculatePrefetch(const PrefetchInfo &pfi,
std::vector<AddrPriority> &addresses)
{
dcpt.calculatePrefetch(pfi, addresses);
}
}
-SlimAMPMPrefetcher*
+} // namespace Prefetcher
+
+Prefetcher::SlimAMPM*
SlimAMPMPrefetcherParams::create()
{
- return new SlimAMPMPrefetcher(this);
+ return new Prefetcher::SlimAMPM(this);
}
struct SlimAMPMPrefetcherParams;
-class SlimAMPMPrefetcher : public QueuedPrefetcher
+namespace Prefetcher {
+
+class SlimAMPM : public Queued
{
/** AMPM prefetcher object */
AccessMapPatternMatching &m;
/** DCPT prefetcher object */
DeltaCorrelatingPredictionTables &dcpt;
public:
- SlimAMPMPrefetcher(const SlimAMPMPrefetcherParams *p);
- ~SlimAMPMPrefetcher()
- {}
+ SlimAMPM(const SlimAMPMPrefetcherParams *p);
+ ~SlimAMPM() = default;
void calculatePrefetch(const PrefetchInfo &pfi,
std::vector<AddrPriority> &addresses) override;
};
+
+} // namespace Prefetcher
+
#endif//__MEM_CACHE_PREFETCH_SLIM_AMPM_HH__
#include "mem/cache/prefetch/associative_set_impl.hh"
#include "params/STeMSPrefetcher.hh"
-STeMSPrefetcher::STeMSPrefetcher(const STeMSPrefetcherParams *p)
- : QueuedPrefetcher(p), spatialRegionSize(p->spatial_region_size),
+namespace Prefetcher {
+
+STeMS::STeMS(const STeMSPrefetcherParams *p)
+ : Queued(p), spatialRegionSize(p->spatial_region_size),
spatialRegionSizeBits(floorLog2(p->spatial_region_size)),
reconstructionEntries(p->reconstruction_entries),
activeGenerationTable(p->active_generation_table_assoc,
}
void
-STeMSPrefetcher::checkForActiveGenerationsEnd() {
+STeMS::checkForActiveGenerationsEnd()
+{
// This prefetcher operates attached to the L1 and it observes all
// accesses, this guarantees that no evictions are missed
}
void
-STeMSPrefetcher::addToRMOB(Addr sr_addr, Addr pst_addr, unsigned int delta)
+STeMS::addToRMOB(Addr sr_addr, Addr pst_addr, unsigned int delta)
{
RegionMissOrderBufferEntry &rmob_entry = rmob[rmobHead];
rmobHead = (rmobHead + 1) % rmob.size();
}
void
-STeMSPrefetcher::calculatePrefetch(const PrefetchInfo &pfi,
+STeMS::calculatePrefetch(const PrefetchInfo &pfi,
std::vector<AddrPriority> &addresses)
{
if (!pfi.hasPC()) {
}
void
-STeMSPrefetcher::reconstructSequence(unsigned int rmob_idx,
+STeMS::reconstructSequence(unsigned int rmob_idx,
std::vector<AddrPriority> &addresses)
{
std::vector<Addr> reconstruction(reconstructionEntries, MaxAddr);
}
}
-STeMSPrefetcher *
+} // namespace Prefetcher
+
+Prefetcher::STeMS*
STeMSPrefetcherParams::create()
{
- return new STeMSPrefetcher(this);
+ return new Prefetcher::STeMS(this);
}
struct STeMSPrefetcherParams;
-class STeMSPrefetcher : public QueuedPrefetcher
+namespace Prefetcher {
+
+class STeMS : public Queued
{
/** Size of each spatial region */
const size_t spatialRegionSize;
void reconstructSequence(unsigned int rmob_idx,
std::vector<AddrPriority> &addresses);
public:
- STeMSPrefetcher(const STeMSPrefetcherParams* p);
- ~STeMSPrefetcher() {}
+ STeMS(const STeMSPrefetcherParams* p);
+ ~STeMS() = default;
+
void calculatePrefetch(const PrefetchInfo &pfi,
std::vector<AddrPriority> &addresses) override;
};
+} // namespace Prefetcher
+
#endif//__MEM_CACHE_PREFETCH_SPATIO_TEMPORAL_MEMORY_STREAMING_HH__
#include "mem/cache/replacement_policies/base.hh"
#include "params/StridePrefetcher.hh"
-StridePrefetcher::StrideEntry::StrideEntry()
+namespace Prefetcher {
+
+Stride::StrideEntry::StrideEntry()
{
invalidate();
}
void
-StridePrefetcher::StrideEntry::invalidate()
+Stride::StrideEntry::invalidate()
{
instAddr = 0;
lastAddr = 0;
confidence = 0;
}
-StridePrefetcher::StridePrefetcher(const StridePrefetcherParams *p)
- : QueuedPrefetcher(p),
+Stride::Stride(const StridePrefetcherParams *p)
+ : Queued(p),
maxConf(p->max_conf),
threshConf(p->thresh_conf),
minConf(p->min_conf),
assert(isPowerOf2(pcTableSets));
}
-StridePrefetcher::PCTable*
-StridePrefetcher::findTable(int context)
+Stride::PCTable*
+Stride::findTable(int context)
{
// Check if table for given context exists
auto it = pcTables.find(context);
return allocateNewContext(context);
}
-StridePrefetcher::PCTable*
-StridePrefetcher::allocateNewContext(int context)
+Stride::PCTable*
+Stride::allocateNewContext(int context)
{
// Create new table
auto insertion_result = pcTables.insert(std::make_pair(context,
return &(insertion_result.first->second);
}
-StridePrefetcher::PCTable::PCTable(int assoc, int sets, const std::string name,
+Stride::PCTable::PCTable(int assoc, int sets, const std::string name,
BaseReplacementPolicy* replacementPolicy)
: pcTableSets(sets), _name(name), entries(pcTableSets),
replacementPolicy(replacementPolicy)
}
}
-StridePrefetcher::PCTable::~PCTable()
+Stride::PCTable::~PCTable()
{
}
void
-StridePrefetcher::calculatePrefetch(const PrefetchInfo &pfi,
+Stride::calculatePrefetch(const PrefetchInfo &pfi,
std::vector<AddrPriority> &addresses)
{
if (!pfi.hasPC()) {
}
inline Addr
-StridePrefetcher::PCTable::pcHash(Addr pc) const
+Stride::PCTable::pcHash(Addr pc) const
{
Addr hash1 = pc >> 1;
Addr hash2 = hash1 >> floorLog2(pcTableSets);
return (hash1 ^ hash2) & (Addr)(pcTableSets - 1);
}
-inline StridePrefetcher::StrideEntry*
-StridePrefetcher::PCTable::findVictim(Addr pc)
+inline Stride::StrideEntry*
+Stride::PCTable::findVictim(Addr pc)
{
// Rand replacement for now
int set = pcHash(pc);
return victim;
}
-inline StridePrefetcher::StrideEntry*
-StridePrefetcher::PCTable::findEntry(Addr pc, bool is_secure)
+inline Stride::StrideEntry*
+Stride::PCTable::findEntry(Addr pc, bool is_secure)
{
int set = pcHash(pc);
for (auto& entry : entries[set]) {
return nullptr;
}
-StridePrefetcher*
+} // namespace Prefetcher
+
+Prefetcher::Stride*
StridePrefetcherParams::create()
{
- return new StridePrefetcher(this);
+ return new Prefetcher::Stride(this);
}
class BaseReplacementPolicy;
struct StridePrefetcherParams;
-class StridePrefetcher : public QueuedPrefetcher
+namespace Prefetcher {
+
+class Stride : public Queued
{
protected:
const int maxConf;
PCTable* allocateNewContext(int context);
public:
- StridePrefetcher(const StridePrefetcherParams *p);
+ Stride(const StridePrefetcherParams *p);
void calculatePrefetch(const PrefetchInfo &pfi,
std::vector<AddrPriority> &addresses) override;
};
+} // namespace Prefetcher
+
#endif // __MEM_CACHE_PREFETCH_STRIDE_HH__
#include "params/TaggedPrefetcher.hh"
-TaggedPrefetcher::TaggedPrefetcher(const TaggedPrefetcherParams *p)
- : QueuedPrefetcher(p), degree(p->degree)
+namespace Prefetcher {
+
+Tagged::Tagged(const TaggedPrefetcherParams *p)
+ : Queued(p), degree(p->degree)
{
}
void
-TaggedPrefetcher::calculatePrefetch(const PrefetchInfo &pfi,
- std::vector<AddrPriority> &addresses)
+Tagged::calculatePrefetch(const PrefetchInfo &pfi,
+ std::vector<AddrPriority> &addresses)
{
Addr blkAddr = blockAddress(pfi.getAddr());
}
}
-TaggedPrefetcher*
+} // namespace Prefetcher
+
+Prefetcher::Tagged*
TaggedPrefetcherParams::create()
{
- return new TaggedPrefetcher(this);
+ return new Prefetcher::Tagged(this);
}
struct TaggedPrefetcherParams;
-class TaggedPrefetcher : public QueuedPrefetcher
+namespace Prefetcher {
+
+class Tagged : public Queued
{
protected:
const int degree;
public:
- TaggedPrefetcher(const TaggedPrefetcherParams *p);
-
- ~TaggedPrefetcher() {}
+ Tagged(const TaggedPrefetcherParams *p);
+ ~Tagged() = default;
void calculatePrefetch(const PrefetchInfo &pfi,
std::vector<AddrPriority> &addresses) override;
};
+} // namespace Prefetcher
+
#endif // __MEM_CACHE_PREFETCH_TAGGED_HH__