gem5 v24.1.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
44#include "base/sat_counter.hh"
47#include "mem/packet.hh"
48
49namespace gem5
50{
51
52struct SignaturePathPrefetcherParams;
53
54namespace prefetch
55{
56
57class SignaturePath : public Queued
58{
59 protected:
61 typedef uint16_t signature_t;
63 typedef int16_t stride_t;
64
66 const unsigned stridesPerPatternEntry;
68 const uint8_t signatureShift;
75
91
103 struct PatternEntry : public TaggedEntry
104 {
109 PatternEntry(size_t num_strides, unsigned counter_bits,
111 : TaggedEntry(), strideEntries(num_strides, counter_bits),
112 counter(counter_bits)
113 {
115 }
116
118 void
119 invalidate() override
120 {
122 for (auto &entry : strideEntries) {
123 entry.counter.reset();
124 entry.stride = 0;
125 }
126 counter.reset();
127 }
128
136 {
137 PatternStrideEntry *found_entry = nullptr;
138 for (auto &entry : strideEntries) {
139 if (entry.stride == stride) {
140 found_entry = &entry;
141 break;
142 }
143 }
144 return found_entry;
145 }
146
154 };
155
158
166 sig <<= signatureShift;
167 sig ^= str;
168 sig &= mask(signatureBits);
169 return sig;
170 }
171
186 void addPrefetch(Addr ppn, stride_t last_block, stride_t delta,
187 double path_confidence, signature_t signature,
188 bool is_secure,
189 std::vector<AddrPriority> &addresses);
190
204 SignatureEntry &getSignatureEntry(Addr ppn, bool is_secure, stride_t block,
205 bool &miss, stride_t &stride, double &initial_confidence);
212 PatternEntry& getPatternEntry(Addr signature);
213
220 void updatePatternTable(Addr signature, stride_t stride);
221
228 virtual double calculateLookaheadConfidence(PatternEntry const &sig,
229 PatternStrideEntry const &lookahead) const;
230
237 virtual double calculatePrefetchConfidence(PatternEntry const &sig,
238 PatternStrideEntry const &entry) const;
239
245 virtual void increasePatternEntryCounter(PatternEntry &pattern_entry,
246 PatternStrideEntry &pstride_entry);
247
258 virtual void handleSignatureTableMiss(stride_t current_block,
259 signature_t &new_signature, double &new_conf,
260 stride_t &new_stride);
261
273 virtual void auxiliaryPrefetcher(Addr ppn, stride_t current_block,
274 bool is_secure, std::vector<AddrPriority> &addresses);
275
289 stride_t last_offset, stride_t delta, double path_confidence) {
290 }
291
292 public:
293 SignaturePath(const SignaturePathPrefetcherParams &p);
294 ~SignaturePath() = default;
295
296 void calculatePrefetch(const PrefetchInfo &pfi,
297 std::vector<AddrPriority> &addresses,
298 const CacheAccessor &cache) override;
299};
300
301} // namespace prefetch
302} // namespace gem5
303
304#endif//__MEM_CACHE_PREFETCH_SIGNATURE_PATH_HH__
A tagged entry is an entry containing a tag.
void registerTagExtractor(TagExtractor ext)
virtual void invalidate()
Invalidate the block.
std::function< Addr(Addr)> TagExtractor
Class containing the information needed by the prefetch to train and generate new prefetch requests.
Definition base.hh:111
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.
AssociativeCache< SignatureEntry > signatureTable
Signature table.
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.
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< 12 > ext
Bitfield< 0 > p
Bitfield< 43, 0 > ppn
Definition pagetable.hh:48
Copyright (c) 2024 Arm Limited 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,...
PatternEntry(size_t num_strides, unsigned counter_bits, TagExtractor ext)
void invalidate() override
Reset the entries to their initial values.
PatternStrideEntry * findStride(stride_t stride)
Returns the entry with the desired stride.
stride_t stride
stride in a page in blkSize increments
stride_t lastBlock
Last accessed block within a page.

Generated on Mon Jan 13 2025 04:28:38 for gem5 by doxygen 1.9.8