global_history_register_replacement_policy = Param.BaseReplacementPolicy(
LRURP(), "Replacement policy of the global history register")
-class AccessMapPatternMatchingPrefetcher(QueuedPrefetcher):
- type = 'AccessMapPatternMatchingPrefetcher'
- cxx_class = 'AccessMapPatternMatchingPrefetcher'
+class AccessMapPatternMatching(ClockedObject):
+ type = 'AccessMapPatternMatching'
+ cxx_class = 'AccessMapPatternMatching'
cxx_header = "mem/cache/prefetch/access_map_pattern_matching.hh"
+ block_size = Param.Unsigned(Parent.block_size,
+ "Cacheline size used by the prefetcher using this object")
+
+ limit_stride = Param.Unsigned(0,
+ "Limit the strides checked up to -X/X, if 0, disable the limit")
start_degree = Param.Unsigned(4,
"Initial degree (Maximum number of prefetches generated")
hot_zone_size = Param.MemorySize("2kB", "Memory covered by a hot zone")
offchip_memory_latency = Param.Latency("30ns",
"Memory latency used to compute the required memory bandwidth")
+class AMPMPrefetcher(QueuedPrefetcher):
+ type = 'AMPMPrefetcher'
+ cxx_class = 'AMPMPrefetcher'
+ cxx_header = "mem/cache/prefetch/access_map_pattern_matching.hh"
+ ampm = Param.AccessMapPatternMatching( AccessMapPatternMatching(),
+ "Access Map Pattern Matching object")
+
class DeltaCorrelatingPredictionTables(SimObject):
type = 'DeltaCorrelatingPredictionTables'
cxx_class = 'DeltaCorrelatingPredictionTables'
sp_address_map_cache_replacement_policy = Param.BaseReplacementPolicy(
LRURP(),
"Replacement policy of the Structural-to-Physical Address Map Cache")
+
+class SlimAccessMapPatternMatching(AccessMapPatternMatching):
+ start_degree = 2
+ limit_stride = 4
+
+class SlimDeltaCorrelatingPredictionTables(DeltaCorrelatingPredictionTables):
+ table_entries = "256"
+ table_assoc = 256
+ deltas_per_entry = 9
+
+class SlimAMPMPrefetcher(QueuedPrefetcher):
+ type = 'SlimAMPMPrefetcher'
+ cxx_class = 'SlimAMPMPrefetcher'
+ cxx_header = "mem/cache/prefetch/slim_ampm.hh"
+
+ ampm = Param.AccessMapPatternMatching(SlimAccessMapPatternMatching(),
+ "Access Map Pattern Matching object")
+ dcpt = Param.DeltaCorrelatingPredictionTables(
+ SlimDeltaCorrelatingPredictionTables(),
+ "Delta Correlating Prediction Tables object")
Source('queued.cc')
Source('signature_path.cc')
Source('signature_path_v2.cc')
+Source('slim_ampm.cc')
Source('stride.cc')
Source('tagged.cc')
#include "debug/HWPrefetch.hh"
#include "mem/cache/prefetch/associative_set_impl.hh"
-#include "params/AccessMapPatternMatchingPrefetcher.hh"
+#include "params/AMPMPrefetcher.hh"
+#include "params/AccessMapPatternMatching.hh"
-AccessMapPatternMatchingPrefetcher::AccessMapPatternMatchingPrefetcher(
- const AccessMapPatternMatchingPrefetcherParams *p)
- : QueuedPrefetcher(p),
+AccessMapPatternMatching::AccessMapPatternMatching(
+ const AccessMapPatternMatchingParams *p)
+ : ClockedObject(p), blkSize(p->block_size), limitStride(p->limit_stride),
startDegree(p->start_degree), hotZoneSize(p->hot_zone_size),
highCoverageThreshold(p->high_coverage_threshold),
lowCoverageThreshold(p->low_coverage_threshold),
}
void
-AccessMapPatternMatchingPrefetcher::processEpochEvent()
+AccessMapPatternMatching::processEpochEvent()
{
schedule(epochEvent, clockEdge(epochCycles));
double prefetch_accuracy =
numRawCacheHits = 0.0;
}
-AccessMapPatternMatchingPrefetcher::AccessMapEntry *
-AccessMapPatternMatchingPrefetcher::getAccessMapEntry(Addr am_addr,
+AccessMapPatternMatching::AccessMapEntry *
+AccessMapPatternMatching::getAccessMapEntry(Addr am_addr,
bool is_secure)
{
AccessMapEntry *am_entry = accessMapTable.findEntry(am_addr, is_secure);
}
void
-AccessMapPatternMatchingPrefetcher::setEntryState(AccessMapEntry &entry,
+AccessMapPatternMatching::setEntryState(AccessMapEntry &entry,
Addr block, enum AccessMapState state)
{
enum AccessMapState old = entry.states[block];
}
void
-AccessMapPatternMatchingPrefetcher::calculatePrefetch(const PrefetchInfo &pfi,
- std::vector<AddrPriority> &addresses)
+AccessMapPatternMatching::calculatePrefetch(
+ const BasePrefetcher::PrefetchInfo &pfi,
+ std::vector<QueuedPrefetcher::AddrPriority> &addresses)
{
assert(addresses.empty());
bool is_secure = pfi.isSecure();
// index of the current_block in the new vector
Addr states_current_block = current_block + lines_per_zone;
// consider strides 1..lines_per_zone/2
- for (int stride = 1; stride < lines_per_zone/2; stride += 1) {
+ int max_stride = limitStride == 0 ? lines_per_zone / 2 : limitStride + 1;
+ for (int stride = 1; stride < max_stride; stride += 1) {
// Test accessed positive strides
if (checkCandidate(states, states_current_block, stride)) {
// candidate found, current_block - stride
pf_addr = am_addr * hotZoneSize + blk * blkSize;
setEntryState(*am_entry_curr, blk, AM_PREFETCH);
}
- addresses.push_back(AddrPriority(pf_addr, 0));
+ addresses.push_back(QueuedPrefetcher::AddrPriority(pf_addr, 0));
if (addresses.size() == degree) {
break;
}
pf_addr = am_addr * hotZoneSize + blk * blkSize;
setEntryState(*am_entry_curr, blk, AM_PREFETCH);
}
- addresses.push_back(AddrPriority(pf_addr, 0));
+ addresses.push_back(QueuedPrefetcher::AddrPriority(pf_addr, 0));
if (addresses.size() == degree) {
break;
}
}
}
-AccessMapPatternMatchingPrefetcher*
-AccessMapPatternMatchingPrefetcherParams::create()
+AccessMapPatternMatching*
+AccessMapPatternMatchingParams::create()
+{
+ return new AccessMapPatternMatching(this);
+}
+
+AMPMPrefetcher::AMPMPrefetcher(const AMPMPrefetcherParams *p)
+ : QueuedPrefetcher(p), ampm(*p->ampm)
+{
+}
+
+void
+AMPMPrefetcher::calculatePrefetch(const PrefetchInfo &pfi,
+ std::vector<AddrPriority> &addresses)
+{
+ ampm.calculatePrefetch(pfi, addresses);
+}
+
+AMPMPrefetcher*
+AMPMPrefetcherParams::create()
{
- return new AccessMapPatternMatchingPrefetcher(this);
+ return new AMPMPrefetcher(this);
}
#include "mem/cache/prefetch/associative_set.hh"
#include "mem/cache/prefetch/queued.hh"
#include "mem/packet.hh"
+#include "sim/clocked_object.hh"
-struct AccessMapPatternMatchingPrefetcherParams;
+struct AccessMapPatternMatchingParams;
-class AccessMapPatternMatchingPrefetcher : public QueuedPrefetcher
+class AccessMapPatternMatching : public ClockedObject
{
+ /** Cacheline size used by the prefetcher using this object */
+ const unsigned blkSize;
+ /** Limit the stride checking to -limitStride/+limitStride */
+ const unsigned limitStride;
/** Maximum number of prefetch generated */
const unsigned startDegree;
/** Amount of memory covered by a hot zone */
EventFunctionWrapper epochEvent;
public:
- AccessMapPatternMatchingPrefetcher(
- const AccessMapPatternMatchingPrefetcherParams* p);
- ~AccessMapPatternMatchingPrefetcher() {}
+ AccessMapPatternMatching(const AccessMapPatternMatchingParams* p);
+ ~AccessMapPatternMatching()
+ {}
+ void calculatePrefetch(const BasePrefetcher::PrefetchInfo &pfi,
+ std::vector<QueuedPrefetcher::AddrPriority> &addresses);
+};
+
+struct AMPMPrefetcherParams;
+
+class AMPMPrefetcher : public QueuedPrefetcher
+{
+ AccessMapPatternMatching &m;
+ public:
+ AMPMPrefetcher(const AMPMPrefetcherParams* p);
+ ~AMPMPrefetcher()
+ {}
void calculatePrefetch(const PrefetchInfo &pfi,
std::vector<AddrPriority> &addresses) override;
};
--- /dev/null
+/**
+ * Copyright (c) 2018 Metempsy Technology Consulting
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Authors: Javier Bueno
+ */
+
+#include "mem/cache/prefetch/slim_ampm.hh"
+
+#include "params/SlimAMPMPrefetcher.hh"
+
+SlimAMPMPrefetcher::SlimAMPMPrefetcher(const SlimAMPMPrefetcherParams* p)
+ : QueuedPrefetcher(p), ampm(*p->ampm), dcpt(*p->dcpt)
+{
+}
+
+void
+SlimAMPMPrefetcher::calculatePrefetch(const PrefetchInfo &pfi,
+ std::vector<AddrPriority> &addresses)
+{
+ dcpt.calculatePrefetch(pfi, addresses);
+ if (addresses.empty()) {
+ ampm.calculatePrefetch(pfi, addresses);
+ }
+}
+
+SlimAMPMPrefetcher*
+SlimAMPMPrefetcherParams::create()
+{
+ return new SlimAMPMPrefetcher(this);
+}
--- /dev/null
+/**
+ * Copyright (c) 2018 Metempsy Technology Consulting
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Authors: Javier Bueno
+ */
+
+#ifndef __MEM_CACHE_PREFETCH_SLIM_AMPM_HH__
+#define __MEM_CACHE_PREFETCH_SLIM_AMPM_HH__
+
+#include "mem/cache/prefetch/access_map_pattern_matching.hh"
+#include "mem/cache/prefetch/delta_correlating_prediction_tables.hh"
+#include "mem/cache/prefetch/queued.hh"
+
+/**
+ * The SlimAMPM Prefetcher
+ * Reference:
+ * Towards Bandwidth-Efficient Prefetching with Slim AMPM.
+ * Young, Vinson, and A. Krishna.
+ * The 2nd Data Prefetching Championship (2015).
+ *
+ * This prefetcher uses two other prefetchers, the AMPM and the DCPT.
+ */
+
+struct SlimAMPMPrefetcherParams;
+
+class SlimAMPMPrefetcher : public QueuedPrefetcher
+{
+ /** AMPM prefetcher object */
+ AccessMapPatternMatching &m;
+ /** DCPT prefetcher object */
+ DeltaCorrelatingPredictionTables &dcpt;
+ public:
+ SlimAMPMPrefetcher(const SlimAMPMPrefetcherParams *p);
+ ~SlimAMPMPrefetcher()
+ {}
+
+ void calculatePrefetch(const PrefetchInfo &pfi,
+ std::vector<AddrPriority> &addresses) override;
+};
+#endif//__MEM_CACHE_PREFETCH_SLIM_AMPM_HH__