mem: Add additional tolerance to stride prefetcher
Forces the prefetcher to mispredict twice in a row before resetting the confidence of prefetching. This helps cases where a load PC strides by a constant factor, however it may operate on different arrays at times. Avoids the cost of retraining. Primarily helps with small iteration loops. Committed by: Nilay Vaish <nilay@cs.wisc.edu>
This commit is contained in:
parent
771c864bf4
commit
96317d466e
2 changed files with 11 additions and 4 deletions
8
src/mem/cache/prefetch/stride.cc
vendored
8
src/mem/cache/prefetch/stride.cc
vendored
|
@ -98,12 +98,17 @@ StridePrefetcher::calculatePrefetch(PacketPtr &pkt, std::list<Addr> &addresses,
|
|||
bool stride_match = (new_stride == (*iter)->stride);
|
||||
|
||||
if (stride_match && new_stride != 0) {
|
||||
(*iter)->tolerance = true;
|
||||
if ((*iter)->confidence < Max_Conf)
|
||||
(*iter)->confidence++;
|
||||
} else {
|
||||
if (!((*iter)->tolerance)) {
|
||||
(*iter)->stride = new_stride;
|
||||
if ((*iter)->confidence > Min_Conf)
|
||||
(*iter)->confidence = 0;
|
||||
} else {
|
||||
(*iter)->tolerance = false;
|
||||
}
|
||||
}
|
||||
|
||||
DPRINTF(HWPrefetch, "hit: PC %x data_addr %x (%s) stride %d (%s), "
|
||||
|
@ -118,7 +123,7 @@ StridePrefetcher::calculatePrefetch(PacketPtr &pkt, std::list<Addr> &addresses,
|
|||
return;
|
||||
|
||||
for (int d = 1; d <= degree; d++) {
|
||||
Addr new_addr = data_addr + d * new_stride;
|
||||
Addr new_addr = data_addr + d * (*iter)->stride;
|
||||
if (pageStop && !samePage(data_addr, new_addr)) {
|
||||
// Spanned the page, so now stop
|
||||
pfSpanPage += degree - d + 1;
|
||||
|
@ -160,6 +165,7 @@ StridePrefetcher::calculatePrefetch(PacketPtr &pkt, std::list<Addr> &addresses,
|
|||
new_entry->isSecure = is_secure;
|
||||
new_entry->stride = 0;
|
||||
new_entry->confidence = 0;
|
||||
new_entry->tolerance = false;
|
||||
tab.push_back(new_entry);
|
||||
}
|
||||
}
|
||||
|
|
1
src/mem/cache/prefetch/stride.hh
vendored
1
src/mem/cache/prefetch/stride.hh
vendored
|
@ -72,6 +72,7 @@ class StridePrefetcher : public BasePrefetcher
|
|||
bool isSecure;
|
||||
int stride;
|
||||
int confidence;
|
||||
bool tolerance;
|
||||
};
|
||||
|
||||
std::list<StrideEntry*> table[Max_Contexts];
|
||||
|
|
Loading…
Reference in a new issue