summaryrefslogtreecommitdiff
path: root/src/mem/cache/prefetch/signature_path.hh
diff options
context:
space:
mode:
authorDaniel <odanrc@yahoo.com.br>2019-04-11 08:37:56 +0200
committerDaniel Carvalho <odanrc@yahoo.com.br>2019-05-14 07:55:06 +0000
commitc1bd27907d9404ba0803495d8eb5c9ad8513f09f (patch)
treea8447ce260a1a810a53c00eeeea6c42af06f9596 /src/mem/cache/prefetch/signature_path.hh
parent50a533f10134e7bc377dfdb9209b0334fd01cd24 (diff)
downloadgem5-c1bd27907d9404ba0803495d8eb5c9ad8513f09f.tar.xz
mem-cache: Use SatCounter for prefetchers
Many prefetchers re-implement saturating counters with ints. Make them use SatCounters instead. Added missing operators and constructors to SatCounter for that to be possible and their respective tests. Change-Id: I36f10c89c27c9b3d1bf461e9ea546920f6ebb888 Signed-off-by: Daniel <odanrc@yahoo.com.br> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/17995 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Javier Bueno Hedo <javier.bueno@metempsy.com> Maintainer: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'src/mem/cache/prefetch/signature_path.hh')
-rw-r--r--src/mem/cache/prefetch/signature_path.hh25
1 files changed, 10 insertions, 15 deletions
diff --git a/src/mem/cache/prefetch/signature_path.hh b/src/mem/cache/prefetch/signature_path.hh
index 974c02746..3bf4dd293 100644
--- a/src/mem/cache/prefetch/signature_path.hh
+++ b/src/mem/cache/prefetch/signature_path.hh
@@ -42,6 +42,7 @@
#ifndef __MEM_CACHE_PREFETCH_SIGNATURE_PATH_HH__
#define __MEM_CACHE_PREFETCH_SIGNATURE_PATH_HH__
+#include "base/sat_counter.hh"
#include "mem/cache/prefetch/associative_set.hh"
#include "mem/cache/prefetch/queued.hh"
#include "mem/packet.hh"
@@ -62,8 +63,6 @@ class SignaturePathPrefetcher : public QueuedPrefetcher
const uint8_t signatureShift;
/** Size of the signature, in bits */
const signature_t signatureBits;
- /** Maximum pattern entries counter value */
- const uint8_t maxCounterValue;
/** Minimum confidence to issue a prefetch */
const double prefetchConfidenceThreshold;
/** Minimum confidence to keep navigating lookahead entries */
@@ -87,9 +86,9 @@ class SignaturePathPrefetcher : public QueuedPrefetcher
{
/** stride in a page in blkSize increments */
stride_t stride;
- /** counter value (max value defined by maxCounterValue) */
- uint8_t counter;
- PatternStrideEntry() : stride(0), counter(0)
+ /** Saturating counter */
+ SatCounter counter;
+ PatternStrideEntry(unsigned bits) : stride(0), counter(bits)
{}
};
/** Pattern entry data type, a set of stride and counter entries */
@@ -98,19 +97,19 @@ class SignaturePathPrefetcher : public QueuedPrefetcher
/** group of stides */
std::vector<PatternStrideEntry> strideEntries;
/** use counter, used by SPPv2 */
- uint8_t counter;
- PatternEntry(size_t num_strides) : strideEntries(num_strides),
- counter(0)
+ SatCounter counter;
+ PatternEntry(size_t num_strides, unsigned counter_bits)
+ : strideEntries(num_strides, counter_bits), counter(counter_bits)
{}
/** Reset the entries to their initial values */
void reset() override
{
for (auto &entry : strideEntries) {
- entry.counter = 0;
+ entry.counter.reset();
entry.stride = 0;
}
- counter = 0;
+ counter.reset();
}
/**
@@ -135,13 +134,9 @@ class SignaturePathPrefetcher : public QueuedPrefetcher
* Gets the entry with the provided stride, if there is no entry with
* the associated stride, it replaces one of them.
* @param stride the stride to find
- * @param max_counter_value maximum value of the confidence counters,
- * it is used when no strides are found and an entry needs to be
- * replaced
* @result reference to the selected entry
*/
- PatternStrideEntry &getStrideEntry(stride_t stride,
- uint8_t max_counter_value);
+ PatternStrideEntry &getStrideEntry(stride_t stride);
};
/** Pattern table */
AssociativeSet<PatternEntry> patternTable;