diff options
author | Daniel <odanrc@yahoo.com.br> | 2018-11-11 15:52:08 +0100 |
---|---|---|
committer | Daniel Carvalho <odanrc@yahoo.com.br> | 2018-11-15 16:53:27 +0000 |
commit | 153a33be851190acdec443264c3a1f1dfa44592a (patch) | |
tree | 4b041f997640f03ae73086628f17475ce46069d2 /src/mem/cache/prefetch/stride.hh | |
parent | d7a1db5cc44ad9a1bd5742f9fc4ffa5ea2e3b2f4 (diff) | |
download | gem5-153a33be851190acdec443264c3a1f1dfa44592a.tar.xz |
mem-cache: Make StridePrefetcher use Replacement Policies
Previously StridePrefetcher was only able to use random
replacement policy. This change allows all replacement
policies to be applied to the pc table.
Change-Id: I8714e71a6a4c9c31fbca49a07a456dcacd3e402c
Signed-off-by: Daniel <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/14360
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Diffstat (limited to 'src/mem/cache/prefetch/stride.hh')
-rw-r--r-- | src/mem/cache/prefetch/stride.hh | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/mem/cache/prefetch/stride.hh b/src/mem/cache/prefetch/stride.hh index 772c3a511..aa0228705 100644 --- a/src/mem/cache/prefetch/stride.hh +++ b/src/mem/cache/prefetch/stride.hh @@ -1,4 +1,5 @@ /* + * Copyright (c) 2018 Inria * Copyright (c) 2012-2013, 2015 ARM Limited * All rights reserved * @@ -38,6 +39,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * Authors: Ron Dreslinski + * Daniel Carvalho */ /** @@ -54,8 +56,10 @@ #include "base/types.hh" #include "mem/cache/prefetch/queued.hh" +#include "mem/cache/replacement_policies/replaceable_entry.hh" #include "mem/packet.hh" +class BaseReplacementPolicy; struct StridePrefetcherParams; class StridePrefetcher : public QueuedPrefetcher @@ -73,7 +77,10 @@ class StridePrefetcher : public QueuedPrefetcher const int degree; - struct StrideEntry + /** Replacement policy used in the PC tables. */ + BaseReplacementPolicy* replacementPolicy; + + struct StrideEntry : public ReplaceableEntry { /** Default constructor */ StrideEntry(); @@ -97,8 +104,10 @@ class StridePrefetcher : public QueuedPrefetcher * @param assoc Associativity of the table. * @param sets Number of sets in the table. * @param name Name of the prefetcher. + * @param replacementPolicy Replacement policy used by the table. */ - PCTable(int assoc, int sets, const std::string name); + PCTable(int assoc, int sets, const std::string name, + BaseReplacementPolicy* replacementPolicy); /** * Default destructor. @@ -124,12 +133,16 @@ class StridePrefetcher : public QueuedPrefetcher private: const std::string name() {return _name; } - const int pcTableAssoc; const int pcTableSets; const std::string _name; std::vector<std::vector<StrideEntry>> entries; /** + * Replacement policy used by StridePrefetcher. + */ + BaseReplacementPolicy* replacementPolicy; + + /** * PC hashing function to index sets in the table. * * @param pc The PC value. |