gem5  v20.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 struct AccessMapPatternMatchingParams;
47 struct AMPMPrefetcherParams;
48 
49 namespace Prefetcher {
50 
52 {
54  const unsigned blkSize;
56  const unsigned limitStride;
58  const unsigned startDegree;
60  const uint64_t hotZoneSize;
62  const double highCoverageThreshold;
64  const double lowCoverageThreshold;
66  const double highAccuracyThreshold;
68  const double lowAccuracyThreshold;
70  const double highCacheHitThreshold;
72  const double lowCacheHitThreshold;
77 
80  {
85  };
86 
88  struct AccessMapEntry : public TaggedEntry
89  {
92 
93  AccessMapEntry(size_t num_entries)
94  : TaggedEntry(), states(num_entries, AM_INIT)
95  {
96  }
97 
98  void
99  invalidate() override
100  {
102  for (auto &entry : states) {
103  entry = AM_INIT;
104  }
105  }
106  };
109 
129  uint64_t numRawCacheHits;
131  unsigned degree;
133  unsigned usefulDegree;
134 
144  inline bool checkCandidate(std::vector<AccessMapState> const &states,
145  Addr current, int stride) const
146  {
147  enum AccessMapState tgt = states[current - stride];
148  enum AccessMapState s = states[current + stride];
149  enum AccessMapState s2 = states[current + 2 * stride];
150  enum AccessMapState s2_p1 = states[current + 2 * stride + 1];
151  return (tgt != AM_INVALID &&
152  ((s == AM_ACCESS && s2 == AM_ACCESS) ||
153  (s == AM_ACCESS && s2_p1 == AM_ACCESS)));
154  }
155 
163  AccessMapEntry *getAccessMapEntry(Addr am_addr, bool is_secure);
164 
172  void setEntryState(AccessMapEntry &entry, Addr block,
173  enum AccessMapState state);
174 
180  void processEpochEvent();
182 
183  public:
184  AccessMapPatternMatching(const AccessMapPatternMatchingParams* p);
185  ~AccessMapPatternMatching() = default;
186 
187  void startup() override;
188  void calculatePrefetch(const Base::PrefetchInfo &pfi,
190 };
191 
192 class AMPM : public Queued
193 {
195  public:
196  AMPM(const AMPMPrefetcherParams* p);
197  ~AMPM() = default;
198 
199  void calculatePrefetch(const PrefetchInfo &pfi,
200  std::vector<AddrPriority> &addresses) override;
201 };
202 
203 } // namespace Prefetcher
204 
205 #endif//__MEM_CACHE_PREFETCH_ACCESS_MAP_PATTERN_MATCHING_HH__
Prefetcher::AccessMapPatternMatching::lowCoverageThreshold
const double lowCoverageThreshold
A prefetch coverage factor smaller than this is considered low.
Definition: access_map_pattern_matching.hh:64
Prefetcher::AccessMapPatternMatching::numTotalPrefetches
uint64_t numTotalPrefetches
Number of prefetches issued.
Definition: access_map_pattern_matching.hh:119
Prefetcher::AccessMapPatternMatching::numGoodPrefetches
uint64_t numGoodPrefetches
Number of good prefetches.
Definition: access_map_pattern_matching.hh:114
Prefetcher::AccessMapPatternMatching::AM_INVALID
@ AM_INVALID
Definition: access_map_pattern_matching.hh:84
Prefetcher::AccessMapPatternMatching::AM_INIT
@ AM_INIT
Definition: access_map_pattern_matching.hh:81
Prefetcher::AccessMapPatternMatching::calculatePrefetch
void calculatePrefetch(const Base::PrefetchInfo &pfi, std::vector< Queued::AddrPriority > &addresses)
Definition: access_map_pattern_matching.cc:154
Prefetcher::AMPM::AMPM
AMPM(const AMPMPrefetcherParams *p)
Definition: access_map_pattern_matching.cc:254
Prefetcher::AccessMapPatternMatching::processEpochEvent
void processEpochEvent()
This event constitues the epoch of the statistics that keep track of the prefetcher accuracy,...
Definition: access_map_pattern_matching.cc:69
Prefetcher::AccessMapPatternMatching::offChipMemoryLatency
const Tick offChipMemoryLatency
Off chip memory latency to use for the epoch bandwidth calculation.
Definition: access_map_pattern_matching.hh:76
Prefetcher::AccessMapPatternMatching::AccessMapState
AccessMapState
Data type representing the state of a cacheline in the access map.
Definition: access_map_pattern_matching.hh:79
Prefetcher::AccessMapPatternMatching::~AccessMapPatternMatching
~AccessMapPatternMatching()=default
Prefetcher::AccessMapPatternMatching::startup
void startup() override
startup() is the final initialization call before simulation.
Definition: access_map_pattern_matching.cc:63
Prefetcher::AccessMapPatternMatching::AccessMapEntry
AccessMapEntry data type.
Definition: access_map_pattern_matching.hh:88
Prefetcher::AMPM::ampm
AccessMapPatternMatching & ampm
Definition: access_map_pattern_matching.hh:194
TaggedEntry
Copyright (c) 2018 Metempsy Technology Consulting All rights reserved.
Definition: associative_set.hh:39
Prefetcher::AccessMapPatternMatching::epochCycles
const Cycles epochCycles
Cycles in an epoch period.
Definition: access_map_pattern_matching.hh:74
AssociativeSet
Associative container based on the previosuly defined Entry type Each element is indexed by a key of ...
Definition: associative_set.hh:117
Prefetcher::AccessMapPatternMatching::numRawCacheMisses
uint64_t numRawCacheMisses
Number of raw cache misses.
Definition: access_map_pattern_matching.hh:124
Tick
uint64_t Tick
Tick count type.
Definition: types.hh:63
Prefetcher::AccessMapPatternMatching::AccessMapPatternMatching
AccessMapPatternMatching(const AccessMapPatternMatchingParams *p)
Definition: access_map_pattern_matching.cc:38
Prefetcher::AccessMapPatternMatching::degree
unsigned degree
Current degree.
Definition: access_map_pattern_matching.hh:131
Prefetcher::AccessMapPatternMatching::getAccessMapEntry
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 ...
Definition: access_map_pattern_matching.cc:103
Prefetcher::AccessMapPatternMatching::highCacheHitThreshold
const double highCacheHitThreshold
A cache hit ratio bigger than this is considered high.
Definition: access_map_pattern_matching.hh:70
std::vector< AccessMapState >
Prefetcher::AccessMapPatternMatching::lowAccuracyThreshold
const double lowAccuracyThreshold
A prefetch accuracy factor smaller than this is considered low.
Definition: access_map_pattern_matching.hh:68
Prefetcher::AMPM::calculatePrefetch
void calculatePrefetch(const PrefetchInfo &pfi, std::vector< AddrPriority > &addresses) override
Definition: access_map_pattern_matching.cc:260
queued.hh
ClockedObject
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
Definition: clocked_object.hh:231
packet.hh
Prefetcher::AMPM::~AMPM
~AMPM()=default
EventFunctionWrapper
Definition: eventq.hh:1101
Prefetcher::AccessMapPatternMatching::highCoverageThreshold
const double highCoverageThreshold
A prefetch coverage factor bigger than this is considered high.
Definition: access_map_pattern_matching.hh:62
Prefetcher::AccessMapPatternMatching::AM_ACCESS
@ AM_ACCESS
Definition: access_map_pattern_matching.hh:83
Prefetcher::AccessMapPatternMatching::numRawCacheHits
uint64_t numRawCacheHits
Number of raw cache hits.
Definition: access_map_pattern_matching.hh:129
Prefetcher::AccessMapPatternMatching::limitStride
const unsigned limitStride
Limit the stride checking to -limitStride/+limitStride.
Definition: access_map_pattern_matching.hh:56
Prefetcher::AccessMapPatternMatching::highAccuracyThreshold
const double highAccuracyThreshold
A prefetch accuracy factor bigger than this is considered high.
Definition: access_map_pattern_matching.hh:66
Prefetcher
Copyright (c) 2018 Metempsy Technology Consulting All rights reserved.
Definition: base.hh:78
Prefetcher::AccessMapPatternMatching::AccessMapEntry::invalidate
void invalidate() override
Invalidates the entry.
Definition: access_map_pattern_matching.hh:99
Prefetcher::AMPM
Definition: access_map_pattern_matching.hh:192
Prefetcher::AccessMapPatternMatching::checkCandidate
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...
Definition: access_map_pattern_matching.hh:144
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
Prefetcher::AccessMapPatternMatching::AM_PREFETCH
@ AM_PREFETCH
Definition: access_map_pattern_matching.hh:82
Prefetcher::AccessMapPatternMatching::AccessMapEntry::AccessMapEntry
AccessMapEntry(size_t num_entries)
Definition: access_map_pattern_matching.hh:93
Prefetcher::AccessMapPatternMatching::accessMapTable
AssociativeSet< AccessMapEntry > accessMapTable
Access map table.
Definition: access_map_pattern_matching.hh:108
TaggedEntry::invalidate
virtual void invalidate()
Invalidates the entry.
Definition: associative_set.hh:69
Prefetcher::AccessMapPatternMatching::AccessMapEntry::states
std::vector< AccessMapState > states
vector containing the state of the cachelines in this zone
Definition: access_map_pattern_matching.hh:91
clocked_object.hh
Prefetcher::Base::PrefetchInfo
Class containing the information needed by the prefetch to train and generate new prefetch requests.
Definition: base.hh:90
Prefetcher::AccessMapPatternMatching::hotZoneSize
const uint64_t hotZoneSize
Amount of memory covered by a hot zone.
Definition: access_map_pattern_matching.hh:60
ArmISA::stride
Bitfield< 21, 20 > stride
Definition: miscregs_types.hh:441
Cycles
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:83
Prefetcher::AccessMapPatternMatching::setEntryState
void setEntryState(AccessMapEntry &entry, Addr block, enum AccessMapState state)
Updates the state of a block within an AccessMapEntry, also updates the prefetcher metrics.
Definition: access_map_pattern_matching.cc:119
associative_set.hh
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
Prefetcher::AccessMapPatternMatching::epochEvent
EventFunctionWrapper epochEvent
Definition: access_map_pattern_matching.hh:181
ArmISA::s
Bitfield< 4 > s
Definition: miscregs_types.hh:556
Prefetcher::AccessMapPatternMatching::usefulDegree
unsigned usefulDegree
Current useful degree.
Definition: access_map_pattern_matching.hh:133
Prefetcher::AccessMapPatternMatching::startDegree
const unsigned startDegree
Maximum number of prefetch generated.
Definition: access_map_pattern_matching.hh:58
Prefetcher::AccessMapPatternMatching::lowCacheHitThreshold
const double lowCacheHitThreshold
A cache hit ratio smaller than this is considered low.
Definition: access_map_pattern_matching.hh:72
Prefetcher::AccessMapPatternMatching
Definition: access_map_pattern_matching.hh:51
Prefetcher::AccessMapPatternMatching::blkSize
const unsigned blkSize
Cacheline size used by the prefetcher using this object.
Definition: access_map_pattern_matching.hh:54

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