gem5 v24.0.0.0
Loading...
Searching...
No Matches
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
87
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 };
149
152
160 sig <<= signatureShift;
161 sig ^= str;
162 sig &= mask(signatureBits);
163 return sig;
164 }
165
180 void addPrefetch(Addr ppn, stride_t last_block, stride_t delta,
181 double path_confidence, signature_t signature,
182 bool is_secure,
183 std::vector<AddrPriority> &addresses);
184
198 SignatureEntry &getSignatureEntry(Addr ppn, bool is_secure, stride_t block,
199 bool &miss, stride_t &stride, double &initial_confidence);
206 PatternEntry& getPatternEntry(Addr signature);
207
214 void updatePatternTable(Addr signature, stride_t stride);
215
222 virtual double calculateLookaheadConfidence(PatternEntry const &sig,
223 PatternStrideEntry const &lookahead) const;
224
231 virtual double calculatePrefetchConfidence(PatternEntry const &sig,
232 PatternStrideEntry const &entry) const;
233
239 virtual void increasePatternEntryCounter(PatternEntry &pattern_entry,
240 PatternStrideEntry &pstride_entry);
241
252 virtual void handleSignatureTableMiss(stride_t current_block,
253 signature_t &new_signature, double &new_conf,
254 stride_t &new_stride);
255
267 virtual void auxiliaryPrefetcher(Addr ppn, stride_t current_block,
268 bool is_secure, std::vector<AddrPriority> &addresses);
269
283 stride_t last_offset, stride_t delta, double path_confidence) {
284 }
285
286 public:
287 SignaturePath(const SignaturePathPrefetcherParams &p);
288 ~SignaturePath() = default;
289
290 void calculatePrefetch(const PrefetchInfo &pfi,
291 std::vector<AddrPriority> &addresses,
292 const CacheAccessor &cache) override;
293};
294
295} // namespace prefetch
296} // namespace gem5
297
298#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.
void invalidate() override
Invalidate the block.
Class containing the information needed by the prefetch to train and generate new prefetch requests.
Definition base.hh:111
SignaturePath(const SignaturePathPrefetcherParams &p)
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.
void calculatePrefetch(const PrefetchInfo &pfi, std::vector< AddrPriority > &addresses, const CacheAccessor &cache) override
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...
AssociativeCache< PatternEntry > patternTable
Pattern table.
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:79
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
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
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.
Provides generic cache lookup functions.
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 Tue Jun 18 2024 16:24:05 for gem5 by doxygen 1.11.0