33 #include "params/IndirectMemoryPrefetcher.hh"
43 maxPrefetchDistance(
p.max_prefetch_distance),
44 shiftValues(
p.shift_values), prefetchThreshold(
p.prefetch_threshold),
45 streamCounterThreshold(
p.stream_counter_threshold),
46 streamingDistance(
p.streaming_distance),
47 prefetchTable((
name() +
".PrefetchTable").c_str(),
50 p.pt_table_replacement_policy,
51 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,
57 ipdEntryTrackingMisses(nullptr),
byteOrder(
p.sys->getGuestByteOrder())
89 if (pt_entry !=
nullptr) {
102 pt_entry->
secure = is_secure;
112 bool read_index =
true;
114 case sizeof(uint8_t):
117 case sizeof(uint16_t):
120 case sizeof(uint32_t):
123 case sizeof(uint64_t):
130 if (read_index && !pt_entry->
enabled) {
135 }
else if (read_index) {
150 for (
int delta = 1; delta < distance; delta += 1) {
161 assert(pt_entry !=
nullptr);
164 pt_entry->
secure = is_secure;
174 Addr ipd_entry_addr = (
Addr) pt_entry;
176 if (ipd_entry !=
nullptr) {
177 ipd.accessEntry(ipd_entry);
190 ipd_entry =
ipd.findVictim(ipd_entry_addr);
191 assert(ipd_entry !=
nullptr);
192 ipd.insertEntry(ipd_entry_addr, ipd_entry);
208 ba_array[idx] = miss_addr - (entry->
idx1 <<
shift);
225 for (
int midx = 0; midx < entry->
numMisses; midx += 1)
230 if (ba_array[idx] == (miss_addr - (entry->
idx2 <<
shift))) {
240 ipd.invalidate(entry);
254 if (pt_entry.enabled) {
255 if (
addr == pt_entry.baseAddr +
256 (pt_entry.index << pt_entry.shift)) {
257 pt_entry.indirectCounter++;
258 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 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
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()