gem5  v22.1.0.0
access_map_pattern_matching.hh
Go to the documentation of this file.
1 
38 #ifndef __MEM_CACHE_PREFETCH_ACCESS_MAP_PATTERN_MATCHING_HH__
39 #define __MEM_CACHE_PREFETCH_ACCESS_MAP_PATTERN_MATCHING_HH__
40 
43 #include "mem/packet.hh"
44 #include "sim/clocked_object.hh"
45 
46 namespace gem5
47 {
48 
49 struct AccessMapPatternMatchingParams;
50 struct AMPMPrefetcherParams;
51 
53 namespace prefetch
54 {
55 
57 {
59  const unsigned blkSize;
61  const unsigned limitStride;
63  const unsigned startDegree;
65  const uint64_t hotZoneSize;
67  const double highCoverageThreshold;
69  const double lowCoverageThreshold;
71  const double highAccuracyThreshold;
73  const double lowAccuracyThreshold;
75  const double highCacheHitThreshold;
77  const double lowCacheHitThreshold;
82 
85  {
90  };
91 
93  struct AccessMapEntry : public TaggedEntry
94  {
97 
98  AccessMapEntry(size_t num_entries)
99  : TaggedEntry(), states(num_entries, AM_INIT)
100  {
101  }
102 
103  void
104  invalidate() override
105  {
107  for (auto &entry : states) {
108  entry = AM_INIT;
109  }
110  }
111  };
114 
134  uint64_t numRawCacheHits;
136  unsigned degree;
138  unsigned usefulDegree;
139 
149  inline bool checkCandidate(std::vector<AccessMapState> const &states,
150  Addr current, int stride) const
151  {
152  enum AccessMapState tgt = states[current - stride];
153  enum AccessMapState s = states[current + stride];
154  enum AccessMapState s2 = states[current + 2 * stride];
155  enum AccessMapState s2_p1 = states[current + 2 * stride + 1];
156  return (tgt != AM_INVALID &&
157  ((s == AM_ACCESS && s2 == AM_ACCESS) ||
158  (s == AM_ACCESS && s2_p1 == AM_ACCESS)));
159  }
160 
168  AccessMapEntry *getAccessMapEntry(Addr am_addr, bool is_secure);
169 
177  void setEntryState(AccessMapEntry &entry, Addr block,
178  enum AccessMapState state);
179 
185  void processEpochEvent();
187 
188  public:
189  AccessMapPatternMatching(const AccessMapPatternMatchingParams &p);
191 
192  void startup() override;
193  void calculatePrefetch(const Base::PrefetchInfo &pfi,
195 };
196 
197 class AMPM : public Queued
198 {
200  public:
201  AMPM(const AMPMPrefetcherParams &p);
202  ~AMPM() = default;
203 
204  void calculatePrefetch(const PrefetchInfo &pfi,
205  std::vector<AddrPriority> &addresses) override;
206 };
207 
208 } // namespace prefetch
209 } // namespace gem5
210 
211 #endif//__MEM_CACHE_PREFETCH_ACCESS_MAP_PATTERN_MATCHING_HH__
Associative container based on the previosuly defined Entry type Each element is indexed by a key of ...
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:79
A tagged entry is an entry containing a tag.
Definition: tagged_entry.hh:47
virtual void invalidate()
Invalidate the block.
AMPM(const AMPMPrefetcherParams &p)
void calculatePrefetch(const PrefetchInfo &pfi, std::vector< AddrPriority > &addresses) override
AccessMapPatternMatching & ampm
AccessMapState
Data type representing the state of a cacheline in the access map.
uint64_t numGoodPrefetches
Number of good prefetches.
AccessMapPatternMatching(const AccessMapPatternMatchingParams &p)
uint64_t numTotalPrefetches
Number of prefetches issued.
const double highCoverageThreshold
A prefetch coverage factor bigger than this is considered high.
uint64_t numRawCacheMisses
Number of raw cache misses.
const Tick offChipMemoryLatency
Off chip memory latency to use for the epoch bandwidth calculation.
const unsigned startDegree
Maximum number of prefetch generated.
AssociativeSet< AccessMapEntry > accessMapTable
Access map table.
const unsigned limitStride
Limit the stride checking to -limitStride/+limitStride.
void startup() override
startup() is the final initialization call before simulation.
const double highCacheHitThreshold
A cache hit ratio bigger than this is considered high.
void processEpochEvent()
This event constitues the epoch of the statistics that keep track of the prefetcher accuracy,...
uint64_t numRawCacheHits
Number of raw cache hits.
const double lowAccuracyThreshold
A prefetch accuracy factor smaller than this is considered low.
const double lowCacheHitThreshold
A cache hit ratio smaller than this is considered low.
const double highAccuracyThreshold
A prefetch accuracy factor bigger than this is considered high.
void setEntryState(AccessMapEntry &entry, Addr block, enum AccessMapState state)
Updates the state of a block within an AccessMapEntry, also updates the prefetcher metrics.
bool checkCandidate(std::vector< AccessMapState > const &states, Addr current, int stride) const
Given a target cacheline, this function checks if the cachelines that follow the provided stride have...
const unsigned blkSize
Cacheline size used by the prefetcher using this object.
const double lowCoverageThreshold
A prefetch coverage factor smaller than this is considered low.
void calculatePrefetch(const Base::PrefetchInfo &pfi, std::vector< Queued::AddrPriority > &addresses)
const Cycles epochCycles
Cycles in an epoch period.
AccessMapEntry * getAccessMapEntry(Addr am_addr, bool is_secure)
Obtain an AccessMapEntry from the AccessMapTable, if the entry is not found a new one is initialized ...
const uint64_t hotZoneSize
Amount of memory covered by a hot zone.
Class containing the information needed by the prefetch to train and generate new prefetch requests.
Definition: base.hh:98
ClockedObject declaration and implementation.
atomic_var_t state
Definition: helpers.cc:188
Bitfield< 21, 20 > stride
Definition: misc_types.hh:453
Bitfield< 1 > s
Definition: pagetable.hh:64
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
uint64_t Tick
Tick count type.
Definition: types.hh:58
GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi)
Declaration of the Packet class.
std::vector< AccessMapState > states
vector containing the state of the cachelines in this zone

Generated on Wed Dec 21 2022 10:22:36 for gem5 by doxygen 1.9.1