Daniel Carvalho has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/24537 )
Change subject: mem-cache: Create Prefetcher namespace
......................................................................
mem-cache: Create Prefetcher namespace
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 <oda...@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24537
Reviewed-by: Nikos Nikoleris <nikos.nikole...@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikole...@arm.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M src/mem/cache/base.hh
M src/mem/cache/prefetch/Prefetcher.py
M src/mem/cache/prefetch/access_map_pattern_matching.cc
M src/mem/cache/prefetch/access_map_pattern_matching.hh
M src/mem/cache/prefetch/base.cc
M src/mem/cache/prefetch/base.hh
M src/mem/cache/prefetch/bop.cc
M src/mem/cache/prefetch/bop.hh
M src/mem/cache/prefetch/delta_correlating_prediction_tables.cc
M src/mem/cache/prefetch/delta_correlating_prediction_tables.hh
M src/mem/cache/prefetch/indirect_memory.cc
M src/mem/cache/prefetch/indirect_memory.hh
M src/mem/cache/prefetch/irregular_stream_buffer.cc
M src/mem/cache/prefetch/irregular_stream_buffer.hh
M src/mem/cache/prefetch/multi.cc
M src/mem/cache/prefetch/multi.hh
M src/mem/cache/prefetch/pif.cc
M src/mem/cache/prefetch/pif.hh
M src/mem/cache/prefetch/queued.cc
M src/mem/cache/prefetch/queued.hh
M src/mem/cache/prefetch/sbooe.cc
M src/mem/cache/prefetch/sbooe.hh
M src/mem/cache/prefetch/signature_path.cc
M src/mem/cache/prefetch/signature_path.hh
M src/mem/cache/prefetch/signature_path_v2.cc
M src/mem/cache/prefetch/signature_path_v2.hh
M src/mem/cache/prefetch/slim_ampm.cc
M src/mem/cache/prefetch/slim_ampm.hh
M src/mem/cache/prefetch/spatio_temporal_memory_streaming.cc
M src/mem/cache/prefetch/spatio_temporal_memory_streaming.hh
M src/mem/cache/prefetch/stride.cc
M src/mem/cache/prefetch/stride.hh
M src/mem/cache/prefetch/tagged.cc
M src/mem/cache/prefetch/tagged.hh
34 files changed, 434 insertions(+), 305 deletions(-)
Approvals:
Nikos Nikoleris: Looks good to me, approved; Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/mem/cache/base.hh b/src/mem/cache/base.hh
index e77bfe0..3efc7c7 100644
--- a/src/mem/cache/base.hh
+++ b/src/mem/cache/base.hh
@@ -75,7 +75,9 @@
#include "sim/sim_exit.hh"
#include "sim/system.hh"
-class BasePrefetcher;
+namespace Prefetcher {
+ class Base;
+}
class MSHR;
class MasterPort;
class QueueEntry;
@@ -321,7 +323,7 @@
BaseCacheCompressor* compressor;
/** Prefetcher */
- BasePrefetcher *prefetcher;
+ Prefetcher::Base *prefetcher;
/** To probe when a cache hit occurs */
ProbePointArg<PacketPtr> *ppHit;
diff --git a/src/mem/cache/prefetch/Prefetcher.py
b/src/mem/cache/prefetch/Prefetcher.py
index 33eb1ea..8cfefe1 100644
--- a/src/mem/cache/prefetch/Prefetcher.py
+++ b/src/mem/cache/prefetch/Prefetcher.py
@@ -59,6 +59,7 @@
class BasePrefetcher(ClockedObject):
type = 'BasePrefetcher'
abstract = True
+ cxx_class = 'Prefetcher::Base'
cxx_header = "mem/cache/prefetch/base.hh"
cxx_exports = [
PyBindMethod("addEventProbe"),
@@ -106,7 +107,7 @@
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")
@@ -114,7 +115,7 @@
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")
@@ -140,7 +141,7 @@
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
@@ -163,14 +164,14 @@
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")
@@ -205,7 +206,7 @@
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,
@@ -245,7 +246,7 @@
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"
@@ -268,7 +269,7 @@
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,
@@ -307,14 +308,14 @@
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")
@@ -334,7 +335,7 @@
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(),
@@ -342,7 +343,7 @@
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,
@@ -395,7 +396,7 @@
class SlimAMPMPrefetcher(QueuedPrefetcher):
type = 'SlimAMPMPrefetcher'
- cxx_class = 'SlimAMPMPrefetcher'
+ cxx_class = 'Prefetcher::SlimAMPM'
cxx_header = "mem/cache/prefetch/slim_ampm.hh"
ampm = Param.AccessMapPatternMatching(SlimAccessMapPatternMatching(),
@@ -406,7 +407,7 @@
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")
@@ -428,7 +429,7 @@
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")
@@ -438,7 +439,7 @@
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",
@@ -481,7 +482,7 @@
class PIFPrefetcher(QueuedPrefetcher):
type = 'PIFPrefetcher'
- cxx_class = 'PIFPrefetcher'
+ cxx_class = 'Prefetcher::PIF'
cxx_header = "mem/cache/prefetch/pif.hh"
cxx_exports = [
PyBindMethod("addEventProbeRetiredInsts"),
diff --git a/src/mem/cache/prefetch/access_map_pattern_matching.cc
b/src/mem/cache/prefetch/access_map_pattern_matching.cc
index 4d4acd6..28371c7 100644
--- a/src/mem/cache/prefetch/access_map_pattern_matching.cc
+++ b/src/mem/cache/prefetch/access_map_pattern_matching.cc
@@ -33,6 +33,8 @@
#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),
@@ -149,9 +151,8 @@
}
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());
@@ -218,7 +219,7 @@
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;
}
@@ -242,7 +243,7 @@
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;
}
@@ -250,26 +251,28 @@
}
}
-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);
}
diff --git a/src/mem/cache/prefetch/access_map_pattern_matching.hh
b/src/mem/cache/prefetch/access_map_pattern_matching.hh
index abc1503..0064917 100644
--- a/src/mem/cache/prefetch/access_map_pattern_matching.hh
+++ b/src/mem/cache/prefetch/access_map_pattern_matching.hh
@@ -44,6 +44,9 @@
#include "sim/clocked_object.hh"
struct AccessMapPatternMatchingParams;
+struct AMPMPrefetcherParams;
+
+namespace Prefetcher {
class AccessMapPatternMatching : public ClockedObject
{
@@ -179,23 +182,24 @@
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__
diff --git a/src/mem/cache/prefetch/base.cc b/src/mem/cache/prefetch/base.cc
index f574092..d4223aa 100644
--- a/src/mem/cache/prefetch/base.cc
+++ b/src/mem/cache/prefetch/base.cc
@@ -53,7 +53,9 @@
#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()),
@@ -69,7 +71,7 @@
}
}
-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)
@@ -77,7 +79,7 @@
}
void
-BasePrefetcher::PrefetchListener::notify(const PacketPtr &pkt)
+Base::PrefetchListener::notify(const PacketPtr &pkt)
{
if (isFill) {
parent.notifyFill(pkt);
@@ -86,7 +88,7 @@
}
}
-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),
@@ -98,7 +100,7 @@
}
void
-BasePrefetcher::setCache(BaseCache *_cache)
+Base::setCache(BaseCache *_cache)
{
assert(!cache);
cache = _cache;
@@ -109,7 +111,7 @@
}
void
-BasePrefetcher::regStats()
+Base::regStats()
{
ClockedObject::regStats();
@@ -121,7 +123,7 @@
}
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();
@@ -143,61 +145,61 @@
}
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.
@@ -225,7 +227,7 @@
}
void
-BasePrefetcher::regProbeListeners()
+Base::regProbeListeners()
{
/**
* If no probes were added by the configuration scripts, connect to the
@@ -246,15 +248,17 @@
}
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
diff --git a/src/mem/cache/prefetch/base.hh b/src/mem/cache/prefetch/base.hh
index ebe97c3..7009db7 100644
--- a/src/mem/cache/prefetch/base.hh
+++ b/src/mem/cache/prefetch/base.hh
@@ -61,19 +61,21 @@
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;
};
@@ -328,10 +330,8 @@
BaseTLB * tlb;
public:
-
- BasePrefetcher(const BasePrefetcherParams *p);
-
- virtual ~BasePrefetcher() {}
+ Base(const BasePrefetcherParams *p);
+ virtual ~Base() = default;
virtual void setCache(BaseCache *_cache);
@@ -381,4 +381,7 @@
*/
void addTLB(BaseTLB *tlb);
};
+
+} // namespace Prefetcher
+
#endif //__MEM_CACHE_PREFETCH_BASE_HH__
diff --git a/src/mem/cache/prefetch/bop.cc b/src/mem/cache/prefetch/bop.cc
index 3881c73..83eeda1 100644
--- a/src/mem/cache/prefetch/bop.cc
+++ b/src/mem/cache/prefetch/bop.cc
@@ -31,8 +31,10 @@
#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),
@@ -91,7 +93,7 @@
}
void
-BOPPrefetcher::delayQueueEventWrapper()
+BOP::delayQueueEventWrapper()
{
while (!delayQueue.empty() &&
delayQueue.front().processTick <= curTick())
@@ -108,7 +110,7 @@
}
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);
@@ -116,7 +118,7 @@
}
void
-BOPPrefetcher::insertIntoRR(Addr addr, unsigned int way)
+BOP::insertIntoRR(Addr addr, unsigned int way)
{
switch (way) {
case RRWay::Left:
@@ -129,7 +131,7 @@
}
void
-BOPPrefetcher::insertIntoDelayQueue(Addr x)
+BOP::insertIntoDelayQueue(Addr x)
{
if (delayQueue.size() == delayQueueSize) {
return;
@@ -147,7 +149,7 @@
}
void
-BOPPrefetcher::resetScores()
+BOP::resetScores()
{
for (auto& it : offsetsList) {
it.second = 0;
@@ -155,13 +157,13 @@
}
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) {
@@ -179,7 +181,7 @@
}
void
-BOPPrefetcher::bestOffsetLearning(Addr x)
+BOP::bestOffsetLearning(Addr x)
{
Addr offset_addr = (*offsetsListIterator).first;
Addr lookup_addr = x - offset_addr;
@@ -220,7 +222,7 @@
}
void
-BOPPrefetcher::calculatePrefetch(const PrefetchInfo &pfi,
+BOP::calculatePrefetch(const PrefetchInfo &pfi,
std::vector<AddrPriority> &addresses)
{
Addr addr = pfi.getAddr();
@@ -246,7 +248,7 @@
}
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;
@@ -258,8 +260,10 @@
}
}
-BOPPrefetcher*
+} // namespace Prefetcher
+
+Prefetcher::BOP*
BOPPrefetcherParams::create()
{
- return new BOPPrefetcher(this);
+ return new Prefetcher::BOP(this);
}
diff --git a/src/mem/cache/prefetch/bop.hh b/src/mem/cache/prefetch/bop.hh
index a784bf0..d4252af 100644
--- a/src/mem/cache/prefetch/bop.hh
+++ b/src/mem/cache/prefetch/bop.hh
@@ -43,7 +43,9 @@
struct BOPPrefetcherParams;
-class BOPPrefetcher : public QueuedPrefetcher
+namespace Prefetcher {
+
+class BOP : public Queued
{
private:
@@ -145,11 +147,13 @@
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__ */
diff --git a/src/mem/cache/prefetch/delta_correlating_prediction_tables.cc
b/src/mem/cache/prefetch/delta_correlating_prediction_tables.cc
index 505cbc7..ba9d22f 100644
--- a/src/mem/cache/prefetch/delta_correlating_prediction_tables.cc
+++ b/src/mem/cache/prefetch/delta_correlating_prediction_tables.cc
@@ -33,6 +33,8 @@
#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),
@@ -80,7 +82,7 @@
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();
@@ -115,7 +117,7 @@
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);
}
@@ -124,8 +126,8 @@
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");
@@ -149,26 +151,28 @@
}
}
-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);
}
diff --git a/src/mem/cache/prefetch/delta_correlating_prediction_tables.hh
b/src/mem/cache/prefetch/delta_correlating_prediction_tables.hh
index 6ac2c41..c051eca 100644
--- a/src/mem/cache/prefetch/delta_correlating_prediction_tables.hh
+++ b/src/mem/cache/prefetch/delta_correlating_prediction_tables.hh
@@ -33,6 +33,9 @@
#include "mem/cache/prefetch/queued.hh"
struct DeltaCorrelatingPredictionTablesParams;
+struct DCPTPrefetcherParams;
+
+namespace Prefetcher {
/**
* Delta Correlating Prediction Tables Prefetcher
@@ -95,7 +98,7 @@
* @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;
};
@@ -105,31 +108,31 @@
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_
diff --git a/src/mem/cache/prefetch/indirect_memory.cc
b/src/mem/cache/prefetch/indirect_memory.cc
index 3eed8c9..ac825fd 100644
--- a/src/mem/cache/prefetch/indirect_memory.cc
+++ b/src/mem/cache/prefetch/indirect_memory.cc
@@ -32,8 +32,10 @@
#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),
@@ -56,7 +58,7 @@
}
void
-IndirectMemoryPrefetcher::calculatePrefetch(const PrefetchInfo &pfi,
+IndirectMemory::calculatePrefetch(const PrefetchInfo &pfi,
std::vector<AddrPriority> &addresses)
{
// This prefetcher requires a PC
@@ -164,7 +166,7 @@
}
void
-IndirectMemoryPrefetcher::allocateOrUpdateIPDEntry(
+IndirectMemory::allocateOrUpdateIPDEntry(
const PrefetchTableEntry *pt_entry, int64_t index)
{
// The address of the pt_entry is used to index the IPD
@@ -194,7 +196,7 @@
}
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
@@ -213,7 +215,7 @@
}
}
void
-IndirectMemoryPrefetcher::trackMissIndex2(Addr miss_addr)
+IndirectMemory::trackMissIndex2(Addr miss_addr)
{
IndirectPatternDetectorEntry *entry = ipdEntryTrackingMisses;
// Second index is filled, compare the addresses generated during
@@ -246,7 +248,7 @@
}
void
-IndirectMemoryPrefetcher::checkAccessMatchOnActiveEntries(Addr addr)
+IndirectMemory::checkAccessMatchOnActiveEntries(Addr addr)
{
for (auto &pt_entry : prefetchTable) {
if (pt_entry.enabled) {
@@ -259,8 +261,10 @@
}
}
-IndirectMemoryPrefetcher*
+} // namespace Prefetcher
+
+Prefetcher::IndirectMemory*
IndirectMemoryPrefetcherParams::create()
{
- return new IndirectMemoryPrefetcher(this);
+ return new Prefetcher::IndirectMemory(this);
}
diff --git a/src/mem/cache/prefetch/indirect_memory.hh
b/src/mem/cache/prefetch/indirect_memory.hh
index 40a3aa3..e5bc1e7 100644
--- a/src/mem/cache/prefetch/indirect_memory.hh
+++ b/src/mem/cache/prefetch/indirect_memory.hh
@@ -47,7 +47,9 @@
struct IndirectMemoryPrefetcherParams;
-class IndirectMemoryPrefetcher : public QueuedPrefetcher
+namespace Prefetcher {
+
+class IndirectMemory : public Queued
{
/** Maximum number of prefetches generated per event */
const unsigned int maxPrefetchDistance;
@@ -191,10 +193,13 @@
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__
diff --git a/src/mem/cache/prefetch/irregular_stream_buffer.cc
b/src/mem/cache/prefetch/irregular_stream_buffer.cc
index 5ee05b6..9c83ec8 100644
--- a/src/mem/cache/prefetch/irregular_stream_buffer.cc
+++ b/src/mem/cache/prefetch/irregular_stream_buffer.cc
@@ -32,34 +32,36 @@
#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
@@ -165,8 +167,8 @@
}
}
-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;
@@ -185,7 +187,7 @@
}
void
-IrregularStreamBufferPrefetcher::addStructuralToPhysicalEntry(
+IrregularStreamBuffer::addStructuralToPhysicalEntry(
Addr structural_address, bool is_secure, Addr physical_address)
{
Addr amc_address = structural_address / prefetchCandidatesPerEntry;
@@ -206,8 +208,10 @@
mapping.counter++;
}
-IrregularStreamBufferPrefetcher*
+} // namespace Prefetcher
+
+Prefetcher::IrregularStreamBuffer*
IrregularStreamBufferPrefetcherParams::create()
{
- return new IrregularStreamBufferPrefetcher(this);
+ return new Prefetcher::IrregularStreamBuffer(this);
}
diff --git a/src/mem/cache/prefetch/irregular_stream_buffer.hh
b/src/mem/cache/prefetch/irregular_stream_buffer.hh
index af62676..4796902 100644
--- a/src/mem/cache/prefetch/irregular_stream_buffer.hh
+++ b/src/mem/cache/prefetch/irregular_stream_buffer.hh
@@ -45,7 +45,9 @@
struct IrregularStreamBufferPrefetcherParams;
-class IrregularStreamBufferPrefetcher : public QueuedPrefetcher
+namespace Prefetcher {
+
+class IrregularStreamBuffer : public Queued
{
/** Size in bytes of a temporal stream */
const size_t chunkSize;
@@ -125,10 +127,13 @@
*/
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__
diff --git a/src/mem/cache/prefetch/multi.cc
b/src/mem/cache/prefetch/multi.cc
index 94e6c9c..fd22636 100644
--- a/src/mem/cache/prefetch/multi.cc
+++ b/src/mem/cache/prefetch/multi.cc
@@ -39,21 +39,23 @@
#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;
@@ -64,7 +66,7 @@
}
PacketPtr
-MultiPrefetcher::getPacket()
+Multi::getPacket()
{
for (auto pf : prefetchers) {
if (pf->nextPrefetchReadyTime() <= curTick()) {
@@ -77,9 +79,10 @@
return nullptr;
}
+} // namespace Prefetcher
-MultiPrefetcher*
+Prefetcher::Multi*
MultiPrefetcherParams::create()
{
- return new MultiPrefetcher(this);
+ return new Prefetcher::Multi(this);
}
diff --git a/src/mem/cache/prefetch/multi.hh
b/src/mem/cache/prefetch/multi.hh
index 0f72173..c01d0c2 100644
--- a/src/mem/cache/prefetch/multi.hh
+++ b/src/mem/cache/prefetch/multi.hh
@@ -42,12 +42,14 @@
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;
@@ -63,7 +65,9 @@
protected:
/** List of sub-prefetchers ordered by priority. */
- std::list<BasePrefetcher *> prefetchers;
+ std::list<Base*> prefetchers;
};
+} // namespace Prefetcher
+
#endif //__MEM_CACHE_PREFETCH_MULTI_HH__
diff --git a/src/mem/cache/prefetch/pif.cc b/src/mem/cache/prefetch/pif.cc
index fb974dd..8491062 100644
--- a/src/mem/cache/prefetch/pif.cc
+++ b/src/mem/cache/prefetch/pif.cc
@@ -34,8 +34,10 @@
#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),
@@ -48,7 +50,7 @@
{
}
-PIFPrefetcher::CompactorEntry::CompactorEntry(Addr addr,
+PIF::CompactorEntry::CompactorEntry(Addr addr,
unsigned int prec_size, unsigned int succ_size)
{
trigger = addr;
@@ -57,7 +59,7 @@
}
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;
@@ -68,7 +70,7 @@
}
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);
@@ -86,7 +88,7 @@
}
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);
@@ -102,7 +104,7 @@
}
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
@@ -128,7 +130,7 @@
}
void
-PIFPrefetcher::notifyRetiredInst(const Addr pc)
+PIF::notifyRetiredInst(const Addr pc)
{
// First access to the prefetcher
if (temporalCompactor.size() == 0) {
@@ -195,7 +197,7 @@
}
void
-PIFPrefetcher::calculatePrefetch(const PrefetchInfo &pfi,
+PIF::calculatePrefetch(const PrefetchInfo &pfi,
std::vector<AddrPriority> &addresses)
{
const Addr addr = pfi.getAddr();
@@ -239,20 +241,22 @@
}
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);
}
diff --git a/src/mem/cache/prefetch/pif.hh b/src/mem/cache/prefetch/pif.hh
index 6d93830..9fef296 100644
--- a/src/mem/cache/prefetch/pif.hh
+++ b/src/mem/cache/prefetch/pif.hh
@@ -45,7 +45,9 @@
struct PIFPrefetcherParams;
-class PIFPrefetcher : public QueuedPrefetcher
+namespace Prefetcher {
+
+class PIF : public Queued
{
private:
/** Number of preceding and subsequent spatial addresses to
compact */
@@ -158,13 +160,13 @@
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 */
@@ -172,8 +174,8 @@
public:
- PIFPrefetcher(const PIFPrefetcherParams *p);
- ~PIFPrefetcher() {}
+ PIF(const PIFPrefetcherParams *p);
+ ~PIF() = default;
void calculatePrefetch(const PrefetchInfo &pfi,
std::vector<AddrPriority> &addresses);
@@ -186,4 +188,6 @@
void addEventProbeRetiredInsts(SimObject *obj, const char *name);
};
+} // namespace Prefetcher
+
#endif // __MEM_CACHE_PREFETCH_PIF_HH__
diff --git a/src/mem/cache/prefetch/queued.cc
b/src/mem/cache/prefetch/queued.cc
index ceab7b3..e6d2b7c 100644
--- a/src/mem/cache/prefetch/queued.cc
+++ b/src/mem/cache/prefetch/queued.cc
@@ -47,8 +47,10 @@
#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 */
@@ -68,7 +70,7 @@
}
void
-QueuedPrefetcher::DeferredPacket::startTranslation(BaseTLB *tlb)
+Queued::DeferredPacket::startTranslation(BaseTLB *tlb)
{
assert(translationRequest != nullptr);
if (!ongoingTranslation) {
@@ -79,7 +81,7 @@
}
void
-QueuedPrefetcher::DeferredPacket::finish(const Fault &fault,
+Queued::DeferredPacket::finish(const Fault &fault,
const RequestPtr &req, ThreadContext *tc, BaseTLB::Mode mode)
{
assert(ongoingTranslation);
@@ -88,8 +90,8 @@
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),
@@ -99,7 +101,7 @@
{
}
-QueuedPrefetcher::~QueuedPrefetcher()
+Queued::~Queued()
{
// Delete the queued prefetch packets
for (DeferredPacket &p : pfq) {
@@ -108,7 +110,7 @@
}
size_t
-QueuedPrefetcher::getMaxPermittedPrefetches(size_t total) const
+Queued::getMaxPermittedPrefetches(size_t total) const
{
/**
* Throttle generated prefetches based in the accuracy of the
prefetcher.
@@ -138,7 +140,7 @@
}
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();
@@ -194,7 +196,7 @@
}
PacketPtr
-QueuedPrefetcher::getPacket()
+Queued::getPacket()
{
DPRINTF(HWPrefetch, "Requesting a prefetch to issue.\n");
@@ -222,9 +224,9 @@
}
void
-QueuedPrefetcher::regStats()
+Queued::regStats()
{
- BasePrefetcher::regStats();
+ Base::regStats();
pfIdentified
.name(name() + ".pfIdentified")
@@ -249,7 +251,7 @@
void
-QueuedPrefetcher::processMissingTranslations(unsigned max)
+Queued::processMissingTranslations(unsigned max)
{
unsigned count = 0;
iterator it = pfqMissingTranslation.begin();
@@ -264,7 +266,7 @@
}
void
-QueuedPrefetcher::translationComplete(DeferredPacket *dp, bool failed)
+Queued::translationComplete(DeferredPacket *dp, bool failed)
{
auto it = pfqMissingTranslation.begin();
while (it != pfqMissingTranslation.end()) {
@@ -301,7 +303,7 @@
}
bool
-QueuedPrefetcher::alreadyInQueue(std::list<DeferredPacket> &queue,
+Queued::alreadyInQueue(std::list<DeferredPacket> &queue,
const PrefetchInfo &pfi, int32_t priority)
{
bool found = false;
@@ -336,7 +338,7 @@
}
RequestPtr
-QueuedPrefetcher::createPrefetchRequest(Addr addr, PrefetchInfo const &pfi,
+Queued::createPrefetchRequest(Addr addr, PrefetchInfo const &pfi,
PacketPtr pkt)
{
RequestPtr translation_req = std::make_shared<Request>(
@@ -347,7 +349,7 @@
}
void
-QueuedPrefetcher::insert(const PacketPtr &pkt, PrefetchInfo &new_pfi,
+Queued::insert(const PacketPtr &pkt, PrefetchInfo &new_pfi,
int32_t priority)
{
if (queueFilter) {
@@ -445,7 +447,7 @@
}
void
-QueuedPrefetcher::addToQueue(std::list<DeferredPacket> &queue,
+Queued::addToQueue(std::list<DeferredPacket> &queue,
DeferredPacket &dpp)
{
/* Verify prefetch buffer space for request */
@@ -490,3 +492,5 @@
queue.insert(it, dpp);
}
}
+
+} // namespace Prefetcher
diff --git a/src/mem/cache/prefetch/queued.hh
b/src/mem/cache/prefetch/queued.hh
index 24c9f48..5af9093 100644
--- a/src/mem/cache/prefetch/queued.hh
+++ b/src/mem/cache/prefetch/queued.hh
@@ -49,12 +49,14 @@
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 */
@@ -76,7 +78,7 @@
* @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) {
@@ -175,8 +177,8 @@
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;
@@ -245,5 +247,7 @@
PacketPtr pkt);
};
+} // namespace Prefetcher
+
#endif //__MEM_CACHE_PREFETCH_QUEUED_HH__
diff --git a/src/mem/cache/prefetch/sbooe.cc
b/src/mem/cache/prefetch/sbooe.cc
index 9486b0a..ecbab68 100644
--- a/src/mem/cache/prefetch/sbooe.cc
+++ b/src/mem/cache/prefetch/sbooe.cc
@@ -31,8 +31,10 @@
#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),
@@ -52,7 +54,7 @@
}
void
-SBOOEPrefetcher::Sandbox::insert(Addr addr, Tick tick)
+SBOOE::Sandbox::insert(Addr addr, Tick tick)
{
entries[index].valid = true;
entries[index].line = addr + stride;
@@ -66,7 +68,7 @@
}
bool
-SBOOEPrefetcher::access(Addr access_line)
+SBOOE::access(Addr access_line)
{
for (Sandbox &sb : sandboxes) {
// Search for the address in the FIFO queue
@@ -92,7 +94,7 @@
}
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)
@@ -119,7 +121,7 @@
}
void
-SBOOEPrefetcher::calculatePrefetch(const PrefetchInfo &pfi,
+SBOOE::calculatePrefetch(const PrefetchInfo &pfi,
std::vector<AddrPriority> &addresses)
{
const Addr pfi_addr = pfi.getAddr();
@@ -139,8 +141,10 @@
}
}
-SBOOEPrefetcher*
+} // namespace Prefetcher
+
+Prefetcher::SBOOE*
SBOOEPrefetcherParams::create()
{
- return new SBOOEPrefetcher(this);
+ return new Prefetcher::SBOOE(this);
}
diff --git a/src/mem/cache/prefetch/sbooe.hh
b/src/mem/cache/prefetch/sbooe.hh
index 0370294..8076732 100644
--- a/src/mem/cache/prefetch/sbooe.hh
+++ b/src/mem/cache/prefetch/sbooe.hh
@@ -44,7 +44,9 @@
struct SBOOEPrefetcherParams;
-class SBOOEPrefetcher : public QueuedPrefetcher
+namespace Prefetcher {
+
+class SBOOE : public Queued
{
private:
@@ -147,10 +149,12 @@
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__
diff --git a/src/mem/cache/prefetch/signature_path.cc
b/src/mem/cache/prefetch/signature_path.cc
index 8689b53..556a003 100644
--- a/src/mem/cache/prefetch/signature_path.cc
+++ b/src/mem/cache/prefetch/signature_path.cc
@@ -35,9 +35,10 @@
#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),
@@ -61,8 +62,8 @@
"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) {
@@ -89,7 +90,7 @@
}
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)
{
@@ -130,7 +131,7 @@
}
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;
@@ -139,14 +140,14 @@
}
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
@@ -155,8 +156,8 @@
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)
{
@@ -180,8 +181,8 @@
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) {
@@ -198,14 +199,14 @@
}
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();
@@ -221,7 +222,7 @@
}
void
-SignaturePathPrefetcher::calculatePrefetch(const PrefetchInfo &pfi,
+SignaturePath::calculatePrefetch(const PrefetchInfo &pfi,
std::vector<AddrPriority> &addresses)
{
Addr request_addr = pfi.getAddr();
@@ -305,7 +306,7 @@
}
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()) {
@@ -315,8 +316,10 @@
}
}
-SignaturePathPrefetcher*
+} // namespace Prefetcher
+
+Prefetcher::SignaturePath*
SignaturePathPrefetcherParams::create()
{
- return new SignaturePathPrefetcher(this);
+ return new Prefetcher::SignaturePath(this);
}
diff --git a/src/mem/cache/prefetch/signature_path.hh
b/src/mem/cache/prefetch/signature_path.hh
index 0cbb207..1456d8e 100644
--- a/src/mem/cache/prefetch/signature_path.hh
+++ b/src/mem/cache/prefetch/signature_path.hh
@@ -47,7 +47,9 @@
struct SignaturePathPrefetcherParams;
-class SignaturePathPrefetcher : public QueuedPrefetcher
+namespace Prefetcher {
+
+class SignaturePath : public Queued
{
protected:
/** Signature type */
@@ -277,10 +279,13 @@
}
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__
diff --git a/src/mem/cache/prefetch/signature_path_v2.cc
b/src/mem/cache/prefetch/signature_path_v2.cc
index 656ce6f..588536c 100644
--- a/src/mem/cache/prefetch/signature_path_v2.cc
+++ b/src/mem/cache/prefetch/signature_path_v2.cc
@@ -34,9 +34,10 @@
#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,
@@ -46,7 +47,7 @@
}
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;
@@ -74,7 +75,7 @@
}
double
-SignaturePathPrefetcherV2::calculateLookaheadConfidence(
+SignaturePathV2::calculateLookaheadConfidence(
PatternEntry const &sig, PatternStrideEntry const &lookahead) const
{
if (sig.counter == 0) return 0.0;
@@ -83,7 +84,7 @@
}
double
-SignaturePathPrefetcherV2::calculatePrefetchConfidence(PatternEntry const
&sig,
+SignaturePathV2::calculatePrefetchConfidence(PatternEntry const &sig,
PatternStrideEntry const &entry) const
{
if (sig.counter == 0) return 0.0;
@@ -91,7 +92,7 @@
}
void
-SignaturePathPrefetcherV2::increasePatternEntryCounter(
+SignaturePathV2::increasePatternEntryCounter(
PatternEntry &pattern_entry, PatternStrideEntry &pstride_entry)
{
if (pattern_entry.counter.isSaturated()) {
@@ -111,7 +112,7 @@
}
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
@@ -127,8 +128,10 @@
gh_entry->confidence = path_confidence;
}
-SignaturePathPrefetcherV2*
+} // namespace Prefetcher
+
+Prefetcher::SignaturePathV2*
SignaturePathPrefetcherV2Params::create()
{
- return new SignaturePathPrefetcherV2(this);
+ return new Prefetcher::SignaturePathV2(this);
}
diff --git a/src/mem/cache/prefetch/signature_path_v2.hh
b/src/mem/cache/prefetch/signature_path_v2.hh
index 215b188..583c57a 100644
--- a/src/mem/cache/prefetch/signature_path_v2.hh
+++ b/src/mem/cache/prefetch/signature_path_v2.hh
@@ -47,7 +47,9 @@
struct SignaturePathPrefetcherV2Params;
-class SignaturePathPrefetcherV2 : public SignaturePathPrefetcher
+namespace Prefetcher {
+
+class SignaturePathV2 : public SignaturePath
{
/** Global History Register entry datatype */
struct GlobalHistoryEntry : public TaggedEntry
@@ -88,8 +90,10 @@
override;
public:
- SignaturePathPrefetcherV2(const SignaturePathPrefetcherV2Params* p);
- ~SignaturePathPrefetcherV2() {}
+ SignaturePathV2(const SignaturePathPrefetcherV2Params* p);
+ ~SignaturePathV2() = default;
};
+} // namespace Prefetcher
+
#endif//__MEM_CACHE_PREFETCH_SIGNATURE_PATH_V2_HH__
diff --git a/src/mem/cache/prefetch/slim_ampm.cc
b/src/mem/cache/prefetch/slim_ampm.cc
index b886a77..0da1850 100644
--- a/src/mem/cache/prefetch/slim_ampm.cc
+++ b/src/mem/cache/prefetch/slim_ampm.cc
@@ -30,13 +30,15 @@
#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);
@@ -45,8 +47,10 @@
}
}
-SlimAMPMPrefetcher*
+} // namespace Prefetcher
+
+Prefetcher::SlimAMPM*
SlimAMPMPrefetcherParams::create()
{
- return new SlimAMPMPrefetcher(this);
+ return new Prefetcher::SlimAMPM(this);
}
diff --git a/src/mem/cache/prefetch/slim_ampm.hh
b/src/mem/cache/prefetch/slim_ampm.hh
index 37071d7..cbcc7c7 100644
--- a/src/mem/cache/prefetch/slim_ampm.hh
+++ b/src/mem/cache/prefetch/slim_ampm.hh
@@ -45,18 +45,22 @@
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__
diff --git a/src/mem/cache/prefetch/spatio_temporal_memory_streaming.cc
b/src/mem/cache/prefetch/spatio_temporal_memory_streaming.cc
index 98a2147..932c7f6 100644
--- a/src/mem/cache/prefetch/spatio_temporal_memory_streaming.cc
+++ b/src/mem/cache/prefetch/spatio_temporal_memory_streaming.cc
@@ -32,8 +32,10 @@
#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,
@@ -55,7 +57,8 @@
}
void
-STeMSPrefetcher::checkForActiveGenerationsEnd() {
+STeMS::checkForActiveGenerationsEnd()
+{
// This prefetcher operates attached to the L1 and it observes all
// accesses, this guarantees that no evictions are missed
@@ -101,7 +104,7 @@
}
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();
@@ -113,7 +116,7 @@
}
void
-STeMSPrefetcher::calculatePrefetch(const PrefetchInfo &pfi,
+STeMS::calculatePrefetch(const PrefetchInfo &pfi,
std::vector<AddrPriority> &addresses)
{
if (!pfi.hasPC()) {
@@ -182,7 +185,7 @@
}
void
-STeMSPrefetcher::reconstructSequence(unsigned int rmob_idx,
+STeMS::reconstructSequence(unsigned int rmob_idx,
std::vector<AddrPriority> &addresses)
{
std::vector<Addr> reconstruction(reconstructionEntries, MaxAddr);
@@ -248,8 +251,10 @@
}
}
-STeMSPrefetcher *
+} // namespace Prefetcher
+
+Prefetcher::STeMS*
STeMSPrefetcherParams::create()
{
- return new STeMSPrefetcher(this);
+ return new Prefetcher::STeMS(this);
}
diff --git a/src/mem/cache/prefetch/spatio_temporal_memory_streaming.hh
b/src/mem/cache/prefetch/spatio_temporal_memory_streaming.hh
index 98b8bb6..8f8704a 100644
--- a/src/mem/cache/prefetch/spatio_temporal_memory_streaming.hh
+++ b/src/mem/cache/prefetch/spatio_temporal_memory_streaming.hh
@@ -49,7 +49,9 @@
struct STeMSPrefetcherParams;
-class STeMSPrefetcher : public QueuedPrefetcher
+namespace Prefetcher {
+
+class STeMS : public Queued
{
/** Size of each spatial region */
const size_t spatialRegionSize;
@@ -190,10 +192,13 @@
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__
diff --git a/src/mem/cache/prefetch/stride.cc
b/src/mem/cache/prefetch/stride.cc
index 1d1a2a9..8e47d9b 100644
--- a/src/mem/cache/prefetch/stride.cc
+++ b/src/mem/cache/prefetch/stride.cc
@@ -56,13 +56,15 @@
#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;
@@ -71,8 +73,8 @@
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),
@@ -86,8 +88,8 @@
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);
@@ -98,8 +100,8 @@
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,
@@ -111,7 +113,7 @@
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)
@@ -129,12 +131,12 @@
}
}
-StridePrefetcher::PCTable::~PCTable()
+Stride::PCTable::~PCTable()
{
}
void
-StridePrefetcher::calculatePrefetch(const PrefetchInfo &pfi,
+Stride::calculatePrefetch(const PrefetchInfo &pfi,
std::vector<AddrPriority> &addresses)
{
if (!pfi.hasPC()) {
@@ -214,15 +216,15 @@
}
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);
@@ -243,8 +245,8 @@
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]) {
@@ -259,8 +261,10 @@
return nullptr;
}
-StridePrefetcher*
+} // namespace Prefetcher
+
+Prefetcher::Stride*
StridePrefetcherParams::create()
{
- return new StridePrefetcher(this);
+ return new Prefetcher::Stride(this);
}
diff --git a/src/mem/cache/prefetch/stride.hh
b/src/mem/cache/prefetch/stride.hh
index 1526f04..f483527 100644
--- a/src/mem/cache/prefetch/stride.hh
+++ b/src/mem/cache/prefetch/stride.hh
@@ -59,7 +59,9 @@
class BaseReplacementPolicy;
struct StridePrefetcherParams;
-class StridePrefetcher : public QueuedPrefetcher
+namespace Prefetcher {
+
+class Stride : public Queued
{
protected:
const int maxConf;
@@ -167,10 +169,12 @@
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__
diff --git a/src/mem/cache/prefetch/tagged.cc
b/src/mem/cache/prefetch/tagged.cc
index eaf35ee..55b8710 100644
--- a/src/mem/cache/prefetch/tagged.cc
+++ b/src/mem/cache/prefetch/tagged.cc
@@ -35,15 +35,17 @@
#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());
@@ -53,8 +55,10 @@
}
}
-TaggedPrefetcher*
+} // namespace Prefetcher
+
+Prefetcher::Tagged*
TaggedPrefetcherParams::create()
{
- return new TaggedPrefetcher(this);
+ return new Prefetcher::Tagged(this);
}
diff --git a/src/mem/cache/prefetch/tagged.hh
b/src/mem/cache/prefetch/tagged.hh
index 5fbce36..e8b7505 100644
--- a/src/mem/cache/prefetch/tagged.hh
+++ b/src/mem/cache/prefetch/tagged.hh
@@ -39,18 +39,21 @@
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__
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/24537
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I9bae492d2fd4734bcdfb68c164345898e65102b2
Gerrit-Change-Number: 24537
Gerrit-PatchSet: 2
Gerrit-Owner: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-Reviewer: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-Reviewer: Nikos Nikoleris <nikos.nikole...@arm.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev