mem-cache: Fix missing header in associative set
[gem5.git] / src / mem / cache / prefetch / signature_path_v2.hh
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;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * Authors: Javier Bueno
29 */
30
31 /**
32 * Implementation of the Signature Path Prefetcher (v2)
33 *
34 * References:
35 * Path confidence based lookahead prefetching
36 * Jinchun Kim, Seth H. Pugsley, Paul V. Gratz, A. L. Narasimha Reddy,
37 * Chris Wilkerson, and Zeshan Chishti. 2016.
38 * In The 49th Annual IEEE/ACM International Symposium on
39 * Microarchitecture (MICRO-49). IEEE Press, Piscataway, NJ, USA,
40 * Article 60, 12 pages.
41 */
42
43 #ifndef __MEM_CACHE_PREFETCH_SIGNATURE_PATH_V2_HH__
44 #define __MEM_CACHE_PREFETCH_SIGNATURE_PATH_V2_HH__
45
46 #include "mem/cache/prefetch/associative_set.hh"
47 #include "mem/cache/prefetch/signature_path.hh"
48 #include "mem/packet.hh"
49
50 struct SignaturePathPrefetcherV2Params;
51
52 class SignaturePathPrefetcherV2 : public SignaturePathPrefetcher
53 {
54 /** Global History Register entry datatype */
55 struct GlobalHistoryEntry : public TaggedEntry
56 {
57 signature_t signature;
58 double confidence;
59 stride_t lastBlock;
60 stride_t delta;
61 GlobalHistoryEntry() : signature(0), confidence(0.0), lastBlock(0),
62 delta(0) {}
63 };
64 /** Global History Register */
65 AssociativeSet<GlobalHistoryEntry> globalHistoryRegister;
66
67 double calculateLookaheadConfidence(PatternEntry const &sig,
68 PatternStrideEntry const &lookahead) const override;
69
70 double calculatePrefetchConfidence(PatternEntry const &sig,
71 PatternStrideEntry const &lookahead) const override;
72
73 void increasePatternEntryCounter(PatternEntry &pattern_entry,
74 PatternStrideEntry &pstride_entry) override;
75
76 void handleSignatureTableMiss(stride_t current_block,
77 signature_t &new_signature, double &new_conf,
78 stride_t &new_stride) override;
79
80 /**
81 * In this version of the Signature Path Prefetcher, there is no auxiliary
82 * prefetcher, so this function does not perform any actions.
83 */
84 void auxiliaryPrefetcher(Addr ppn, stride_t current_block, bool is_secure,
85 std::vector<AddrPriority> &addresses) override
86 {}
87
88 virtual void handlePageCrossingLookahead(signature_t signature,
89 stride_t last_offset, stride_t delta, double path_confidence)
90 override;
91
92 public:
93 SignaturePathPrefetcherV2(const SignaturePathPrefetcherV2Params* p);
94 ~SignaturePathPrefetcherV2() {}
95 };
96
97 #endif//__MEM_CACHE_PREFETCH_SIGNATURE_PATH_V2_HH__