31#include "debug/HWPrefetch.hh"
32#include "params/AMPMPrefetcher.hh"
33#include "params/AccessMapPatternMatching.hh"
42 const AccessMapPatternMatchingParams &
p)
44 startDegree(
p.start_degree), hotZoneSize(
p.hot_zone_size),
45 highCoverageThreshold(
p.high_coverage_threshold),
46 lowCoverageThreshold(
p.low_coverage_threshold),
47 highAccuracyThreshold(
p.high_accuracy_threshold),
48 lowAccuracyThreshold(
p.low_accuracy_threshold),
49 highCacheHitThreshold(
p.high_cache_hit_threshold),
50 lowCacheHitThreshold(
p.low_cache_hit_threshold),
51 epochCycles(
p.epoch_cycles),
52 offChipMemoryLatency(
p.offchip_memory_latency),
53 accessMapTable(
"AccessMapTable",
54 p.access_map_table_entries,
55 p.access_map_table_assoc,
56 p.access_map_table_replacement_policy,
57 p.access_map_table_indexing_policy,
60 numGoodPrefetches(0), numTotalPrefetches(0), numRawCacheMisses(0),
61 numRawCacheHits(0), degree(startDegree), usefulDegree(startDegree),
65 "the hot zone size must be a power of 2");
78 double prefetch_accuracy =
80 double prefetch_coverage =
114 if (am_entry !=
nullptr) {
118 assert(am_entry !=
nullptr);
155 panic(
"Impossible path\n");
165 assert(addresses.empty());
179 assert(am_entry_curr != am_entry_prev);
180 assert(am_entry_curr != am_entry_next);
181 assert(am_entry_prev != am_entry_next);
182 assert(am_entry_curr !=
nullptr);
193 for (
unsigned idx = 0; idx < lines_per_zone; idx += 1) {
196 states[idx + lines_per_zone] = am_entry_curr->
states[idx];
197 states[idx + 2 * lines_per_zone] =
208 Addr states_current_block = current_block + lines_per_zone;
216 if (
stride > current_block) {
231 if (addresses.size() ==
degree) {
240 if (current_block +
stride >= lines_per_zone) {
244 Addr blk = (states_current_block +
stride) % lines_per_zone;
255 if (addresses.size() ==
degree) {
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
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...
Tick cyclesToTicks(Cycles c) const
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.
unsigned usefulDegree
Current useful degree.
const Tick offChipMemoryLatency
Off chip memory latency to use for the epoch bandwidth calculation.
EventFunctionWrapper epochEvent
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.
unsigned degree
Current degree.
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.
bool isSecure() const
Returns true if the address targets the secure memory space.
Addr getAddr() const
Obtains the address value of this Prefetcher address.
static constexpr bool isPowerOf2(const T &n)
void schedule(Event &event, Tick when)
#define panic(...)
This implements a cprintf based panic() function.
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
Bitfield< 21, 20 > stride
Copyright (c) 2024 Arm Limited All rights reserved.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
static constexpr auto genTagExtractor(BTBIndexingPolicy *ip)
This helper generates a tag extractor function object which will be typically used by Replaceable ent...
Provides generic cache lookup functions.
AccessMapEntry data type.
std::vector< AccessMapState > states
vector containing the state of the cachelines in this zone
const std::string & name()