Go to the documentation of this file.
34 #include "debug/HWPrefetch.hh"
36 #include "params/SignaturePathPrefetcher.hh"
42 stridesPerPatternEntry(
p->strides_per_pattern_entry),
43 signatureShift(
p->signature_shift),
44 signatureBits(
p->signature_bits),
45 prefetchConfidenceThreshold(
p->prefetch_confidence_threshold),
46 lookaheadConfidenceThreshold(
p->lookahead_confidence_threshold),
47 signatureTable(
p->signature_table_assoc,
p->signature_table_entries,
48 p->signature_table_indexing_policy,
49 p->signature_table_replacement_policy),
50 patternTable(
p->pattern_table_assoc,
p->pattern_table_entries,
51 p->pattern_table_indexing_policy,
52 p->pattern_table_replacement_policy,
56 "The prefetch confidence threshold must be greater than 0\n");
58 "The prefetch confidence threshold must be less than 1\n");
60 "The lookahead confidence threshold must be greater than 0\n");
62 "The lookahead confidence threshold must be less than 1\n");
69 if (pstride_entry ==
nullptr) {
77 unsigned long current_counter = ULONG_MAX;
79 if (entry.counter < current_counter) {
80 victim_pstride_entry = &entry;
81 current_counter = entry.
counter;
85 pstride_entry = victim_pstride_entry;
89 return *pstride_entry;
103 if (num_cross_pages >
ppn) {
107 pf_ppn =
ppn - num_cross_pages;
117 pf_ppn =
ppn + num_cross_pages;
129 DPRINTF(HWPrefetch,
"Queuing prefetch to %#x.\n", new_addr);
137 new_signature = current_block;
139 new_stride = current_block;
162 double &initial_confidence)
165 if (signature_entry !=
nullptr) {
171 assert(signature_entry !=
nullptr);
175 initial_confidence,
stride);
181 return *signature_entry;
188 if (pattern_entry !=
nullptr) {
194 assert(pattern_entry !=
nullptr);
196 patternTable.insertEntry(signature,
false, pattern_entry);
198 return *pattern_entry;
213 if (lookahead_confidence > 0.95) {
219 lookahead_confidence = 0.95;
221 return lookahead_confidence;
233 double initial_confidence = 1.0;
240 current_block, miss,
stride, initial_confidence);
260 double current_confidence = initial_confidence;
273 if (current_pattern_entry !=
nullptr) {
274 unsigned long max_counter = 0;
275 for (
auto const &entry : current_pattern_entry->
strideEntries) {
277 if (max_counter < entry.counter) {
281 double prefetch_confidence =
285 assert(entry.stride != 0);
288 current_confidence, current_signature,
289 is_secure, addresses);
294 if (lookahead !=
nullptr) {
296 *current_pattern_entry, *lookahead);
299 current_stride += lookahead->
stride;
301 current_confidence = 0.0;
312 if (addresses.empty()) {
315 is_secure, addresses);
322 SignaturePathPrefetcherParams::create()
stride_t lastBlock
Last accessed block within a page.
std::pair< Addr, int32_t > AddrPriority
PatternEntry & getPatternEntry(Addr signature)
Obtains the PatternEntry of the given signature, if the signature is not found, it allocates a new on...
void reset()
Reset the counter to its initial value.
virtual void increasePatternEntryCounter(PatternEntry &pattern_entry, PatternStrideEntry &pstride_entry)
Increases the counter of a given PatternEntry/PatternStrideEntry.
A stride entry with its counter.
unsigned blkSize
The block size of the parent cache.
AssociativeSet< PatternEntry > patternTable
Pattern table.
PatternStrideEntry & getStrideEntry(stride_t stride)
Gets the entry with the provided stride, if there is no entry with the associated stride,...
virtual double calculateLookaheadConfidence(PatternEntry const &sig, PatternStrideEntry const &lookahead) const
Computes the lookahead path confidence of the provided pattern entry.
void calculatePrefetch(const PrefetchInfo &pfi, std::vector< AddrPriority > &addresses) override
stride_t stride
stride in a page in blkSize increments
double calcSaturation() const
Calculate saturation percentile of the current counter's value with regard to its maximum possible va...
int16_t stride_t
Stride type.
signature_t signature
Path signature.
const double lookaheadConfidenceThreshold
Minimum confidence to keep navigating lookahead entries.
signature_t updateSignature(signature_t sig, stride_t str) const
Generates a new signature from an existing one and a new stride.
Pattern entry data type, a set of stride and counter entries.
SatCounter counter
Saturating counter.
Copyright (c) 2018 Metempsy Technology Consulting All rights reserved.
virtual double calculatePrefetchConfidence(PatternEntry const &sig, PatternStrideEntry const &entry) const
Computes the prefetch confidence of the provided pattern entry.
AssociativeSet< SignatureEntry > signatureTable
Signature table.
std::vector< PatternStrideEntry > strideEntries
group of stides
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
bool isSecure() const
Returns true if the address targets the secure memory space.
void updatePatternTable(Addr signature, stride_t stride)
Updates the pattern table with the provided signature and stride.
uint16_t signature_t
Signature type.
Class containing the information needed by the prefetch to train and generate new prefetch requests.
Bitfield< 21, 20 > stride
const double prefetchConfidenceThreshold
Minimum confidence to issue a prefetch.
virtual void auxiliaryPrefetcher(Addr ppn, stride_t current_block, bool is_secure, std::vector< AddrPriority > &addresses)
Auxiliar prefetch mechanism used at the end of calculatePrefetch.
SignatureEntry & getSignatureEntry(Addr ppn, bool is_secure, stride_t block, bool &miss, stride_t &stride, double &initial_confidence)
Obtains the SignatureEntry of the given page, if the page is not found, it allocates a new one,...
void addPrefetch(Addr ppn, stride_t last_block, stride_t delta, double path_confidence, signature_t signature, bool is_secure, std::vector< AddrPriority > &addresses)
Generates an address to be prefetched.
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
virtual void handlePageCrossingLookahead(signature_t signature, stride_t last_offset, stride_t delta, double path_confidence)
Handles the situation when the lookahead process has crossed the boundaries of the current page.
SignaturePath(const SignaturePathPrefetcherParams *p)
Addr getAddr() const
Obtains the address value of this Prefetcher address.
PatternStrideEntry * findStride(stride_t stride)
Returns the entry with the desired stride.
virtual void handleSignatureTableMiss(stride_t current_block, signature_t &new_signature, double &new_conf, stride_t &new_stride)
Whenever a new SignatureEntry is allocated, it computes the new signature to be used with the new ent...
Signature entry data type.
Generated on Wed Sep 30 2020 14:02:12 for gem5 by doxygen 1.8.17