gem5 v24.0.0.0
Loading...
Searching...
No Matches
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
46namespace gem5
47{
48
49struct AccessMapPatternMatchingParams;
50struct AMPMPrefetcherParams;
51
52namespace prefetch
53{
54
56{
58 const unsigned blkSize;
60 const unsigned limitStride;
62 const unsigned startDegree;
64 const uint64_t hotZoneSize;
81
90
93 {
96
97 AccessMapEntry(size_t num_entries)
98 : TaggedEntry(), states(num_entries, AM_INIT)
99 {
100 }
101
102 void
103 invalidate() override
104 {
106 for (auto &entry : states) {
107 entry = AM_INIT;
108 }
109 }
110 };
113
135 unsigned degree;
137 unsigned usefulDegree;
138
149 Addr current, int stride) const
150 {
151 enum AccessMapState tgt = states[current - stride];
152 enum AccessMapState s = states[current + stride];
153 enum AccessMapState s2 = states[current + 2 * stride];
154 enum AccessMapState s2_p1 = states[current + 2 * stride + 1];
155 return (tgt != AM_INVALID &&
156 ((s == AM_ACCESS && s2 == AM_ACCESS) ||
157 (s == AM_ACCESS && s2_p1 == AM_ACCESS)));
158 }
159
167 AccessMapEntry *getAccessMapEntry(Addr am_addr, bool is_secure);
168
176 void setEntryState(AccessMapEntry &entry, Addr block,
177 enum AccessMapState state);
178
184 void processEpochEvent();
186
187 public:
188 AccessMapPatternMatching(const AccessMapPatternMatchingParams &p);
190
191 void startup() override;
194 const CacheAccessor &cache);
195};
196
197class 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,
206 const CacheAccessor &cache) override;
207};
208
209} // namespace prefetch
210} // namespace gem5
211
212#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.
void invalidate() override
Invalidate the block.
AMPM(const AMPMPrefetcherParams &p)
void calculatePrefetch(const PrefetchInfo &pfi, std::vector< AddrPriority > &addresses, const CacheAccessor &cache) 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,...
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 calculatePrefetch(const Base::PrefetchInfo &pfi, std::vector< Queued::AddrPriority > &addresses, const CacheAccessor &cache)
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.
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:111
STL vector class.
Definition stl.hh:37
ClockedObject declaration and implementation.
atomic_var_t state
Definition helpers.cc:211
Bitfield< 4 > s
Bitfield< 21, 20 > stride
Bitfield< 0 > p
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
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
Declaration of the Packet class.
Provides generic cache lookup functions.
std::vector< AccessMapState > states
vector containing the state of the cachelines in this zone

Generated on Tue Jun 18 2024 16:24:05 for gem5 by doxygen 1.11.0