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" |
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; |
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; |
89 /** Saturating counter */ 90 SatCounter counter; 91 PatternStrideEntry(unsigned bits) : stride(0), counter(bits) |
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 */ |
100 SatCounter counter; 101 PatternEntry(size_t num_strides, unsigned counter_bits) 102 : strideEntries(num_strides, counter_bits), counter(counter_bits) |
103 {} 104 105 /** Reset the entries to their initial values */ 106 void reset() override 107 { 108 for (auto &entry : strideEntries) { |
109 entry.counter.reset(); |
110 entry.stride = 0; 111 } |
112 counter.reset(); |
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 |
137 * @result reference to the selected entry 138 */ |
139 PatternStrideEntry &getStrideEntry(stride_t stride); |
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 --- |