33 #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;
267 IndirectMemoryPrefetcherParams::create()
Declares a basic cache interface BaseCache.
std::pair< Addr, int32_t > AddrPriority
bool increasedIndirectCounter
This variable is set to indicate that there has been at least one match with the current index value...
Addr getTag() const
Obtain the entry tag.
void checkAccessMatchOnActiveEntries(Addr addr)
Checks if an access to the cache matches any active PT entry, if so, the indirect confidence counter ...
unsigned int getSize() const
Gets the size of the request triggering this event.
Addr address
Accessed address.
std::vector< std::vector< Addr > > baseAddr
Potential BaseAddr candidates for each recorded miss.
bool isCacheMiss() const
Check if this event comes from a cache miss.
SatCounter indirectCounter
Confidence counter of the indirect fields.
double calcSaturation() const
Calculate saturation percentile of the current counter's value with regard to its maximum possible va...
bool isSecure() const
Returns true if the address targets the secure memory space.
const unsigned int maxPrefetchDistance
Maximum number of prefetches generated per event.
AssociativeSet< IndirectPatternDetectorEntry > ipd
Indirect Pattern Detector (IPD) table.
IndirectMemory(const IndirectMemoryPrefetcherParams *p)
Class containing the information needed by the prefetch to train and generate new prefetch requests...
int64_t idx2
Second index.
const unsigned int prefetchThreshold
Counter threshold to start prefetching.
bool enabled
Enable bit of the indirect fields.
const int streamingDistance
Number of prefetches generated when using the streaming prefetcher.
unsigned int streamCounter
Confidence counter of the stream.
bool secondIndexSet
Valid bit for the second index.
bool hasPC() const
Returns true if the associated program counter is valid.
Addr getPC() const
Returns the program counter that generated this request.
IndirectPatternDetectorEntry * ipdEntryTrackingMisses
Entry currently tracking misses.
int64_t index
Current index value.
void trackMissIndex2(Addr miss_addr)
Update an IPD entry with a detected miss address, when the second index is being tracked.
void reset()
Reset the counter to its initial value.
Addr getAddr() const
Obtains the address value of this Prefetcher address.
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
T get(ByteOrder endian) const
Gets the associated data of the request triggering the event.
void calculatePrefetch(const PrefetchInfo &pfi, std::vector< AddrPriority > &addresses) override
void trackMissIndex1(Addr miss_addr)
Update an IPD entry with a detected miss address, when the first index is being tracked.
const int streamCounterThreshold
streamCounter value to trigger the streaming prefetcher
const std::vector< int > shiftValues
Shift values considered.
Indirect Pattern Detector entrt.
int numMisses
Number of misses currently recorded.
const ByteOrder byteOrder
Byte order used to access the cache.
void allocateOrUpdateIPDEntry(const PrefetchTableEntry *pt_entry, int64_t index)
Allocate or update an entry in the IPD.
AssociativeSet< PrefetchTableEntry > prefetchTable
Prefetch table.
bool isWrite() const
Checks if the request that caused this prefetch event was a write request.
bool secure
Whether this address is in the secure region.
const ByteOrder GuestByteOrder
Addr baseAddr
BaseAddr detected.
Copyright (c) 2018 Metempsy Technology Consulting All rights reserved.
ByteOrder byteOrder(const ThreadContext *tc)