gem5  v21.2.0.0
stride.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 Inria
3  * Copyright (c) 2012-2013, 2015 ARM Limited
4  * All rights reserved
5  *
6  * The license below extends only to copyright in the software and shall
7  * not be construed as granting a license to any other intellectual
8  * property including but not limited to intellectual property relating
9  * to a hardware implementation of the functionality of the software
10  * licensed hereunder. You may use the software subject to the license
11  * terms below provided that you ensure that this notice is replicated
12  * unmodified and in its entirety in all distributions of the software,
13  * modified or unmodified, in source code or in binary form.
14  *
15  * Copyright (c) 2005 The Regents of The University of Michigan
16  * All rights reserved.
17  *
18  * Redistribution and use in source and binary forms, with or without
19  * modification, are permitted provided that the following conditions are
20  * met: redistributions of source code must retain the above copyright
21  * notice, this list of conditions and the following disclaimer;
22  * redistributions in binary form must reproduce the above copyright
23  * notice, this list of conditions and the following disclaimer in the
24  * documentation and/or other materials provided with the distribution;
25  * neither the name of the copyright holders nor the names of its
26  * contributors may be used to endorse or promote products derived from
27  * this software without specific prior written permission.
28  *
29  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40  */
41 
47 #ifndef __MEM_CACHE_PREFETCH_STRIDE_HH__
48 #define __MEM_CACHE_PREFETCH_STRIDE_HH__
49 
50 #include <string>
51 #include <unordered_map>
52 #include <vector>
53 
54 #include "base/sat_counter.hh"
55 #include "base/types.hh"
60 #include "mem/packet.hh"
61 #include "params/StridePrefetcherHashedSetAssociative.hh"
62 
63 namespace gem5
64 {
65 
66 class BaseIndexingPolicy;
67 GEM5_DEPRECATED_NAMESPACE(ReplacementPolicy, replacement_policy);
68 namespace replacement_policy
69 {
70  class Base;
71 }
72 struct StridePrefetcherParams;
73 
75 namespace prefetch
76 {
77 
83 {
84  protected:
85  uint32_t extractSet(const Addr addr) const override;
86  Addr extractTag(const Addr addr) const override;
87 
88  public:
90  const StridePrefetcherHashedSetAssociativeParams &p)
91  : SetAssociative(p)
92  {
93  }
95 };
96 
97 class Stride : public Queued
98 {
99  protected:
102 
104  const double threshConf;
105 
106  const bool useRequestorId;
107 
108  const int degree;
109 
113  const struct PCTableInfo
114  {
115  const int assoc;
116  const int numEntries;
117 
120 
121  PCTableInfo(int assoc, int num_entries,
122  BaseIndexingPolicy* indexing_policy,
123  replacement_policy::Base* repl_policy)
124  : assoc(assoc), numEntries(num_entries),
125  indexingPolicy(indexing_policy), replacementPolicy(repl_policy)
126  {
127  }
128  } pcTableInfo;
129 
131  struct StrideEntry : public TaggedEntry
132  {
133  StrideEntry(const SatCounter8& init_confidence);
134 
135  void invalidate() override;
136 
138  int stride;
140  };
142  std::unordered_map<int, PCTable> pcTables;
143 
151  PCTable* findTable(int context);
152 
159  PCTable* allocateNewContext(int context);
160 
161  public:
162  Stride(const StridePrefetcherParams &p);
163 
164  void calculatePrefetch(const PrefetchInfo &pfi,
165  std::vector<AddrPriority> &addresses) override;
166 };
167 
168 } // namespace prefetch
169 } // namespace gem5
170 
171 #endif // __MEM_CACHE_PREFETCH_STRIDE_HH__
gem5::prefetch::Stride::Stride
Stride(const StridePrefetcherParams &p)
Definition: stride.cc:82
gem5::prefetch::Stride::PCTableInfo::numEntries
const int numEntries
Definition: stride.hh:116
gem5::prefetch::StridePrefetcherHashedSetAssociative::StridePrefetcherHashedSetAssociative
StridePrefetcherHashedSetAssociative(const StridePrefetcherHashedSetAssociativeParams &p)
Definition: stride.hh:89
gem5::BaseIndexingPolicy
A common base class for indexing table locations.
Definition: base.hh:66
gem5::prefetch::Stride::PCTableInfo::indexingPolicy
BaseIndexingPolicy *const indexingPolicy
Definition: stride.hh:118
gem5::prefetch::Stride::PCTable
AssociativeSet< StrideEntry > PCTable
Definition: stride.hh:141
gem5::prefetch::Stride::useRequestorId
const bool useRequestorId
Definition: stride.hh:106
gem5::prefetch::Stride::PCTableInfo::replacementPolicy
replacement_policy::Base *const replacementPolicy
Definition: stride.hh:119
gem5::prefetch::Stride::StrideEntry::invalidate
void invalidate() override
Invalidate the block.
Definition: stride.cc:74
gem5::prefetch::Stride::initConfidence
const SatCounter8 initConfidence
Initial confidence counter value for the pc tables.
Definition: stride.hh:101
std::vector
STL vector class.
Definition: stl.hh:37
gem5::prefetch::Stride::PCTableInfo::assoc
const int assoc
Definition: stride.hh:115
gem5::prefetch::Stride::StrideEntry::confidence
SatCounter8 confidence
Definition: stride.hh:139
gem5::prefetch::Stride::allocateNewContext
PCTable * allocateNewContext(int context)
Create a PC table for the given context.
Definition: stride.cc:106
sat_counter.hh
set_associative.hh
queued.hh
packet.hh
gem5::prefetch::Stride::StrideEntry::lastAddr
Addr lastAddr
Definition: stride.hh:137
gem5::GenericSatCounter< uint8_t >
replaceable_entry.hh
gem5::prefetch::Stride::pcTableInfo
const struct gem5::prefetch::Stride::PCTableInfo pcTableInfo
gem5::TaggedEntry
A tagged entry is an entry containing a tag.
Definition: tagged_entry.hh:46
gem5::prefetch::StridePrefetcherHashedSetAssociative::~StridePrefetcherHashedSetAssociative
~StridePrefetcherHashedSetAssociative()=default
gem5::AssociativeSet
Associative container based on the previosuly defined Entry type Each element is indexed by a key of ...
Definition: associative_set.hh:45
gem5::MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:326
gem5::prefetch::Stride::threshConf
const double threshConf
Confidence threshold for prefetch generation.
Definition: stride.hh:104
gem5::prefetch::Stride::StrideEntry::StrideEntry
StrideEntry(const SatCounter8 &init_confidence)
Definition: stride.cc:67
gem5::replacement_policy::Base
A common base class of cache replacement policy objects.
Definition: base.hh:55
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
gem5::GEM5_DEPRECATED_NAMESPACE
GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi)
gem5::prefetch::Queued
Definition: queued.hh:60
gem5::prefetch::Stride::calculatePrefetch
void calculatePrefetch(const PrefetchInfo &pfi, std::vector< AddrPriority > &addresses) override
Definition: stride.cc:121
gem5::prefetch::Stride::pcTables
std::unordered_map< int, PCTable > pcTables
Definition: stride.hh:142
gem5::prefetch::StridePrefetcherHashedSetAssociative
Override the default set associative to apply a specific hash function when extracting a set.
Definition: stride.hh:82
types.hh
gem5::prefetch::Stride
Definition: stride.hh:97
associative_set.hh
gem5::context_switch_task_id::Prefetcher
@ Prefetcher
Definition: request.hh:83
gem5::prefetch::StridePrefetcherHashedSetAssociative::extractSet
uint32_t extractSet(const Addr addr) const override
Apply a hash function to calculate address set.
Definition: stride.cc:196
gem5::prefetch::Stride::StrideEntry
Tagged by hashed PCs.
Definition: stride.hh:131
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: tlb.cc:60
gem5::prefetch::Stride::PCTableInfo::PCTableInfo
PCTableInfo(int assoc, int num_entries, BaseIndexingPolicy *indexing_policy, replacement_policy::Base *repl_policy)
Definition: stride.hh:121
gem5::prefetch::Stride::StrideEntry::stride
int stride
Definition: stride.hh:138
gem5::prefetch::Stride::findTable
PCTable * findTable(int context)
Try to find a table of entries for the given context.
Definition: stride.cc:94
gem5::prefetch::Stride::degree
const int degree
Definition: stride.hh:108
gem5::prefetch::StridePrefetcherHashedSetAssociative::extractTag
Addr extractTag(const Addr addr) const override
Generate the tag from the given address.
Definition: stride.cc:204
gem5::SetAssociative
A set associative indexing policy.
Definition: set_associative.hh:82
gem5::prefetch::Base::PrefetchInfo
Class containing the information needed by the prefetch to train and generate new prefetch requests.
Definition: base.hh:97
gem5::prefetch::Stride::PCTableInfo
Information used to create a new PC table.
Definition: stride.hh:113
gem5::X86ISA::addr
Bitfield< 3 > addr
Definition: types.hh:84

Generated on Tue Dec 21 2021 11:34:32 for gem5 by doxygen 1.8.17