35 #include "params/IndirectMemoryPrefetcher.hh" 39 maxPrefetchDistance(p->max_prefetch_distance),
40 shiftValues(p->shift_values), prefetchThreshold(p->prefetch_threshold),
41 streamCounterThreshold(p->stream_counter_threshold),
42 streamingDistance(p->streaming_distance),
43 prefetchTable(p->pt_table_assoc, p->pt_table_entries,
44 p->pt_table_indexing_policy, p->pt_table_replacement_policy,
46 ipd(p->ipd_table_assoc, p->ipd_table_entries, p->ipd_table_indexing_policy,
47 p->ipd_table_replacement_policy,
49 ipdEntryTrackingMisses(nullptr),
50 #if THE_ISA != NULL_ISA
57 "This prefetcher requires a defined ISA\n");
88 if (pt_entry !=
nullptr) {
91 if (pt_entry->
address != addr) {
95 int64_t delta = addr - pt_entry->
address;
101 pt_entry->
secure = is_secure;
111 bool read_index =
true;
113 case sizeof(uint8_t):
116 case sizeof(uint16_t):
119 case sizeof(uint32_t):
122 case sizeof(uint64_t):
129 if (read_index && !pt_entry->
enabled) {
134 }
else if (read_index) {
149 for (
int delta = 1; delta < distance; delta += 1) {
160 assert(pt_entry !=
nullptr);
163 pt_entry->
secure = is_secure;
173 Addr ipd_entry_addr = (
Addr) pt_entry;
176 if (ipd_entry !=
nullptr) {
177 ipd.accessEntry(ipd_entry);
186 ipd.invalidate(ipd_entry);
190 ipd_entry =
ipd.findVictim(ipd_entry_addr);
191 assert(ipd_entry !=
nullptr);
192 ipd.insertEntry(ipd_entry_addr,
false , 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;
265 IndirectMemoryPrefetcherParams::create()
IndirectMemoryPrefetcher(const IndirectMemoryPrefetcherParams *p)
Copyright (c) 2018 Metempsy Technology Consulting All rights reserved.
Declares a basic cache interface BaseCache.
bool secondIndexSet
Valid bit for the second index.
Addr getTag() const
Obtain the entry tag.
IndirectPatternDetectorEntry * ipdEntryTrackingMisses
Entry currently tracking misses.
void trackMissIndex1(Addr miss_addr)
Update an IPD entry with a detected miss address, when the first index is being tracked.
void checkAccessMatchOnActiveEntries(Addr addr)
Checks if an access to the cache matches any active PT entry, if so, the indirect confidence counter ...
const int streamingDistance
Number of prefetches generated when using the streaming prefetcher.
bool isCacheMiss() const
Check if this event comes from a cache miss.
const unsigned int maxPrefetchDistance
Maximum number of prefetches generated per event.
Addr address
Accessed address.
const ByteOrder byteOrder
Byte order used to access the cache.
double calcSaturation() const
Calculate saturation percentile of the current counter's value with regard to its maximum possible va...
bool increasedIndirectCounter
This variable is set to indicate that there has been at least one match with the current index value...
bool isSecure() const
Returns true if the address targets the secure memory space.
AssociativeSet< IndirectPatternDetectorEntry > ipd
Indirect Pattern Detector (IPD) table.
T get(ByteOrder endian) const
Gets the associated data of the request triggering the event.
std::vector< std::vector< Addr > > baseAddr
Potential BaseAddr candidates for each recorded miss.
unsigned int getSize() const
Gets the size of the request triggering this event.
const ByteOrder GuestByteOrder
bool secure
Whether this address is in the secure region.
const unsigned int prefetchThreshold
Counter threshold to start prefetching.
Addr getAddr() const
Obtains the address value of this Prefetcher address.
bool isWrite() const
Checks if the request that caused this prefetch event was a write request.
Class containing the information needed by the prefetch to train and generate new prefetch requests...
std::pair< Addr, int32_t > AddrPriority
ByteOrder byteOrder(ThreadContext *tc)
unsigned int streamCounter
Confidence counter of the stream.
Addr getPC() const
Returns the program counter that generated this request.
int64_t idx2
Second index.
SatCounter indirectCounter
Confidence counter of the indirect fields.
const int streamCounterThreshold
streamCounter value to trigger the streaming prefetcher
void reset()
Reset the counter to its initial value.
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
bool enabled
Enable bit of the indirect fields.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
int64_t index
Current index value.
int numMisses
Number of misses currently recorded.
void trackMissIndex2(Addr miss_addr)
Update an IPD entry with a detected miss address, when the second index is being tracked.
Indirect Pattern Detector entrt.
Addr baseAddr
BaseAddr detected.
void allocateOrUpdateIPDEntry(const PrefetchTableEntry *pt_entry, int64_t index)
Allocate or update an entry in the IPD.
const std::vector< int > shiftValues
Shift values considered.
void calculatePrefetch(const PrefetchInfo &pfi, std::vector< AddrPriority > &addresses) override
AssociativeSet< PrefetchTableEntry > prefetchTable
Prefetch table.
bool hasPC() const
Returns true if the associated program counter is valid.