Go to the documentation of this file.
31 #include "debug/HWPrefetch.hh"
33 #include "params/STeMSPrefetcher.hh"
38 :
Queued(
p), spatialRegionSize(
p->spatial_region_size),
39 spatialRegionSizeBits(
floorLog2(
p->spatial_region_size)),
40 reconstructionEntries(
p->reconstruction_entries),
41 activeGenerationTable(
p->active_generation_table_assoc,
42 p->active_generation_table_entries,
43 p->active_generation_table_indexing_policy,
44 p->active_generation_table_replacement_policy,
46 spatialRegionSize / blkSize)),
47 patternSequenceTable(
p->pattern_sequence_table_assoc,
48 p->pattern_sequence_table_entries,
49 p->pattern_sequence_table_indexing_policy,
50 p->pattern_sequence_table_replacement_policy,
52 spatialRegionSize / blkSize)),
53 rmob(
p->region_miss_order_buffer_entries)
56 "The spatial region size must be a power of 2.");
68 if (agt_entry.isValid()) {
69 bool generation_ended =
false;
70 bool sr_is_secure = agt_entry.isSecure();
71 for (
auto &seq_entry : agt_entry.sequence) {
72 if (seq_entry.counter > 0) {
74 agt_entry.paddress + seq_entry.offset *
blkSize;
75 if (!
inCache(cache_addr, sr_is_secure) &&
77 generation_ended =
true;
82 if (generation_ended) {
87 if (pst_entry ==
nullptr) {
90 assert(pst_entry !=
nullptr);
98 pst_entry->
update(agt_entry);
112 rmob_entry.
delta = delta;
114 rmob.push_back(rmob_entry);
122 DPRINTF(HWPrefetch,
"Ignoring request with no PC.\n");
140 if (agt_entry !=
nullptr) {
157 assert(agt_entry !=
nullptr);
165 if (agt_e.isValid() && agt_entry != &agt_e) {
166 agt_e.seqCounter += 1;
173 auto it =
rmob.end();
174 while (it !=
rmob.begin()) {
176 if (it->srAddress == sr_addr) {
191 unsigned int idx = 0;
198 idx += (it+1)->delta + 1;
207 if (pst_entry !=
nullptr) {
209 for (
auto &seq_entry : pst_entry->
sequence) {
210 if (seq_entry.counter > 1) {
215 unsigned ridx = idx + seq_entry.delta;
219 reconstruction[ridx] ==
MaxAddr) {
220 reconstruction[ridx] = rec_addr;
222 reconstruction[ridx + 1] ==
MaxAddr) {
223 reconstruction[ridx + 1] = rec_addr;
225 reconstruction[ridx + 2] ==
MaxAddr) {
226 reconstruction[ridx + 2] = rec_addr;
227 }
else if ((ridx > 0) &&
229 reconstruction[ridx - 1] ==
MaxAddr) {
230 reconstruction[ridx - 1] = rec_addr;
231 }
else if ((ridx > 1) &&
233 reconstruction[ridx - 2] ==
MaxAddr) {
234 reconstruction[ridx - 2] = rec_addr;
239 idx += (it+1)->delta + 1;
242 for (
Addr pf_addr : reconstruction) {
252 STeMSPrefetcherParams::create()
std::pair< Addr, int32_t > AddrPriority
const size_t spatialRegionSize
Size of each spatial region.
unsigned blkSize
The block size of the parent cache.
Addr getPC() const
Returns the program counter that generated this request.
Data type of the Region Miss Order Buffer entry.
Addr pstAddress
Address used to index the PST table, generated using the PC and the offset within the spatial region.
const unsigned int reconstructionEntries
Number of reconstruction entries.
Addr paddress
Physical address of the spatial region.
void addOffset(unsigned int offset)
Add a new access to the sequence.
bool inCache(Addr addr, bool is_secure) const
Determine if address is in cache.
unsigned int delta
Delta within the global miss order sequence.
std::enable_if< std::is_integral< T >::value, int >::type floorLog2(T x)
CircularQueue< RegionMissOrderBufferEntry > rmob
Region Miss Order Buffer (RMOB)
Iterator to the circular queue.
unsigned int lastTriggerCounter
Counter to keep the count of accesses between trigger accesses.
STeMS(const STeMSPrefetcherParams *p)
const size_t spatialRegionSizeBits
log_2 of the spatial region size
void checkForActiveGenerationsEnd()
Checks if the active generations have ended.
Addr getPaddr() const
Gets the physical address of the request.
void addToRMOB(Addr sr_addr, Addr pst_addr, unsigned int delta)
Adds an entry to the RMOB.
bool isCacheMiss() const
Check if this event comes from a cache miss.
Copyright (c) 2018 Metempsy Technology Consulting All rights reserved.
AssociativeSet< ActiveGenerationTableEntry > activeGenerationTable
Active Generation Table (AGT)
std::vector< SequenceEntry > sequence
Sequence of accesses.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Addr pc
PC that started this generation.
bool isSecure() const
Returns true if the address targets the secure memory space.
void update(ActiveGenerationTableEntry const &e)
Update the entry data with an entry from a generation that just ended.
void calculatePrefetch(const PrefetchInfo &pfi, std::vector< AddrPriority > &addresses) override
Class containing the information needed by the prefetch to train and generate new prefetch requests.
AssociativeSet< ActiveGenerationTableEntry > patternSequenceTable
Pattern Sequence Table (PST)
bool inMissQueue(Addr addr, bool is_secure) const
Determine if address is in cache miss queue.
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
Addr getAddr() const
Obtains the address value of this Prefetcher address.
bool isPowerOf2(const T &n)
void reconstructSequence(CircularQueue< RegionMissOrderBufferEntry >::iterator rmob_it, std::vector< AddrPriority > &addresses)
Reconstructs a sequence of accesses and generates the prefetch addresses, adding them to the addresse...
bool hasPC() const
Returns true if the associated program counter is valid.
Addr srAddress
Address of the spatial region.
Entry data type for the Active Generation Table (AGT) and the Pattern Sequence Table (PST)
Generated on Wed Sep 30 2020 14:02:12 for gem5 by doxygen 1.8.17