summaryrefslogtreecommitdiff
path: root/src/mem/cache/prefetch/stride.cc
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
commit771c864bf407b57bf91896f38e989e8a36cd9cd1 (patch)
treecc0f63f933915a9e58ec2420535c67667af5a180 /src/mem/cache/prefetch/stride.cc
parent95735e10e7ea85320ee39c15a4132eece8417af4 (diff)
downloadgem5-771c864bf407b57bf91896f38e989e8a36cd9cd1.tar.xz
mem: Allowed tagged instruction prefetching in stride prefetcher
For systems with a tightly coupled L2, a stride-based prefetcher may observe access requests from both instruction and data L1 caches. However, the PC address of an instruction miss gives no relevant training information to the stride based prefetcher(there is no stride to train). In theses cases, its better if the L2 stride prefetcher simply reverted back to a simple N-block ahead prefetcher. This patch enables this option. Committed by: Nilay Vaish <nilay@cs.wisc.edu>
Diffstat (limited to 'src/mem/cache/prefetch/stride.cc')
-rw-r--r--src/mem/cache/prefetch/stride.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mem/cache/prefetch/stride.cc b/src/mem/cache/prefetch/stride.cc
index a7abf4809..c4cf2023a 100644
--- a/src/mem/cache/prefetch/stride.cc
+++ b/src/mem/cache/prefetch/stride.cc
@@ -66,6 +66,23 @@ StridePrefetcher::calculatePrefetch(PacketPtr &pkt, std::list<Addr> &addresses,
assert(master_id < Max_Contexts);
std::list<StrideEntry*> &tab = table[master_id];
+ // Revert to simple N-block ahead prefetch for instruction fetches
+ if (instTagged && pkt->req->isInstFetch()) {
+ for (int d = 1; d <= degree; d++) {
+ Addr new_addr = data_addr + d * blkSize;
+ if (pageStop && !samePage(data_addr, new_addr)) {
+ // Spanned the page, so now stop
+ pfSpanPage += degree - d + 1;
+ return;
+ }
+ DPRINTF(HWPrefetch, "queuing prefetch to %x @ %d\n",
+ new_addr, latency);
+ addresses.push_back(new_addr);
+ delays.push_back(latency);
+ }
+ return;
+ }
+
/* Scan Table for instAddr Match */
std::list<StrideEntry*>::iterator iter;
for (iter = tab.begin(); iter != tab.end(); iter++) {