summaryrefslogtreecommitdiff
path: root/src/mem/cache
diff options
context:
space:
mode:
authorMitch Hayenga <mitch.hayenga+gem5@gmail.com>2014-01-29 23:21:26 -0600
committerMitch Hayenga <mitch.hayenga+gem5@gmail.com>2014-01-29 23:21:26 -0600
commit96317d466ea26955ce26f658f162755b39d3352e (patch)
tree2ac30c0120148197f833244b090de6f044f7d43c /src/mem/cache
parent771c864bf407b57bf91896f38e989e8a36cd9cd1 (diff)
downloadgem5-96317d466ea26955ce26f658f162755b39d3352e.tar.xz
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>
Diffstat (limited to 'src/mem/cache')
-rw-r--r--src/mem/cache/prefetch/stride.cc14
-rw-r--r--src/mem/cache/prefetch/stride.hh1
2 files changed, 11 insertions, 4 deletions
diff --git a/src/mem/cache/prefetch/stride.cc b/src/mem/cache/prefetch/stride.cc
index c4cf2023a..d4a31f9da 100644
--- a/src/mem/cache/prefetch/stride.cc
+++ b/src/mem/cache/prefetch/stride.cc
@@ -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 {
- (*iter)->stride = new_stride;
- if ((*iter)->confidence > Min_Conf)
- (*iter)->confidence = 0;
+ 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);
}
}
diff --git a/src/mem/cache/prefetch/stride.hh b/src/mem/cache/prefetch/stride.hh
index 0e31984f9..a491eb687 100644
--- a/src/mem/cache/prefetch/stride.hh
+++ b/src/mem/cache/prefetch/stride.hh
@@ -72,6 +72,7 @@ class StridePrefetcher : public BasePrefetcher
bool isSecure;
int stride;
int confidence;
+ bool tolerance;
};
std::list<StrideEntry*> table[Max_Contexts];