gem5 v24.1.0.1
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
44#include "mem/packet.hh"
45#include "sim/clocked_object.hh"
46
47namespace gem5
48{
49
50struct AccessMapPatternMatchingParams;
51struct AMPMPrefetcherParams;
52
53namespace prefetch
54{
55
57{
59 const unsigned blkSize;
61 const unsigned limitStride;
63 const unsigned startDegree;
65 const uint64_t hotZoneSize;
82
91
94 {
97
98 AccessMapEntry(size_t num_entries, TagExtractor ext)
99 : TaggedEntry(), states(num_entries, AM_INIT)
100 {
102 }
103
104 void
105 invalidate() override
106 {
108 for (auto &entry : states) {
109 entry = AM_INIT;
110 }
111 }
112 };
115
137 unsigned degree;
139 unsigned usefulDegree;
140
151 Addr current, int stride) const
152 {
153 enum AccessMapState tgt = states[current - stride];
154 enum AccessMapState s = states[current + stride];
155 enum AccessMapState s2 = states[current + 2 * stride];
156 enum AccessMapState s2_p1 = states[current + 2 * stride + 1];
157 return (tgt != AM_INVALID &&
158 ((s == AM_ACCESS && s2 == AM_ACCESS) ||
159 (s == AM_ACCESS && s2_p1 == AM_ACCESS)));
160 }
161
169 AccessMapEntry *getAccessMapEntry(Addr am_addr, bool is_secure);
170
178 void setEntryState(AccessMapEntry &entry, Addr block,
179 enum AccessMapState state);
180
186 void processEpochEvent();
188
189 public:
190 AccessMapPatternMatching(const AccessMapPatternMatchingParams &p);
192
193 void startup() override;
196 const CacheAccessor &cache);
197};
198
199class AMPM : public Queued
200{
202 public:
203 AMPM(const AMPMPrefetcherParams &p);
204 ~AMPM() = default;
205
206 void calculatePrefetch(const PrefetchInfo &pfi,
207 std::vector<AddrPriority> &addresses,
208 const CacheAccessor &cache) override;
209};
210
211} // namespace prefetch
212} // namespace gem5
213
214#endif//__MEM_CACHE_PREFETCH_ACCESS_MAP_PATTERN_MATCHING_HH__
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 registerTagExtractor(TagExtractor ext)
virtual void invalidate()
Invalidate the block.
std::function< Addr(Addr)> TagExtractor
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.
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.
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.
AssociativeCache< AccessMapEntry > accessMapTable
Access map table.
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< 12 > ext
Bitfield< 0 > p
Copyright (c) 2024 Arm Limited 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 Mon Jan 13 2025 04:28:38 for gem5 by doxygen 1.9.8