32 #include "params/IndirectMemoryPrefetcher.hh"
42 maxPrefetchDistance(
p.max_prefetch_distance),
43 shiftValues(
p.shift_values), prefetchThreshold(
p.prefetch_threshold),
44 streamCounterThreshold(
p.stream_counter_threshold),
45 streamingDistance(
p.streaming_distance),
46 prefetchTable((
name() +
".PrefetchTable").c_str(),
49 p.pt_table_replacement_policy,
50 p.pt_table_indexing_policy,
53 ipd((
name() +
".IPD").c_str(),
p.ipd_table_entries,
p.ipd_table_assoc,
54 p.ipd_table_replacement_policy,
55 p.ipd_table_indexing_policy,
58 ipdEntryTrackingMisses(nullptr),
byteOrder(
p.sys->getGuestByteOrder())
91 if (pt_entry !=
nullptr) {
104 pt_entry->
secure = is_secure;
114 bool read_index =
true;
116 case sizeof(uint8_t):
119 case sizeof(uint16_t):
122 case sizeof(uint32_t):
125 case sizeof(uint64_t):
132 if (read_index && !pt_entry->
enabled) {
137 }
else if (read_index) {
152 for (
int delta = 1; delta < distance; delta += 1) {
163 assert(pt_entry !=
nullptr);
166 pt_entry->
secure = is_secure;
176 Addr ipd_entry_addr = (
Addr) pt_entry;
179 if (ipd_entry !=
nullptr) {
180 ipd.accessEntry(ipd_entry);
193 ipd_entry =
ipd.findVictim(key);
194 assert(ipd_entry !=
nullptr);
195 ipd.insertEntry(key, ipd_entry);
211 ba_array[idx] = miss_addr - (entry->
idx1 <<
shift);
228 for (
int midx = 0; midx < entry->
numMisses; midx += 1)
233 if (ba_array[idx] == (miss_addr - (entry->
idx2 <<
shift))) {
243 ipd.invalidate(entry);
257 if (pt_entry.enabled) {
258 if (
addr == pt_entry.baseAddr +
259 (pt_entry.index << pt_entry.shift)) {
260 pt_entry.indirectCounter++;
261 pt_entry.increasedIndirectCounter =
true;
virtual Addr getTag() const
Get tag associated to this block.
Class containing the information needed by the prefetch to train and generate new prefetch requests.
Addr getPC() const
Returns the program counter that generated this request.
bool isSecure() const
Returns true if the address targets the secure memory space.
unsigned int getSize() const
Gets the size of the request triggering this event.
bool isWrite() const
Checks if the request that caused this prefetch event was a write request.
bool isCacheMiss() const
Check if this event comes from a cache miss.
Addr getAddr() const
Obtains the address value of this Prefetcher address.
T get(ByteOrder endian) const
Gets the associated data of the request triggering the event.
bool hasPC() const
Returns true if the associated program counter is valid.
const int streamCounterThreshold
streamCounter value to trigger the streaming prefetcher
void trackMissIndex1(Addr miss_addr)
Update an IPD entry with a detected miss address, when the first index is being tracked.
AssociativeCache< IndirectPatternDetectorEntry > ipd
Indirect Pattern Detector (IPD) table.
void trackMissIndex2(Addr miss_addr)
Update an IPD entry with a detected miss address, when the second index is being tracked.
const ByteOrder byteOrder
Byte order used to access the cache.
void checkAccessMatchOnActiveEntries(Addr addr)
Checks if an access to the cache matches any active PT entry, if so, the indirect confidence counter ...
const unsigned int maxPrefetchDistance
Maximum number of prefetches generated per event.
const std::vector< int > shiftValues
Shift values considered.
IndirectPatternDetectorEntry * ipdEntryTrackingMisses
Entry currently tracking misses.
const int streamingDistance
Number of prefetches generated when using the streaming prefetcher.
AssociativeCache< PrefetchTableEntry > prefetchTable
Prefetch table.
const unsigned int prefetchThreshold
Counter threshold to start prefetching.
IndirectMemory(const IndirectMemoryPrefetcherParams &p)
void calculatePrefetch(const PrefetchInfo &pfi, std::vector< AddrPriority > &addresses, const CacheAccessor &cache) override
void allocateOrUpdateIPDEntry(const PrefetchTableEntry *pt_entry, int64_t index)
Allocate or update an entry in the IPD.
std::pair< Addr, int32_t > AddrPriority
double calcSaturation() const
Calculate saturation percentile of the current counter's value with regard to its maximum possible va...
void reset()
Reset the counter to its initial value.
Declares a basic cache interface BaseCache.
ByteOrder byteOrder(const ThreadContext *tc)
Copyright (c) 2024 Arm Limited All rights reserved.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
static constexpr auto genTagExtractor(BTBIndexingPolicy *ip)
This helper generates a tag extractor function object which will be typically used by Replaceable ent...
Provides generic cache lookup functions.
Indirect Pattern Detector entrt.
bool secondIndexSet
Valid bit for the second index.
void invalidate() override
Invalidate the block.
int numMisses
Number of misses currently recorded.
std::vector< std::vector< Addr > > baseAddr
Potential BaseAddr candidates for each recorded miss.
int64_t idx2
Second index.
Addr address
Accessed address.
Addr baseAddr
BaseAddr detected.
bool increasedIndirectCounter
This variable is set to indicate that there has been at least one match with the current index value.
bool enabled
Enable bit of the indirect fields.
bool secure
Whether this address is in the secure region.
SatCounter8 indirectCounter
Confidence counter of the indirect fields.
int64_t index
Current index value.
unsigned int streamCounter
Confidence counter of the stream.
const std::string & name()