gem5 v23.0.0.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
signature_path.hh
Go to the documentation of this file.
1
40#ifndef __MEM_CACHE_PREFETCH_SIGNATURE_PATH_HH__
41#define __MEM_CACHE_PREFETCH_SIGNATURE_PATH_HH__
42
43#include "base/sat_counter.hh"
46#include "mem/packet.hh"
47
48namespace gem5
49{
50
51struct SignaturePathPrefetcherParams;
52
53namespace prefetch
54{
55
56class SignaturePath : public Queued
57{
58 protected:
60 typedef uint16_t signature_t;
62 typedef int16_t stride_t;
63
65 const unsigned stridesPerPatternEntry;
67 const uint8_t signatureShift;
74
77 {
83 {}
84 };
87
90 {
96 {}
97 };
99 struct PatternEntry : public TaggedEntry
100 {
105 PatternEntry(size_t num_strides, unsigned counter_bits)
106 : TaggedEntry(), strideEntries(num_strides, counter_bits),
107 counter(counter_bits)
108 {
109 }
110
112 void
113 invalidate() override
114 {
116 for (auto &entry : strideEntries) {
117 entry.counter.reset();
118 entry.stride = 0;
119 }
120 counter.reset();
121 }
122
130 {
131 PatternStrideEntry *found_entry = nullptr;
132 for (auto &entry : strideEntries) {
133 if (entry.stride == stride) {
134 found_entry = &entry;
135 break;
136 }
137 }
138 return found_entry;
139 }
140
148 };
151
159 sig <<= signatureShift;
160 sig ^= str;
161 sig &= mask(signatureBits);
162 return sig;
163 }
164
179 void addPrefetch(Addr ppn, stride_t last_block, stride_t delta,
180 double path_confidence, signature_t signature,
181 bool is_secure,
182 std::vector<AddrPriority> &addresses);
183
197 SignatureEntry &getSignatureEntry(Addr ppn, bool is_secure, stride_t block,
198 bool &miss, stride_t &stride, double &initial_confidence);
205 PatternEntry& getPatternEntry(Addr signature);
206
213 void updatePatternTable(Addr signature, stride_t stride);
214
221 virtual double calculateLookaheadConfidence(PatternEntry const &sig,
222 PatternStrideEntry const &lookahead) const;
223
230 virtual double calculatePrefetchConfidence(PatternEntry const &sig,
231 PatternStrideEntry const &entry) const;
232
238 virtual void increasePatternEntryCounter(PatternEntry &pattern_entry,
239 PatternStrideEntry &pstride_entry);
240
251 virtual void handleSignatureTableMiss(stride_t current_block,
252 signature_t &new_signature, double &new_conf,
253 stride_t &new_stride);
254
266 virtual void auxiliaryPrefetcher(Addr ppn, stride_t current_block,
267 bool is_secure, std::vector<AddrPriority> &addresses);
268
282 stride_t last_offset, stride_t delta, double path_confidence) {
283 }
284
285 public:
286 SignaturePath(const SignaturePathPrefetcherParams &p);
287 ~SignaturePath() = default;
288
289 void calculatePrefetch(const PrefetchInfo &pfi,
290 std::vector<AddrPriority> &addresses) override;
291};
292
293} // namespace prefetch
294} // namespace gem5
295
296#endif//__MEM_CACHE_PREFETCH_SIGNATURE_PATH_HH__
Associative container based on the previosuly defined Entry type Each element is indexed by a key of ...
A tagged entry is an entry containing a tag.
virtual void invalidate()
Invalidate the block.
Class containing the information needed by the prefetch to train and generate new prefetch requests.
Definition base.hh:97
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.
const double prefetchConfidenceThreshold
Minimum confidence to issue a prefetch.
virtual double calculatePrefetchConfidence(PatternEntry const &sig, PatternStrideEntry const &entry) const
Computes the prefetch confidence of the provided pattern entry.
signature_t updateSignature(signature_t sig, stride_t str) const
Generates a new signature from an existing one and a new stride.
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.
const double lookaheadConfidenceThreshold
Minimum confidence to keep navigating lookahead entries.
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.
virtual double calculateLookaheadConfidence(PatternEntry const &sig, PatternStrideEntry const &lookahead) const
Computes the lookahead path confidence of the provided pattern entry.
uint16_t signature_t
Signature type.
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...
AssociativeSet< PatternEntry > patternTable
Pattern table.
void calculatePrefetch(const PrefetchInfo &pfi, std::vector< AddrPriority > &addresses) override
AssociativeSet< SignatureEntry > signatureTable
Signature table.
const unsigned stridesPerPatternEntry
Number of strides stored in each pattern entry.
const uint8_t signatureShift
Number of bits to shift when generating a new signature.
void updatePatternTable(Addr signature, stride_t stride)
Updates the pattern table with the provided signature and stride.
const signature_t signatureBits
Size of the signature, in bits.
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,...
PatternEntry & getPatternEntry(Addr signature)
Obtains the PatternEntry of the given signature, if the signature is not found, it allocates a new on...
virtual void increasePatternEntryCounter(PatternEntry &pattern_entry, PatternStrideEntry &pstride_entry)
Increases the counter of a given PatternEntry/PatternStrideEntry.
STL vector class.
Definition stl.hh:37
constexpr T bits(T val, unsigned first, unsigned last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
Definition bitfield.hh:76
void reset()
Reset the counter to its initial value.
Bitfield< 3, 0 > mask
Definition pcstate.hh:63
Bitfield< 21, 20 > stride
Bitfield< 0 > p
Bitfield< 43, 0 > ppn
Definition pagetable.hh:48
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition types.hh:147
Declaration of the Packet class.
Pattern entry data type, a set of stride and counter entries.
std::vector< PatternStrideEntry > strideEntries
group of stides
SatCounter8 counter
use counter, used by SPPv2
PatternStrideEntry & getStrideEntry(stride_t stride)
Gets the entry with the provided stride, if there is no entry with the associated stride,...
void invalidate() override
Reset the entries to their initial values.
PatternStrideEntry * findStride(stride_t stride)
Returns the entry with the desired stride.
PatternEntry(size_t num_strides, unsigned counter_bits)
stride_t stride
stride in a page in blkSize increments
stride_t lastBlock
Last accessed block within a page.

Generated on Mon Jul 10 2023 15:32:04 for gem5 by doxygen 1.9.7