33 #include "debug/HWPrefetch.hh" 35 #include "params/DCPTPrefetcher.hh" 36 #include "params/DeltaCorrelatingPredictionTables.hh" 39 DeltaCorrelatingPredictionTablesParams *
p) :
SimObject(p),
40 deltaBits(p->delta_bits), deltaMaskBits(p->delta_mask_bits),
41 table(p->table_assoc, p->table_entries, p->table_indexing_policy,
42 p->table_replacement_policy,
DCPTEntry(p->deltas_per_entry))
51 for (
auto &delta : deltas) {
60 unsigned int delta_bits)
62 if ((address - lastAddress) != 0) {
63 Addr delta = address - lastAddress;
65 Addr max_positive_delta = (1 << (delta_bits-1)) - 1;
66 if (address > lastAddress) {
68 if (delta > max_positive_delta) {
73 if (lastAddress - address > (max_positive_delta + 1)) {
77 deltas[deltaPointer] = delta;
78 deltaPointer = (deltaPointer + 1) % deltas.size();
79 lastAddress = address;
88 unsigned int last = (deltaPointer - 1) % deltas.size();
90 unsigned int last_prev = (deltaPointer - 2) % deltas.size();
91 int delta_0 = deltas[last_prev];
92 int delta_1 = deltas[last];
95 if (delta_0 == 0 || delta_1 == 0) {
105 int idx_0 = deltaPointer + 1;
107 int idx_1 = deltaPointer + 2;
108 for (
int i = 0;
i < deltas.size() - 2;
i += 1) {
109 int this_delta_0 = deltas[(idx_0 +
i) % deltas.size()];
110 int this_delta_1 = deltas[(idx_1 +
i) % deltas.size()];
111 if ((this_delta_0 >> mask) == (delta_0 >> mask) &&
112 (this_delta_1 >> mask) == (delta_1 >> mask)) {
118 int pf_delta = deltas[(idx_0 +
i) % deltas.size()];
122 }
while (
i < deltas.size() - 2);
133 DPRINTF(HWPrefetch,
"Ignoring request with no PC.\n");
141 if (entry !=
nullptr) {
146 entry =
table.findVictim(pc);
148 table.insertEntry(pc,
false , entry);
155 DeltaCorrelatingPredictionTablesParams::create()
173 DCPTPrefetcherParams::create()
void invalidate() override
Invalidates the entry.
void calculatePrefetch(const BasePrefetcher::PrefetchInfo &pfi, std::vector< QueuedPrefetcher::AddrPriority > &addresses)
Computes the prefetch candidates given a prefetch event.
void getCandidates(std::vector< QueuedPrefetcher::AddrPriority > &pfs, unsigned int mask_bits) const
Attempt to generate prefetch candidates using the two most recent deltas.
Addr getAddr() const
Obtains the address value of this Prefetcher address.
Class containing the information needed by the prefetch to train and generate new prefetch requests...
Delta Correlating Prediction Tables Prefetcher References: Multi-level hardware prefetching using low...
const unsigned int deltaBits
Number of bits of each delta.
DCPT Table entry datatype.
Addr getPC() const
Returns the program counter that generated this request.
The prefetcher object using the DCPT.
DeltaCorrelatingPredictionTables(DeltaCorrelatingPredictionTablesParams *p)
Copyright (c) 2018 Metempsy Technology Consulting All rights reserved.
void addAddress(Addr address, unsigned int delta_num_bits)
Adds an address to the entry, if the entry already existed, a delta will be generated.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Addr lastAddress
Last accessed address.
DCPTPrefetcher(const DCPTPrefetcherParams *p)
void calculatePrefetch(const PrefetchInfo &pfi, std::vector< AddrPriority > &addresses) override
DeltaCorrelatingPredictionTables & dcpt
DCPT object.
virtual void invalidate()
Invalidates the entry.
Abstract superclass for simulation objects.
AssociativeSet< DCPTEntry > table
The main table.
const unsigned int deltaMaskBits
Number of lower bits to ignore from the deltas.
bool hasPC() const
Returns true if the associated program counter is valid.