Hello Giacomo Travaglini, Andreas Sandberg,
I'd like you to do a code review. Please visit
https://gem5-review.googlesource.com/c/public/gem5/+/14819
to review the following change.
Change subject: mem-cache: Updated version of the Signature Path Preftcher
..
mem-cache: Updated version of the Signature Path Preftcher
This implementation is based in the description available in:
Jinchun Kim, Seth H. Pugsley, Paul V. Gratz, A. L. Narasimha Reddy,
Chris Wilkerson, and Zeshan Chishti. 2016.
Path confidence based lookahead prefetching.
In The 49th Annual IEEE/ACM International Symposium on Microarchitecture
(MICRO-49). IEEE Press, Piscataway, NJ, USA, Article 60, 12 pages.
Change-Id: I4b8b54efef48ced7044bd535de9a69bca68d47d9
---
M src/mem/cache/prefetch/Prefetcher.py
M src/mem/cache/prefetch/SConscript
M src/mem/cache/prefetch/signaturepath.cc
M src/mem/cache/prefetch/signaturepath.hh
A src/mem/cache/prefetch/signaturepathv2.cc
A src/mem/cache/prefetch/signaturepathv2.hh
6 files changed, 523 insertions(+), 72 deletions(-)
diff --git a/src/mem/cache/prefetch/Prefetcher.py
b/src/mem/cache/prefetch/Prefetcher.py
index a4ae3e3..b3ac840 100644
--- a/src/mem/cache/prefetch/Prefetcher.py
+++ b/src/mem/cache/prefetch/Prefetcher.py
@@ -189,3 +189,30 @@
"Minimum confidence to issue prefetches")
lookahead_confidence_threshold = Param.Float(0.75,
"Minimum confidence to continue exploring lookahead entries")
+
+class SignaturePathPrefetcherV2(SignaturePathPrefetcher):
+type = 'SignaturePathPrefetcherV2'
+cxx_class = 'SignaturePathPrefetcherV2'
+cxx_header = "mem/cache/prefetch/signaturepathv2.hh"
+
+signature_table_entries = "256"
+signature_table_assoc = 1
+pattern_table_entries = "512"
+pattern_table_assoc = 1
+filter_table_entries = "1024"
+filter_table_assoc = 1
+max_counter_value = 15
+prefetch_confidence_threshold = 0.25
+lookahead_confidence_threshold = 0.25
+
+global_history_register_entries = Param.MemorySize("8",
+"Number of entries of global history register")
+global_history_register_assoc = Param.Unsigned(1,
+"Associativity of the global history register")
+global_history_register_indexing_policy = Param.BaseIndexingPolicy(
+SetAssociative(entry_size = 1,
+assoc = Parent.global_history_register_assoc,
+size = Parent.global_history_register_entries),
+"Indexing policy of the global history register")
+global_history_register_replacement_policy =
Param.BaseReplacementPolicy(
+LRURP(), "Replacement policy of the global history register")
diff --git a/src/mem/cache/prefetch/SConscript
b/src/mem/cache/prefetch/SConscript
index f8a3d83..c033aef 100644
--- a/src/mem/cache/prefetch/SConscript
+++ b/src/mem/cache/prefetch/SConscript
@@ -37,3 +37,4 @@
Source('stride.cc')
Source('tagged.cc')
Source('signaturepath.cc')
+Source('signaturepathv2.cc')
diff --git a/src/mem/cache/prefetch/signaturepath.cc
b/src/mem/cache/prefetch/signaturepath.cc
index 07e0e18..2d00b63 100644
--- a/src/mem/cache/prefetch/signaturepath.cc
+++ b/src/mem/cache/prefetch/signaturepath.cc
@@ -69,26 +69,36 @@
assert(isPowerOf2(filterTableAssoc));
}
-void
-SignaturePathPrefetcher::updateFilter(FilterEntry _entry, Addr ppn,
- bool is_secure)
+SignaturePathPrefetcher::FilterEntry *
+SignaturePathPrefetcher::updateFilter(Addr addr, bool is_secure)
{
-// Check on positions set if the block has been evicted from the cache
-// cache evictions are supposed to reset entries that were set to 1
-for (Addr block_id = 0; block_id < (pageBytes/blkSize); block_id += 1)
{
-if (filter_entry.bitmap[block_id]) {
-filter_entry.bitmap[block_id] =
-inCache(ppn + block_id * blkSize, is_secure);
+Addr ppn = addr / pageBytes;
+Addr hashed_ppn = ppnHash(ppn);
+FilterEntry* filter_entry = filterTable.findEntry(hashed_ppn,
is_secure);
+if (filter_entry != nullptr) {
+// Check on positions set if the block has been evicted from the
cache
+// cache evictions are supposed to reset entries that were set to 1
+for (Addr block_id = 0;
+ block_id < (pageBytes/blkSize);
+ block_id += 1)
+{
+if (filter_entry->bitmap[block_id]) {
+filter_entry->bitmap[block_id] =
+inCache(ppn + block_id * blkSize, is_secure);
+}
}
}
+return filter_entry;
}
SignaturePathPrefetcher::FilterEntry *
SignaturePathPrefetcher::filterAndAddPrefetch(FilterEntry
*orig_filter_entry,
-Addr ppn, stride_t block, bool is_secure,
+Addr ppn, stride_t last_block, stride_t delta, double path_confidence,
+signature_t current_signature, bool is_secure,
std::vector )
{
FilterEntry *filter_entry =