44#include "debug/HWPrefetch.hh"
45#include "params/BOPPrefetcher.hh"
61 issuePrefetchRequests(
false), bestOffset(1), phaseBestOffset(0),
62 bestScore(0), round(0), degree(
p.degree)
65 fatal(
"%s: number of RR entries is not power of 2\n",
name());
68 fatal(
"%s: cache line size is not power of 2\n",
name());
70 if (
p.negative_offsets_enable && (
p.offset_list_size % 2 != 0)) {
71 fatal(
"%s: negative offsets enabled with odd offset list size\n",
75 fatal(
"%s: prefetch degree must be strictly greater than zero\n",
79 rrLeft.resize(rrEntries);
80 rrRight.resize(rrEntries);
86 const int factors[] = { 2, 3, 5 };
90 while (
i <
p.offset_list_size)
94 for (
int n : factors) {
101 offsetsList.push_back(OffsetListEntry(offset_i, 0));
107 if (
p.negative_offsets_enable) {
108 offsetsList.push_back(OffsetListEntry(-offset_i, 0));
116 offsetsListIterator = offsetsList.begin();
167 Addr hash = line_addr ^ (line_addr >> (log_rr_entries << way));
168 hash &= ((1ULL << log_rr_entries) - 1);
223 if (it == addr_tag) {
229 if (it == addr_tag) {
240 Addr offset_tag = (*offsetsListIterator).first;
251 DPRINTF(HWPrefetch,
"Address %#lx found in the RR table\n",
253 (*offsetsListIterator).second++;
254 if ((*offsetsListIterator).second >
bestScore) {
255 bestScore = (*offsetsListIterator).second;
319 DPRINTF(HWPrefetch,
"Generated prefetch %#lx\n", prefetch_addr);
Information provided to probes on a cache event.
PacketPtr pkt
Packet that triggered the cache access.
Tick cyclesToTicks(Cycles c) const
bool isHWPrefetch() const
MemCmd cmd
The command field of the packet.
std::deque< DelayQueueEntry > delayQueue
void calculatePrefetch(const PrefetchInfo &pfi, std::vector< AddrPriority > &addresses, const CacheAccessor &cache) override
unsigned int round
Current round.
std::vector< Addr > rrLeft
unsigned int bestScore
Max score found so far.
unsigned int index(Addr addr, unsigned int way) const
Generate a hash for the specified address to index the RR table.
const unsigned int delayQueueSize
void insertIntoDelayQueue(Addr addr)
Insert the specified address into the delay queue.
BOP(const BOPPrefetcherParams &p)
const unsigned int rrEntries
Recent requests table parameteres.
const unsigned int tagMask
std::vector< OffsetListEntry >::iterator offsetsListIterator
Current test offset index.
const unsigned int badScore
const bool delayQueueEnabled
Delay queue parameters.
const unsigned int scoreMax
Learning phase parameters.
std::vector< Addr > rrRight
bool issuePrefetchRequests
Hardware prefetcher enabled.
Addr tag(Addr addr) const
Generate the tag for the specified address based on the tag bits and the block size.
void delayQueueEventWrapper()
Event to handle the delay queue processing.
const unsigned int roundMax
void bestOffsetLearning(Addr addr)
Learning phase of the BOP.
Addr phaseBestOffset
Current best offset found in the learning phase.
EventFunctionWrapper delayQueueEvent
void notifyFill(const CacheAccessProbeArg &arg) override
Update the RR right table after a prefetch fill.
unsigned int degree
The prefetch degree, i.e.
std::vector< OffsetListEntry > offsetsList
void insertIntoRR(Addr addr, Addr addr_tag, unsigned int way)
Insert the specified address into the RR table.
void resetScores()
Reset all the scores from the offset list.
Addr bestOffset
Current best offset to issue prefetches.
const unsigned int delayTicks
bool testRR(Addr addr_tag) const
Test if @X-O is hitting in the RR table to update the offset score.
Class containing the information needed by the prefetch to train and generate new prefetch requests.
Addr getAddr() const
Obtains the address value of this Prefetcher address.
unsigned lBlkSize
log_2(block size of the parent cache).
Queued(const QueuedPrefetcherParams &p)
std::pair< Addr, int32_t > AddrPriority
static constexpr std::enable_if_t< std::is_integral_v< T >, int > floorLog2(T x)
static constexpr bool isPowerOf2(const T &n)
void schedule(Event &event, Tick when)
#define fatal(...)
This implements a cprintf based fatal() function.
Copyright (c) 2024 Arm Limited All rights reserved.
Tick curTick()
The universal simulation clock.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
uint64_t Tick
Tick count type.
Provides generic cache lookup functions.
In a first implementation of the BO prefetcher, both banks of the RR were written simultaneously when...
const std::string & name()