42 #include "debug/HWPrefetch.hh"
46 :
BasePrefetcher(p), queueSize(p->queue_size), latency(p->latency),
47 queueSquash(p->queue_squash), queueFilter(p->queue_filter),
48 cacheSnoop(p->cache_snoop), tagPrefetch(p->tag_prefetch)
72 auto itr =
pfq.begin();
73 while (itr !=
pfq.end()) {
74 if (itr->pkt->getAddr() == blk_addr &&
75 itr->pkt->isSecure() == is_secure) {
96 DPRINTF(HWPrefetch,
"Found a pf candidate addr: %#x, "
97 "inserting into prefetch queue.\n", pf_info.first);
102 if (pf_pkt !=
nullptr) {
117 DPRINTF(HWPrefetch,
"Requesting a prefetch to issue.\n");
120 DPRINTF(HWPrefetch,
"No hardware prefetches available.\n");
128 assert(pkt !=
nullptr);
129 DPRINTF(HWPrefetch,
"Generating prefetch for %#x.\n", pkt->
getAddr());
137 if ((*dp).pkt->getAddr() == address &&
138 (*dp).pkt->isSecure() == is_secure)
return dp;
148 if (dp->pkt->getAddr() == address &&
149 dp->pkt->isSecure() == is_secure)
return dp;
162 .
desc(
"number of prefetch candidates identified");
166 .
desc(
"number of redundant prefetches already in prefetch queue");
170 .
desc(
"number of redundant prefetches already in cache/mshr dropped");
174 .
desc(
"number of prefetches dropped due to prefetch queue size");
178 .
desc(
"number of prefetches not generated due to page crossing");
187 if (it !=
pfq.end()) {
189 if (it->priority < pf_info.second) {
191 it->priority = pf_info.second;
194 while (cont && prev !=
pfq.begin()) {
198 std::swap(*it, *prev);
202 DPRINTF(HWPrefetch,
"Prefetch addr already in "
203 "prefetch queue, priority updated\n");
205 DPRINTF(HWPrefetch,
"Prefetch addr already in "
215 DPRINTF(HWPrefetch,
"Dropping redundant in "
216 "cache/MSHR prefetch addr:%#x\n", pf_info.first);
236 panic_if (it ==
pfq.begin(),
"Prefetch queue is both full and empty!");
239 panic_if (it ==
pfq.begin(),
"Prefetch queue is full with 1 element!");
243 while (cont && prev !=
pfq.begin()) {
246 cont = (*prev).priority == (*it).priority;
251 DPRINTF(HWPrefetch,
"Prefetch queue full, removing lowest priority "
252 "oldest packet, addr: %#x", it->pkt->getAddr());
259 DPRINTF(HWPrefetch,
"Prefetch queued. "
260 "addr:%#x priority: %3d tick:%lld.\n",
261 pf_info.first, pf_info.second, pf_time);
265 if (
pfq.size() == 0) {
266 pfq.emplace_back(dpp);
269 while (it !=
pfq.begin() && dpp > *it)
273 if (it ==
pfq.begin() && dpp <= *it)
Declares a basic cache interface BaseCache.
const Cycles latency
Cycles after generation when a prefetch can first be issued.
const unsigned queueSize
Maximum size of the prefetch queue.
std::list< DeferredPacket >::const_iterator inPrefetch(Addr address, bool is_secure) const
Addr getBlockAddr(unsigned int blk_size) const
panic_if(!root,"Invalid expression\n")
virtual void regStats()
Register statistics for this object.
Addr getPC() const
Accessor function for pc.
std::list< DeferredPacket >::const_iterator const_iterator
std::list< DeferredPacket >::iterator iterator
Tick notify(const PacketPtr &pkt)
Notify prefetcher of cache access (may be any access or just misses, depending on cache parameters...
Tick curTick()
The current simulated tick.
bool observeAccess(const PacketPtr &pkt) const
Determine if this access should be observed.
uint64_t Tick
Tick count type.
Stats::Scalar pfRemovedFull
const RequestPtr req
A pointer to the original request.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
MasterID masterId
Request id for prefetches.
bool inMissQueue(Addr addr, bool is_secure) const
Determine if address is in cache miss queue.
const bool cacheSnoop
Snoop the cache before generating prefetch (cheating basically)
QueuedPrefetcher(const QueuedPrefetcherParams *p)
const bool tagPrefetch
Tag prefetch with PC of generating access?
const bool queueFilter
Filter prefetches if already queued.
Derived & name(const std::string &name)
Set the name and marks this stat to print at the end of simulation.
bool inCache(Addr addr, bool is_secure) const
Determine if address is in cache.
virtual const std::string name() const
const bool queueSquash
Squash queued prefetch if demand access observed.
PacketPtr insert(AddrPriority &info, bool is_secure)
The request targets the secure memory space.
virtual void calculatePrefetch(const PacketPtr &pkt, std::vector< AddrPriority > &addresses)=0
virtual ~QueuedPrefetcher()
Derived & desc(const std::string &_desc)
Set the description and marks this stat to print at the end of simulation.
unsigned blkSize
The block size of the parent cache.
void setFlags(Flags flags)
Note that unlike other accessors, this function sets specific flags (ORs them in); it does not assign...
void allocate()
Allocate memory for the packet.
Stats::Scalar pfIdentified
Stats::Scalar pfBufferHit
ProbePointArg< PacketInfo > Packet
Packet probe point.
void regStats()
Register statistics for this object.
std::list< DeferredPacket > pfq