gem5  v21.2.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__
gem5::prefetch::SignaturePath::stridesPerPatternEntry
const unsigned stridesPerPatternEntry
Number of strides stored in each pattern entry.
Definition: signature_path.hh:66
gem5::prefetch::SignaturePath::signatureBits
const signature_t signatureBits
Size of the signature, in bits.
Definition: signature_path.hh:70
gem5::prefetch::SignaturePath
Definition: signature_path.hh:57
gem5::prefetch::SignaturePath::PatternEntry::PatternEntry
PatternEntry(size_t num_strides, unsigned counter_bits)
Definition: signature_path.hh:106
gem5::prefetch::SignaturePath::PatternStrideEntry::PatternStrideEntry
PatternStrideEntry(unsigned bits)
Definition: signature_path.hh:96
gem5::prefetch::SignaturePath::PatternStrideEntry::stride
stride_t stride
stride in a page in blkSize increments
Definition: signature_path.hh:93
gem5::RiscvISA::ppn
Bitfield< 43, 0 > ppn
Definition: pagetable.hh:48
gem5::prefetch::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:282
gem5::prefetch::SignaturePath::lookaheadConfidenceThreshold
const double lookaheadConfidenceThreshold
Minimum confidence to keep navigating lookahead entries.
Definition: signature_path.hh:74
gem5::prefetch::SignaturePath::SignatureEntry
Signature entry data type.
Definition: signature_path.hh:77
gem5::prefetch::SignaturePath::signatureShift
const uint8_t signatureShift
Number of bits to shift when generating a new signature.
Definition: signature_path.hh:68
std::vector
STL vector class.
Definition: stl.hh:37
sat_counter.hh
gem5::prefetch::SignaturePath::PatternEntry::invalidate
void invalidate() override
Reset the entries to their initial values.
Definition: signature_path.hh:114
gem5::prefetch::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:214
gem5::prefetch::SignaturePath::prefetchConfidenceThreshold
const double prefetchConfidenceThreshold
Minimum confidence to issue a prefetch.
Definition: signature_path.hh:72
queued.hh
gem5::mask
constexpr uint64_t mask(unsigned nbits)
Generate a 64-bit mask of 'nbits' 1s, right justified.
Definition: bitfield.hh:63
packet.hh
gem5::GenericSatCounter< uint8_t >
gem5::prefetch::SignaturePath::SignatureEntry::signature
signature_t signature
Path signature.
Definition: signature_path.hh:80
gem5::prefetch::SignaturePath::signature_t
uint16_t signature_t
Signature type.
Definition: signature_path.hh:61
gem5::prefetch::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:314
gem5::TaggedEntry
A tagged entry is an entry containing a tag.
Definition: tagged_entry.hh:46
gem5::prefetch::SignaturePath::PatternEntry::findStride
PatternStrideEntry * findStride(stride_t stride)
Returns the entry with the desired stride.
Definition: signature_path.hh:130
gem5::prefetch::SignaturePath::increasePatternEntryCounter
virtual void increasePatternEntryCounter(PatternEntry &pattern_entry, PatternStrideEntry &pstride_entry)
Increases the counter of a given PatternEntry/PatternStrideEntry.
Definition: signature_path.cc:148
gem5::prefetch::SignaturePath::PatternEntry::counter
SatCounter8 counter
use counter, used by SPPv2
Definition: signature_path.hh:105
gem5::prefetch::SignaturePath::updatePatternTable
void updatePatternTable(Addr signature, stride_t stride)
Updates the pattern table with the provided signature and stride.
Definition: signature_path.cc:155
gem5::AssociativeSet
Associative container based on the previosuly defined Entry type Each element is indexed by a key of ...
Definition: associative_set.hh:45
gem5::MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:326
gem5::prefetch::SignaturePath::stride_t
int16_t stride_t
Stride type.
Definition: signature_path.hh:63
gem5::prefetch::SignaturePath::SignatureEntry::lastBlock
stride_t lastBlock
Last accessed block within a page.
Definition: signature_path.hh:82
gem5::GenericSatCounter::reset
void reset()
Reset the counter to its initial value.
Definition: sat_counter.hh:292
gem5::prefetch::SignaturePath::PatternStrideEntry
A stride entry with its counter.
Definition: signature_path.hh:90
gem5::prefetch::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:190
gem5::prefetch::SignaturePath::calculatePrefetch
void calculatePrefetch(const PrefetchInfo &pfi, std::vector< AddrPriority > &addresses) override
Definition: signature_path.cc:230
gem5::prefetch::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:71
gem5::bits
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
gem5::prefetch::SignaturePath::SignaturePath
SignaturePath(const SignaturePathPrefetcherParams &p)
Definition: signature_path.cc:45
gem5::TaggedEntry::invalidate
virtual void invalidate()
Invalidate the block.
Definition: tagged_entry.hh:103
gem5::prefetch::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:139
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
gem5::GEM5_DEPRECATED_NAMESPACE
GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi)
gem5::prefetch::Queued
Definition: queued.hh:60
gem5::prefetch::SignaturePath::SignatureEntry::SignatureEntry
SignatureEntry()
Definition: signature_path.hh:83
gem5::prefetch::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:98
gem5::prefetch::SignaturePath::signatureTable
AssociativeSet< SignatureEntry > signatureTable
Signature table.
Definition: signature_path.hh:87
gem5::prefetch::SignaturePath::patternTable
AssociativeSet< PatternEntry > patternTable
Pattern table.
Definition: signature_path.hh:151
gem5::prefetch::SignaturePath::PatternEntry
Pattern entry data type, a set of stride and counter entries.
Definition: signature_path.hh:100
gem5::prefetch::SignaturePath::PatternEntry::strideEntries
std::vector< PatternStrideEntry > strideEntries
group of stides
Definition: signature_path.hh:103
gem5::prefetch::SignaturePath::~SignaturePath
~SignaturePath()=default
gem5::prefetch::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:165
associative_set.hh
gem5::context_switch_task_id::Prefetcher
@ Prefetcher
Definition: request.hh:83
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: tlb.cc:60
gem5::prefetch::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:207
gem5::ArmISA::stride
Bitfield< 21, 20 > stride
Definition: misc_types.hh:447
gem5::prefetch::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:159
gem5::prefetch::SignaturePath::PatternStrideEntry::counter
SatCounter8 counter
Saturating counter.
Definition: signature_path.hh:95

Generated on Tue Dec 21 2021 11:34:32 for gem5 by doxygen 1.8.17