gem5  v22.1.0.0
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 
48 namespace gem5
49 {
50 
51 struct SignaturePathPrefetcherParams;
52 
54 namespace prefetch
55 {
56 
57 class 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 
77  struct SignatureEntry : public TaggedEntry
78  {
84  {}
85  };
88 
91  {
97  {}
98  };
100  struct PatternEntry : public TaggedEntry
101  {
106  PatternEntry(size_t num_strides, unsigned counter_bits)
107  : TaggedEntry(), strideEntries(num_strides, counter_bits),
108  counter(counter_bits)
109  {
110  }
111 
113  void
114  invalidate() override
115  {
117  for (auto &entry : strideEntries) {
118  entry.counter.reset();
119  entry.stride = 0;
120  }
121  counter.reset();
122  }
123 
131  {
132  PatternStrideEntry *found_entry = nullptr;
133  for (auto &entry : strideEntries) {
134  if (entry.stride == stride) {
135  found_entry = &entry;
136  break;
137  }
138  }
139  return found_entry;
140  }
141 
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 
282  virtual void handlePageCrossingLookahead(signature_t signature,
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) override;
292 };
293 
294 } // namespace prefetch
295 } // namespace gem5
296 
297 #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.
Definition: tagged_entry.hh:47
virtual void invalidate()
Invalidate the block.
Class containing the information needed by the prefetch to train and generate new prefetch requests.
Definition: base.hh:98
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.
int16_t stride_t
Stride type.
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
constexpr uint64_t mask(unsigned nbits)
Generate a 64-bit mask of 'nbits' 1s, right justified.
Definition: bitfield.hh:63
void reset()
Reset the counter to its initial value.
Definition: sat_counter.hh:292
Bitfield< 21, 20 > stride
Definition: misc_types.hh:453
Bitfield< 47, 12 > ppn
Definition: pagetable.hh:57
Bitfield< 54 > p
Definition: pagetable.hh:70
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
GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi)
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 Wed Dec 21 2022 10:22:36 for gem5 by doxygen 1.9.1