33 #include "debug/HWPrefetch.hh" 35 #include "params/AMPMPrefetcher.hh" 36 #include "params/AccessMapPatternMatching.hh" 39 const AccessMapPatternMatchingParams *
p)
40 :
ClockedObject(p), blkSize(p->block_size), limitStride(p->limit_stride),
41 startDegree(p->start_degree), hotZoneSize(p->hot_zone_size),
42 highCoverageThreshold(p->high_coverage_threshold),
43 lowCoverageThreshold(p->low_coverage_threshold),
44 highAccuracyThreshold(p->high_accuracy_threshold),
45 lowAccuracyThreshold(p->low_accuracy_threshold),
46 highCacheHitThreshold(p->high_cache_hit_threshold),
47 lowCacheHitThreshold(p->low_cache_hit_threshold),
48 epochCycles(p->epoch_cycles),
49 offChipMemoryLatency(p->offchip_memory_latency),
50 accessMapTable(p->access_map_table_assoc, p->access_map_table_entries,
51 p->access_map_table_indexing_policy,
52 p->access_map_table_replacement_policy,
54 numGoodPrefetches(0), numTotalPrefetches(0), numRawCacheMisses(0),
55 numRawCacheHits(0), degree(startDegree), usefulDegree(startDegree),
59 "the hot zone size must be a power of 2");
72 double prefetch_accuracy =
74 double prefetch_coverage =
97 numTotalPrefetches = 0.0;
98 numRawCacheMisses = 0.0;
107 if (am_entry !=
nullptr) {
111 assert(am_entry !=
nullptr);
123 entry.
states[block] = state;
148 panic(
"Impossible path\n");
158 assert(addresses.empty());
172 assert(am_entry_curr != am_entry_prev);
173 assert(am_entry_curr != am_entry_next);
174 assert(am_entry_prev != am_entry_next);
175 assert(am_entry_curr !=
nullptr);
186 for (
unsigned idx = 0; idx < lines_per_zone; idx += 1) {
189 states[idx + lines_per_zone] = am_entry_curr->
states[idx];
190 states[idx + 2 * lines_per_zone] =
201 Addr states_current_block = current_block + lines_per_zone;
209 if (
stride > current_block) {
224 if (addresses.size() ==
degree) {
233 if (current_block +
stride >= lines_per_zone) {
237 Addr blk = (states_current_block +
stride) % lines_per_zone;
248 if (addresses.size() ==
degree) {
256 AccessMapPatternMatchingParams::create()
274 AMPMPrefetcherParams::create()
const Tick offChipMemoryLatency
Off chip memory latency to use for the epoch bandwidth calculation.
#define panic(...)
This implements a cprintf based panic() function.
EventFunctionWrapper epochEvent
const double highAccuracyThreshold
A prefetch accuracy factor bigger than this is considered high.
void processEpochEvent()
This event constitues the epoch of the statistics that keep track of the prefetcher accuracy...
std::vector< AccessMapState > states
vector containing the state of the cachelines in this zone
Bitfield< 21, 20 > stride
unsigned degree
Current degree.
AccessMapPatternMatching & ampm
void startup() override
startup() is the final initialization call before simulation.
bool isSecure() const
Returns true if the address targets the secure memory space.
const double lowCacheHitThreshold
A cache hit ratio smaller than this is considered low.
uint64_t numTotalPrefetches
Number of prefetches issued.
const double highCoverageThreshold
A prefetch coverage factor bigger than this is considered high.
unsigned usefulDegree
Current useful degree.
const double lowCoverageThreshold
A prefetch coverage factor smaller than this is considered low.
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 ...
uint64_t numGoodPrefetches
Number of good prefetches.
void calculatePrefetch(const BasePrefetcher::PrefetchInfo &pfi, std::vector< QueuedPrefetcher::AddrPriority > &addresses)
Addr getAddr() const
Obtains the address value of this Prefetcher address.
void calculatePrefetch(const PrefetchInfo &pfi, std::vector< AddrPriority > &addresses) override
uint64_t numRawCacheHits
Number of raw cache hits.
Class containing the information needed by the prefetch to train and generate new prefetch requests...
AccessMapState
Data type representing the state of a cacheline in the access map.
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
AssociativeSet< AccessMapEntry > accessMapTable
Access map table.
AMPMPrefetcher(const AMPMPrefetcherParams *p)
const unsigned limitStride
Limit the stride checking to -limitStride/+limitStride.
bool isPowerOf2(const T &n)
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
virtual const std::string name() const
Tick clockEdge(Cycles cycles=Cycles(0)) const
Determine the tick when a cycle begins, by default the current one, but the argument also enables the...
AccessMapPatternMatching(const AccessMapPatternMatchingParams *p)
Copyright (c) 2018 Metempsy Technology Consulting All rights reserved.
const double highCacheHitThreshold
A cache hit ratio bigger than this is considered high.
void schedule(Event &event, Tick when)
const uint64_t hotZoneSize
Amount of memory covered by a hot zone.
const unsigned blkSize
Cacheline size used by the prefetcher using this object.
const double lowAccuracyThreshold
A prefetch accuracy factor smaller than this is considered low.
uint64_t numRawCacheMisses
Number of raw cache misses.
const Cycles epochCycles
Cycles in an epoch period.
void setEntryState(AccessMapEntry &entry, Addr block, enum AccessMapState state)
Updates the state of a block within an AccessMapEntry, also updates the prefetcher metrics...
AccessMapEntry data type.
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...