Daniel Carvalho has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/28487 )
Change subject: mem-cache: Fixes to PIF prefetcher
......................................................................
mem-cache: Fixes to PIF prefetcher
The temporal compactor was never initialized.
A block distance of zero would seg fault.
From the original paper, "The prediction mechanism searches for
the PC of the accessed instruction in the index table"
Change-Id: I3c3aceac3c0adbbe8aef5c634c88cb35ba7487be
Signed-off-by: Daniel R. Carvalho <oda...@yahoo.com.br>
---
M src/mem/cache/prefetch/pif.cc
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/src/mem/cache/prefetch/pif.cc b/src/mem/cache/prefetch/pif.cc
index 6a2983b..42b3cca 100644
--- a/src/mem/cache/prefetch/pif.cc
+++ b/src/mem/cache/prefetch/pif.cc
@@ -78,9 +78,9 @@
(succ.size() >= blk_distance) : (prec.size() >= blk_distance);
if (hit && update) {
if (pc > trigger) {
- succ[blk_distance - 1] = true;
+ succ[(blk_distance - 1) % succ.size()] = true;
} else if (pc < trigger) {
- prec[blk_distance - 1] = true;
+ prec[(blk_distance - 1) % prec.size()] = true;
}
}
return hit;
@@ -93,9 +93,11 @@
Addr blk_distance = distanceFromTrigger(target, log_blk_size);
bool hit = false;
if (target > trigger) {
- hit = blk_distance <= succ.size() && succ[blk_distance - 1];
+ hit = blk_distance <= succ.size() &&
+ succ[(blk_distance - 1) % succ.size()];
} else if (target < trigger) {
- hit = blk_distance <= prec.size() && succ[blk_distance - 1];
+ hit = blk_distance <= prec.size() &&
+ succ[(blk_distance - 1) % prec.size()];
} else {
hit = true;
}
@@ -134,6 +136,7 @@
// First access to the prefetcher
if (temporalCompactor.size() == 0) {
spatialCompactor = CompactorEntry(pc, precSize, succSize);
+ temporalCompactor.push_back(spatialCompactor);
} else {
// If the PC of the instruction retired is in the same spatial
region
// than the last trigger address, update the bit vectors based on
the
@@ -195,12 +198,16 @@
PIF::calculatePrefetch(const PrefetchInfo &pfi,
std::vector<AddrPriority> &addresses)
{
- const Addr addr = pfi.getAddr();
+ if (!pfi.hasPC()) {
+ return;
+ }
+
+ const Addr pc = pfi.getPC();
// First check if the access has been prefetched, this is done by
// comparing the access against the active Stream Address Buffers
for (auto &sabEntry : streamAddressBuffer) {
- if (sabEntry->hasAddress(addr, lBlkSize)) {
+ if (sabEntry->hasAddress(pc, lBlkSize)) {
sabEntry++;
sabEntry->getPredictedAddresses(lBlkSize, addresses);
// We are done
@@ -210,7 +217,7 @@
// Check if a valid entry in the 'index' table is found and allocate a
new
// active prediction stream
- IndexEntry *idx_entry = index.findEntry(addr, /* unused */ false);
+ IndexEntry *idx_entry = index.findEntry(pc, /* unused */ false);
if (idx_entry != nullptr) {
index.accessEntry(idx_entry);
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/28487
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I3c3aceac3c0adbbe8aef5c634c88cb35ba7487be
Gerrit-Change-Number: 28487
Gerrit-PatchSet: 1
Gerrit-Owner: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s