signature_path.hh (13624:3d8220c2d41d) signature_path.hh (13963:94555f0223ba)
1/**
2 * Copyright (c) 2018 Metempsy Technology Consulting
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 28 unchanged lines hidden (view full) ---

37 * The 2nd Data Prefetching Championship (DPC2)
38 * The filter feature described in the paper is not implemented, as it
39 * redundant prefetches are dropped by the cache.
40 */
41
42#ifndef __MEM_CACHE_PREFETCH_SIGNATURE_PATH_HH__
43#define __MEM_CACHE_PREFETCH_SIGNATURE_PATH_HH__
44
1/**
2 * Copyright (c) 2018 Metempsy Technology Consulting
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 28 unchanged lines hidden (view full) ---

37 * The 2nd Data Prefetching Championship (DPC2)
38 * The filter feature described in the paper is not implemented, as it
39 * redundant prefetches are dropped by the cache.
40 */
41
42#ifndef __MEM_CACHE_PREFETCH_SIGNATURE_PATH_HH__
43#define __MEM_CACHE_PREFETCH_SIGNATURE_PATH_HH__
44
45#include "base/sat_counter.hh"
45#include "mem/cache/prefetch/associative_set.hh"
46#include "mem/cache/prefetch/queued.hh"
47#include "mem/packet.hh"
48
49struct SignaturePathPrefetcherParams;
50
51class SignaturePathPrefetcher : public QueuedPrefetcher
52{

--- 4 unchanged lines hidden (view full) ---

57 typedef int16_t stride_t;
58
59 /** Number of strides stored in each pattern entry */
60 const unsigned stridesPerPatternEntry;
61 /** Number of bits to shift when generating a new signature */
62 const uint8_t signatureShift;
63 /** Size of the signature, in bits */
64 const signature_t signatureBits;
46#include "mem/cache/prefetch/associative_set.hh"
47#include "mem/cache/prefetch/queued.hh"
48#include "mem/packet.hh"
49
50struct SignaturePathPrefetcherParams;
51
52class SignaturePathPrefetcher : public QueuedPrefetcher
53{

--- 4 unchanged lines hidden (view full) ---

58 typedef int16_t stride_t;
59
60 /** Number of strides stored in each pattern entry */
61 const unsigned stridesPerPatternEntry;
62 /** Number of bits to shift when generating a new signature */
63 const uint8_t signatureShift;
64 /** Size of the signature, in bits */
65 const signature_t signatureBits;
65 /** Maximum pattern entries counter value */
66 const uint8_t maxCounterValue;
67 /** Minimum confidence to issue a prefetch */
68 const double prefetchConfidenceThreshold;
69 /** Minimum confidence to keep navigating lookahead entries */
70 const double lookaheadConfidenceThreshold;
71
72 /** Signature entry data type */
73 struct SignatureEntry : public TaggedEntry
74 {

--- 7 unchanged lines hidden (view full) ---

82 /** Signature table */
83 AssociativeSet<SignatureEntry> signatureTable;
84
85 /** A stride entry with its counter */
86 struct PatternStrideEntry
87 {
88 /** stride in a page in blkSize increments */
89 stride_t stride;
66 /** Minimum confidence to issue a prefetch */
67 const double prefetchConfidenceThreshold;
68 /** Minimum confidence to keep navigating lookahead entries */
69 const double lookaheadConfidenceThreshold;
70
71 /** Signature entry data type */
72 struct SignatureEntry : public TaggedEntry
73 {

--- 7 unchanged lines hidden (view full) ---

81 /** Signature table */
82 AssociativeSet<SignatureEntry> signatureTable;
83
84 /** A stride entry with its counter */
85 struct PatternStrideEntry
86 {
87 /** stride in a page in blkSize increments */
88 stride_t stride;
90 /** counter value (max value defined by maxCounterValue) */
91 uint8_t counter;
92 PatternStrideEntry() : stride(0), counter(0)
89 /** Saturating counter */
90 SatCounter counter;
91 PatternStrideEntry(unsigned bits) : stride(0), counter(bits)
93 {}
94 };
95 /** Pattern entry data type, a set of stride and counter entries */
96 struct PatternEntry : public TaggedEntry
97 {
98 /** group of stides */
99 std::vector<PatternStrideEntry> strideEntries;
100 /** use counter, used by SPPv2 */
92 {}
93 };
94 /** Pattern entry data type, a set of stride and counter entries */
95 struct PatternEntry : public TaggedEntry
96 {
97 /** group of stides */
98 std::vector<PatternStrideEntry> strideEntries;
99 /** use counter, used by SPPv2 */
101 uint8_t counter;
102 PatternEntry(size_t num_strides) : strideEntries(num_strides),
103 counter(0)
100 SatCounter counter;
101 PatternEntry(size_t num_strides, unsigned counter_bits)
102 : strideEntries(num_strides, counter_bits), counter(counter_bits)
104 {}
105
106 /** Reset the entries to their initial values */
107 void reset() override
108 {
109 for (auto &entry : strideEntries) {
103 {}
104
105 /** Reset the entries to their initial values */
106 void reset() override
107 {
108 for (auto &entry : strideEntries) {
110 entry.counter = 0;
109 entry.counter.reset();
111 entry.stride = 0;
112 }
110 entry.stride = 0;
111 }
113 counter = 0;
112 counter.reset();
114 }
115
116 /**
117 * Returns the entry with the desired stride
118 * @param stride the stride to find
119 * @result a pointer to the entry, if the stride was found, or nullptr,
120 * if the stride was not found
121 */

--- 8 unchanged lines hidden (view full) ---

130 }
131 return found_entry;
132 }
133
134 /**
135 * Gets the entry with the provided stride, if there is no entry with
136 * the associated stride, it replaces one of them.
137 * @param stride the stride to find
113 }
114
115 /**
116 * Returns the entry with the desired stride
117 * @param stride the stride to find
118 * @result a pointer to the entry, if the stride was found, or nullptr,
119 * if the stride was not found
120 */

--- 8 unchanged lines hidden (view full) ---

129 }
130 return found_entry;
131 }
132
133 /**
134 * Gets the entry with the provided stride, if there is no entry with
135 * the associated stride, it replaces one of them.
136 * @param stride the stride to find
138 * @param max_counter_value maximum value of the confidence counters,
139 * it is used when no strides are found and an entry needs to be
140 * replaced
141 * @result reference to the selected entry
142 */
137 * @result reference to the selected entry
138 */
143 PatternStrideEntry &getStrideEntry(stride_t stride,
144 uint8_t max_counter_value);
139 PatternStrideEntry &getStrideEntry(stride_t stride);
145 };
146 /** Pattern table */
147 AssociativeSet<PatternEntry> patternTable;
148
149 /**
150 * Generates a new signature from an existing one and a new stride
151 * @param sig current signature
152 * @param str stride to add to the new signature

--- 137 unchanged lines hidden ---
140 };
141 /** Pattern table */
142 AssociativeSet<PatternEntry> patternTable;
143
144 /**
145 * Generates a new signature from an existing one and a new stride
146 * @param sig current signature
147 * @param str stride to add to the new signature

--- 137 unchanged lines hidden ---