gem5  v20.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 struct SignaturePathPrefetcherParams;
49 
50 namespace Prefetcher {
51 
52 class SignaturePath : public Queued
53 {
54  protected:
56  typedef uint16_t signature_t;
58  typedef int16_t stride_t;
59 
61  const unsigned stridesPerPatternEntry;
63  const uint8_t signatureShift;
70 
72  struct SignatureEntry : public TaggedEntry
73  {
79  {}
80  };
83 
86  {
92  {}
93  };
95  struct PatternEntry : public TaggedEntry
96  {
101  PatternEntry(size_t num_strides, unsigned counter_bits)
102  : TaggedEntry(), strideEntries(num_strides, counter_bits),
103  counter(counter_bits)
104  {
105  }
106 
108  void
109  invalidate() override
110  {
112  for (auto &entry : strideEntries) {
113  entry.counter.reset();
114  entry.stride = 0;
115  }
116  counter.reset();
117  }
118 
126  {
127  PatternStrideEntry *found_entry = nullptr;
128  for (auto &entry : strideEntries) {
129  if (entry.stride == stride) {
130  found_entry = &entry;
131  break;
132  }
133  }
134  return found_entry;
135  }
136 
144  };
147 
155  sig <<= signatureShift;
156  sig ^= str;
157  sig &= mask(signatureBits);
158  return sig;
159  }
160 
175  void addPrefetch(Addr ppn, stride_t last_block, stride_t delta,
176  double path_confidence, signature_t signature,
177  bool is_secure,
178  std::vector<AddrPriority> &addresses);
179 
193  SignatureEntry &getSignatureEntry(Addr ppn, bool is_secure, stride_t block,
194  bool &miss, stride_t &stride, double &initial_confidence);
201  PatternEntry& getPatternEntry(Addr signature);
202 
209  void updatePatternTable(Addr signature, stride_t stride);
210 
217  virtual double calculateLookaheadConfidence(PatternEntry const &sig,
218  PatternStrideEntry const &lookahead) const;
219 
226  virtual double calculatePrefetchConfidence(PatternEntry const &sig,
227  PatternStrideEntry const &entry) const;
228 
234  virtual void increasePatternEntryCounter(PatternEntry &pattern_entry,
235  PatternStrideEntry &pstride_entry);
236 
247  virtual void handleSignatureTableMiss(stride_t current_block,
248  signature_t &new_signature, double &new_conf,
249  stride_t &new_stride);
250 
262  virtual void auxiliaryPrefetcher(Addr ppn, stride_t current_block,
263  bool is_secure, std::vector<AddrPriority> &addresses);
264 
277  virtual void handlePageCrossingLookahead(signature_t signature,
278  stride_t last_offset, stride_t delta, double path_confidence) {
279  }
280 
281  public:
282  SignaturePath(const SignaturePathPrefetcherParams* p);
283  ~SignaturePath() = default;
284 
285  void calculatePrefetch(const PrefetchInfo &pfi,
286  std::vector<AddrPriority> &addresses) override;
287 };
288 
289 } // namespace Prefetcher
290 
291 #endif//__MEM_CACHE_PREFETCH_SIGNATURE_PATH_HH__
Prefetcher::SignaturePath::SignatureEntry::lastBlock
stride_t lastBlock
Last accessed block within a page.
Definition: signature_path.hh:77
Prefetcher::SignaturePath::getPatternEntry
PatternEntry & getPatternEntry(Addr signature)
Obtains the PatternEntry of the given signature, if the signature is not found, it allocates a new on...
Definition: signature_path.cc:185
SatCounter::reset
void reset()
Reset the counter to its initial value.
Definition: sat_counter.hh:286
Prefetcher::SignaturePath::increasePatternEntryCounter
virtual void increasePatternEntryCounter(PatternEntry &pattern_entry, PatternStrideEntry &pstride_entry)
Increases the counter of a given PatternEntry/PatternStrideEntry.
Definition: signature_path.cc:143
Prefetcher::SignaturePath::PatternStrideEntry
A stride entry with its counter.
Definition: signature_path.hh:85
TaggedEntry
Copyright (c) 2018 Metempsy Technology Consulting All rights reserved.
Definition: associative_set.hh:39
RiscvISA::ppn
Bitfield< 43, 0 > ppn
Definition: pagetable.hh:44
Prefetcher::SignaturePath::patternTable
AssociativeSet< PatternEntry > patternTable
Pattern table.
Definition: signature_path.hh:146
AssociativeSet
Associative container based on the previosuly defined Entry type Each element is indexed by a key of ...
Definition: associative_set.hh:117
Prefetcher::SignaturePath::PatternEntry::invalidate
void invalidate() override
Reset the entries to their initial values.
Definition: signature_path.hh:109
Prefetcher::SignaturePath::PatternEntry::getStrideEntry
PatternStrideEntry & getStrideEntry(stride_t stride)
Gets the entry with the provided stride, if there is no entry with the associated stride,...
Definition: signature_path.cc:66
Prefetcher::SignaturePath::calculateLookaheadConfidence
virtual double calculateLookaheadConfidence(PatternEntry const &sig, PatternStrideEntry const &lookahead) const
Computes the lookahead path confidence of the provided pattern entry.
Definition: signature_path.cc:209
Prefetcher::SignaturePath::calculatePrefetch
void calculatePrefetch(const PrefetchInfo &pfi, std::vector< AddrPriority > &addresses) override
Definition: signature_path.cc:225
std::vector
STL vector class.
Definition: stl.hh:37
Prefetcher::SignaturePath::stridesPerPatternEntry
const unsigned stridesPerPatternEntry
Number of strides stored in each pattern entry.
Definition: signature_path.hh:61
Prefetcher::SignaturePath::PatternStrideEntry::stride
stride_t stride
stride in a page in blkSize increments
Definition: signature_path.hh:88
Prefetcher::SignaturePath::PatternEntry::PatternEntry
PatternEntry(size_t num_strides, unsigned counter_bits)
Definition: signature_path.hh:101
sat_counter.hh
queued.hh
packet.hh
Prefetcher::SignaturePath::stride_t
int16_t stride_t
Stride type.
Definition: signature_path.hh:58
Prefetcher::SignaturePath::SignatureEntry::signature
signature_t signature
Path signature.
Definition: signature_path.hh:75
Prefetcher::SignaturePath::lookaheadConfidenceThreshold
const double lookaheadConfidenceThreshold
Minimum confidence to keep navigating lookahead entries.
Definition: signature_path.hh:69
Prefetcher::SignaturePath::updateSignature
signature_t updateSignature(signature_t sig, stride_t str) const
Generates a new signature from an existing one and a new stride.
Definition: signature_path.hh:154
Prefetcher::SignaturePath::PatternEntry
Pattern entry data type, a set of stride and counter entries.
Definition: signature_path.hh:95
Prefetcher::SignaturePath::PatternStrideEntry::counter
SatCounter counter
Saturating counter.
Definition: signature_path.hh:90
Prefetcher
Copyright (c) 2018 Metempsy Technology Consulting All rights reserved.
Definition: base.hh:78
Prefetcher::SignaturePath::calculatePrefetchConfidence
virtual double calculatePrefetchConfidence(PatternEntry const &sig, PatternStrideEntry const &entry) const
Computes the prefetch confidence of the provided pattern entry.
Definition: signature_path.cc:202
Prefetcher::SignaturePath::signatureTable
AssociativeSet< SignatureEntry > signatureTable
Signature table.
Definition: signature_path.hh:82
Prefetcher::SignaturePath::PatternEntry::strideEntries
std::vector< PatternStrideEntry > strideEntries
group of stides
Definition: signature_path.hh:98
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
Prefetcher::Queued
Definition: queued.hh:54
SatCounter
Implements an n bit saturating counter and provides methods to increment, decrement,...
Definition: sat_counter.hh:54
Prefetcher::SignaturePath::signatureShift
const uint8_t signatureShift
Number of bits to shift when generating a new signature.
Definition: signature_path.hh:63
Prefetcher::SignaturePath::PatternStrideEntry::PatternStrideEntry
PatternStrideEntry(unsigned bits)
Definition: signature_path.hh:91
TaggedEntry::invalidate
virtual void invalidate()
Invalidates the entry.
Definition: associative_set.hh:69
Prefetcher::SignaturePath::updatePatternTable
void updatePatternTable(Addr signature, stride_t stride)
Updates the pattern table with the provided signature and stride.
Definition: signature_path.cc:150
Prefetcher::SignaturePath
Definition: signature_path.hh:52
Prefetcher::SignaturePath::signature_t
uint16_t signature_t
Signature type.
Definition: signature_path.hh:56
ArmISA::stride
Bitfield< 21, 20 > stride
Definition: miscregs_types.hh:441
Prefetcher::SignaturePath::prefetchConfidenceThreshold
const double prefetchConfidenceThreshold
Minimum confidence to issue a prefetch.
Definition: signature_path.hh:67
Prefetcher::SignaturePath::auxiliaryPrefetcher
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.
Definition: signature_path.cc:309
associative_set.hh
Prefetcher::SignaturePath::getSignatureEntry
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,...
Definition: signature_path.cc:160
Prefetcher::SignaturePath::SignatureEntry::SignatureEntry
SignatureEntry()
Definition: signature_path.hh:78
Prefetcher::SignaturePath::PatternEntry::counter
SatCounter counter
use counter, used by SPPv2
Definition: signature_path.hh:100
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
Prefetcher::SignaturePath::addPrefetch
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.
Definition: signature_path.cc:93
Prefetcher::SignaturePath::signatureBits
const signature_t signatureBits
Size of the signature, in bits.
Definition: signature_path.hh:65
Prefetcher::SignaturePath::handlePageCrossingLookahead
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.
Definition: signature_path.hh:277
Prefetcher::SignaturePath::SignaturePath
SignaturePath(const SignaturePathPrefetcherParams *p)
Definition: signature_path.cc:40
Prefetcher::SignaturePath::PatternEntry::findStride
PatternStrideEntry * findStride(stride_t stride)
Returns the entry with the desired stride.
Definition: signature_path.hh:125
Prefetcher::SignaturePath::handleSignatureTableMiss
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...
Definition: signature_path.cc:134
Prefetcher::SignaturePath::~SignaturePath
~SignaturePath()=default
Prefetcher::SignaturePath::SignatureEntry
Signature entry data type.
Definition: signature_path.hh:72
ArmISA::mask
Bitfield< 28, 24 > mask
Definition: miscregs_types.hh:711
bits
T bits(T val, int first, int last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
Definition: bitfield.hh:75

Generated on Wed Sep 30 2020 14:02:12 for gem5 by doxygen 1.8.17