35 #include "debug/HWPrefetch.hh" 37 #include "params/PIFPrefetcher.hh" 41 precSize(p->prec_spatial_region_bits),
42 succSize(p->succ_spatial_region_bits),
43 maxCompactorEntries(p->compactor_entries),
44 maxStreamAddressBufferEntries(p->stream_address_buffer_entries),
45 historyBuffer(p->history_buffer_size),
47 index(p->index_assoc, p->index_entries, p->index_indexing_policy,
48 p->index_replacement_policy),
49 streamAddressBuffer(), listenersPC()
54 unsigned int prec_size,
unsigned int succ_size)
57 prec.resize(prec_size,
false);
58 succ.resize(succ_size,
false);
63 unsigned int log_blk_size)
const 65 const Addr target_blk = target >> log_blk_size;
68 return target_blk > trigger_blk ?
69 target_blk - trigger_blk : trigger_blk - target_blk;
74 unsigned int log_blk_size,
bool update)
76 Addr blk_distance = distanceFromTrigger(pc, log_blk_size);
79 (succ.size() >= blk_distance) : (prec.size() >= blk_distance);
82 succ[blk_distance - 1] =
true;
84 prec[blk_distance - 1] =
true;
92 unsigned int log_blk_size)
const 94 Addr blk_distance = distanceFromTrigger(target, log_blk_size);
97 hit = blk_distance <= succ.size() && succ[blk_distance - 1];
99 hit = blk_distance <= prec.size() && succ[blk_distance - 1];
116 for (
int i = prec.size()-1;
i >= 0;
i--) {
119 const Addr prec_addr = (trigger_blk - (i+1)) << log_blk_size;
123 for (
int i = 0;
i < succ.size();
i++) {
126 const Addr succ_addr = (trigger_blk + (i+1)) << log_blk_size;
147 bool is_in_temporal_compactor =
false;
153 if (it->inSameSpatialRegion(pc,
lBlkSize,
false)) {
156 is_in_temporal_compactor =
true;
170 if (!is_in_temporal_compactor) {
177 if (idx_entry !=
nullptr) {
178 index.accessEntry(idx_entry);
181 assert(idx_entry !=
nullptr);
208 if (sabEntry->hasAddress(addr,
lBlkSize)) {
216 sabEntry->getPredictedAddresses(
lBlkSize, addresses);
226 if (idx_entry !=
nullptr) {
227 index.accessEntry(idx_entry);
235 streamAddressBuffer.pop_front();
237 streamAddressBuffer.push_back(entry);
246 parent.notifyRetiredInst(pc);
257 PIFPrefetcherParams::create()
PIFPrefetcher(const PIFPrefetcherParams *p)
Copyright (c) 2019 Metempsy Technology Consulting All rights reserved.
void addEventProbeRetiredInsts(SimObject *obj, const char *name)
Add a SimObject and a probe name to monitor the retired instructions.
bool inSameSpatialRegion(Addr addr, unsigned int log_blk_size, bool update)
Checks if a given address is in the same defined spatial region as the compactor entry.
std::deque< CompactorEntry > temporalCompactor
Probe Listener to handle probe events from the CPU.
const unsigned int maxStreamAddressBufferEntries
Max number of entries to be used in the Stream Address Buffer.
Addr distanceFromTrigger(Addr addr, unsigned int log_blk_size) const
Computes the distance, in cache blocks, from an address to the trigger of the entry.
ProbeManager is a conduit class that lives on each SimObject, and is used to match up probe listeners...
const unsigned int maxCompactorEntries
Number of entries used for the temporal compactor.
unsigned lBlkSize
log_2(block size of the parent cache).
std::deque< CompactorEntry * > streamAddressBuffer
A Stream Address Buffer (SAB) tracks a window of consecutive spatial regions.
unsigned int historyIndex
void notify(const Addr &pc) override
Addr getAddr() const
Obtains the address value of this Prefetcher address.
std::vector< PrefetchListenerPC * > listenersPC
Array of probe listeners.
Class containing the information needed by the prefetch to train and generate new prefetch requests...
std::pair< Addr, int32_t > AddrPriority
const unsigned int succSize
void notifyRetiredInst(const Addr pc)
Updates the prefetcher structures upon an instruction retired.
The compactor tracks retired instructions addresses, leveraging the spatial and temporal locality amo...
unsigned int historyBufferTail
std::vector< CompactorEntry > historyBuffer
History buffer is a circular buffer that stores the sequence of retired instructions in FIFO order...
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
virtual const std::string name() const
CompactorEntry spatialCompactor
void calculatePrefetch(const PrefetchInfo &pfi, std::vector< AddrPriority > &addresses)
const unsigned int precSize
Number of preceding and subsequent spatial addresses to compact.
ProbeManager * getProbeManager()
Get the probe manager for this object.
AssociativeSet< IndexEntry > index
The index table is a small cache-like structure that facilitates fast search of the history buffer...
bool hasAddress(Addr target, unsigned int log_blk_size) const
Checks if the provided address is contained in this spatial region and if its corresponding bit vecto...
void update() const
Align cycle and tick to the next clock edge if not already done.
Abstract superclass for simulation objects.
void getPredictedAddresses(unsigned int log_blk_size, std::vector< AddrPriority > &addresses) const
Fills the provided vector with the predicted addresses using the recorded bit vectors of the entry...