33 #include "debug/HWPrefetch.hh" 35 #include "params/PIFPrefetcher.hh" 41 precSize(p->prec_spatial_region_bits),
42 succSize(p->succ_spatial_region_bits),
43 maxCompactorEntries(p->compactor_entries),
44 historyBuffer(p->history_buffer_size),
45 index(p->index_assoc, p->index_entries, p->index_indexing_policy,
46 p->index_replacement_policy),
47 streamAddressBuffer(p->stream_address_buffer_entries),
53 unsigned int prec_size,
unsigned int succ_size)
56 prec.resize(prec_size,
false);
57 succ.resize(succ_size,
false);
62 unsigned int log_blk_size)
const 64 const Addr target_blk = target >> log_blk_size;
67 return target_blk > trigger_blk ?
68 target_blk - trigger_blk : trigger_blk - target_blk;
73 unsigned int log_blk_size,
bool update)
75 Addr blk_distance = distanceFromTrigger(pc, log_blk_size);
78 (succ.size() >= blk_distance) : (prec.size() >= blk_distance);
81 succ[blk_distance - 1] =
true;
83 prec[blk_distance - 1] =
true;
91 unsigned int log_blk_size)
const 93 Addr blk_distance = distanceFromTrigger(target, log_blk_size);
96 hit = blk_distance <= succ.size() && succ[blk_distance - 1];
98 hit = blk_distance <= prec.size() && succ[blk_distance - 1];
115 for (
int i = prec.size()-1;
i >= 0;
i--) {
118 const Addr prec_addr = (trigger_blk - (i+1)) << log_blk_size;
122 for (
int i = 0;
i < succ.size();
i++) {
125 const Addr succ_addr = (trigger_blk + (i+1)) << log_blk_size;
146 bool is_in_temporal_compactor =
false;
152 if (it->inSameSpatialRegion(pc,
lBlkSize,
false)) {
155 is_in_temporal_compactor =
true;
169 if (!is_in_temporal_compactor) {
176 if (idx_entry !=
nullptr) {
177 index.accessEntry(idx_entry);
180 assert(idx_entry !=
nullptr);
203 if (sabEntry->hasAddress(addr,
lBlkSize)) {
205 sabEntry->getPredictedAddresses(
lBlkSize, addresses);
215 if (idx_entry !=
nullptr) {
216 index.accessEntry(idx_entry);
222 streamAddressBuffer.push_back(entry);
224 entry->getPredictedAddresses(
lBlkSize, addresses);
231 parent.notifyRetiredInst(pc);
244 PIFPrefetcherParams::create()
Probe Listener to handle probe events from the CPU.
std::pair< Addr, int32_t > AddrPriority
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...
CircularQueue< HistoryBuffer::iterator > streamAddressBuffer
A Stream Address Buffer (SAB) tracks a window of consecutive spatial regions.
void addEventProbeRetiredInsts(SimObject *obj, const char *name)
Add a SimObject and a probe name to monitor the retired instructions.
const unsigned int precSize
Number of preceding and subsequent spatial addresses to compact.
iterator getIterator(size_t idx)
Return an iterator to an index in the vector.
ProbeManager is a conduit class that lives on each SimObject, and is used to match up probe listeners...
Class containing the information needed by the prefetch to train and generate new prefetch requests...
CompactorEntry spatialCompactor
void push_back(typename Base::value_type val)
Pushes an element at the end of the queue.
const unsigned int maxCompactorEntries
Number of entries used for the temporal compactor.
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...
std::vector< PrefetchListenerPC * > listenersPC
Array of probe listeners.
void notify(const Addr &pc) override
const unsigned int succSize
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.
Addr getAddr() const
Obtains the address value of this Prefetcher address.
HistoryBuffer historyBuffer
unsigned lBlkSize
log_2(block size of the parent cache).
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
PIF(const PIFPrefetcherParams *p)
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 * getProbeManager()
Get the probe manager for this object.
void notifyRetiredInst(const Addr pc)
Updates the prefetcher structures upon an instruction retired.
HistoryBuffer::iterator historyIt
virtual const std::string name() const
void calculatePrefetch(const PrefetchInfo &pfi, std::vector< AddrPriority > &addresses)
std::deque< CompactorEntry > temporalCompactor
AssociativeSet< IndexEntry > index
The index table is a small cache-like structure that facilitates fast search of the history buffer...
The compactor tracks retired instructions addresses, leveraging the spatial and temporal locality amo...
Copyright (c) 2018 Metempsy Technology Consulting All rights reserved.
void update() const
Align cycle and tick to the next clock edge if not already done.
Abstract superclass for simulation objects.