55 #include "debug/HWPrefetch.hh"
58 #include "params/StridePrefetcher.hh"
88 pcTableInfo(
p.table_assoc,
p.table_entries,
p.table_indexing_policy,
89 p.table_replacement_policy)
109 auto insertion_result =
pcTables.insert(std::make_pair(context,
114 DPRINTF(HWPrefetch,
"Adding context %i with stride entries\n", context);
117 return &(insertion_result.first->second);
125 DPRINTF(HWPrefetch,
"Ignoring request with no PC.\n");
141 if (entry !=
nullptr) {
145 int new_stride = pf_addr - entry->
lastAddr;
146 bool stride_match = (new_stride == entry->
stride);
149 if (stride_match && new_stride != 0) {
155 entry->
stride = new_stride;
159 DPRINTF(HWPrefetch,
"Hit: PC %x pkt_addr %x (%s) stride %d (%s), "
160 "conf %d\n",
pc, pf_addr, is_secure ?
"s" :
"ns",
161 new_stride, stride_match ?
"match" :
"change",
174 int prefetch_stride = new_stride;
175 if (abs(new_stride) <
blkSize) {
179 Addr new_addr = pf_addr +
d * prefetch_stride;
184 DPRINTF(HWPrefetch,
"Miss: PC %x pkt_addr %x (%s)\n",
pc, pf_addr,
185 is_secure ?
"s" :
"ns");
198 const Addr hash1 =
pc >> 1;
200 return (hash1 ^ hash2) &
setMask;
Associative container based on the previosuly defined Entry type Each element is indexed by a key of ...
void insertEntry(Addr addr, bool is_secure, Entry *entry)
Indicate that an entry has just been inserted.
Entry * findVictim(Addr addr)
Find a victim to be replaced.
void accessEntry(Entry *entry)
Do an access to the entry, this is required to update the replacement information data.
Entry * findEntry(Addr addr, bool is_secure) const
Find an entry within the set.
const unsigned setMask
Mask out all bits that aren't part of the set index.
const int tagShift
The amount to shift the address to get the tag.
A tagged entry is an entry containing a tag.
virtual void invalidate()
Invalidate the block.
Class containing the information needed by the prefetch to train and generate new prefetch requests.
Addr getPC() const
Returns the program counter that generated this request.
bool isSecure() const
Returns true if the address targets the secure memory space.
Addr getAddr() const
Obtains the address value of this Prefetcher address.
bool hasPC() const
Returns true if the associated program counter is valid.
RequestorID getRequestorId() const
Gets the requestor ID that generated this address.
unsigned blkSize
The block size of the parent cache.
std::pair< Addr, int32_t > AddrPriority
Addr extractTag(const Addr addr) const override
Generate the tag from the given address.
uint32_t extractSet(const Addr addr) const override
Apply a hash function to calculate address set.
AssociativeSet< StrideEntry > PCTable
const SatCounter8 initConfidence
Initial confidence counter value for the pc tables.
const double threshConf
Confidence threshold for prefetch generation.
PCTable * allocateNewContext(int context)
Create a PC table for the given context.
void calculatePrefetch(const PrefetchInfo &pfi, std::vector< AddrPriority > &addresses) override
Stride(const StridePrefetcherParams &p)
std::unordered_map< int, PCTable > pcTables
const bool useRequestorId
const struct gem5::prefetch::Stride::PCTableInfo pcTableInfo
PCTable * findTable(int context)
Try to find a table of entries for the given context.
double calcSaturation() const
Calculate saturation percentile of the current counter's value with regard to its maximum possible va...
Bitfield< 21, 20 > stride
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi)
Describes a strided prefetcher.
replacement_policy::Base *const replacementPolicy
BaseIndexingPolicy *const indexingPolicy
StrideEntry(const SatCounter8 &init_confidence)
void invalidate() override
Invalidate the block.