33 #include "debug/HWPrefetch.hh" 34 #include "params/BOPPrefetcher.hh" 38 scoreMax(p->score_max), roundMax(p->round_max),
39 badScore(p->bad_score), rrEntries(p->rr_size),
40 tagMask((1 << p->tag_bits) - 1),
41 delayQueueEnabled(p->delay_queue_enable),
42 delayQueueSize(p->delay_queue_size),
43 delayTicks(cyclesToTicks(p->delay_queue_cycles)),
49 fatal(
"%s: number of RR entries is not power of 2\n",
name());
52 fatal(
"%s: cache line size is not power of 2\n",
name());
54 if (!(
p->negative_offsets_enable && (
p->offset_list_size % 2 == 0))) {
55 fatal(
"%s: negative offsets enabled with odd offset list size\n",
64 const int factors[] = { 2, 3, 5 };
68 while (i < p->offset_list_size)
72 for (
int n : factors) {
73 while ((offset %
n) == 0) {
83 if (
p->negative_offsets_enable) {
115 Addr hash1 = addr >> way;
186 Addr offset_addr = (*offsetsListIterator).first;
187 Addr lookup_addr = x - offset_addr;
190 if (
testRR(lookup_addr)) {
191 DPRINTF(HWPrefetch,
"Address %#lx found in the RR table\n", x);
192 (*offsetsListIterator).second++;
193 if ((*offsetsListIterator).second >
bestScore) {
194 bestScore = (*offsetsListIterator).second;
246 DPRINTF(HWPrefetch,
"Generated prefetch %#lx\n", prefetch_addr);
264 BOPPrefetcherParams::create()
const unsigned int tagMask
bool testRR(Addr) const
Test if -O is hitting in the RR table to update the offset score.
#define fatal(...)
This implements a cprintf based fatal() function.
std::vector< Addr > rrLeft
std::deque< DelayQueueEntry > delayQueue
std::vector< OffsetListEntry > offsetsList
void calculatePrefetch(const PrefetchInfo &pfi, std::vector< AddrPriority > &addresses) override
void notifyFill(const PacketPtr &pkt) override
Update the RR right table after a prefetch fill.
unsigned lBlkSize
log_2(block size of the parent cache).
unsigned int bestScore
Max score found so far.
bool issuePrefetchRequests
Hardware prefetcher enabled.
void delayQueueEventWrapper()
Event to handle the delay queue processing.
Addr getAddr() const
Obtains the address value of this Prefetcher address.
unsigned int hash(Addr addr, unsigned int way) const
Generate a hash for the specified address to index the RR table.
void bestOffsetLearning(Addr)
Learning phase of the BOP.
Tick curTick()
The current simulated tick.
Addr tag(Addr addr) const
Generate the tag for the specified address based on the tag bits and the block size.
Class containing the information needed by the prefetch to train and generate new prefetch requests...
bool scheduled() const
Determine if the current event is scheduled.
std::pair< Addr, int32_t > AddrPriority
const bool delayQueueEnabled
Delay queue parameters.
uint64_t Tick
Tick count type.
const unsigned int scoreMax
Learning phase parameters.
const unsigned int rrEntries
Recent requests table parameteres.
bool isHWPrefetch() const
bool isPowerOf2(const T &n)
void resetScores()
Reset all the scores from the offset list.
Addr bestOffset
Current best offset to issue prefetches.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
virtual const std::string name() const
const unsigned int delayQueueSize
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
const unsigned int badScore
std::pair< int16_t, uint8_t > OffsetListEntry
Structure to save the offset and the score.
const unsigned int delayTicks
void insertIntoDelayQueue(Addr addr)
Insert the specified address into the delay queue.
int floorLog2(unsigned x)
std::vector< Addr > rrRight
MemCmd cmd
The command field of the packet.
BOPPrefetcher(const BOPPrefetcherParams *p)
Copyright (c) 2018 Metempsy Technology Consulting All rights reserved.
void schedule(Event &event, Tick when)
unsigned int round
Current round.
const unsigned int roundMax
std::vector< OffsetListEntry >::iterator offsetsListIterator
Current test offset index.
unsigned blkSize
The block size of the parent cache.
Addr phaseBestOffset
Current best offset found in the learning phase.
In a first implementation of the BO prefetcher, both banks of the RR were written simultaneously when...
EventFunctionWrapper delayQueueEvent
void insertIntoRR(Addr addr, unsigned int way)
Insert the specified address into the RR table.