gem5 v24.0.0.0
Loading...
Searching...
No Matches
stride.hh
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 Inria
3 * Copyright (c) 2012-2013, 2015, 2022 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
63namespace gem5
64{
65
66class BaseIndexingPolicy;
67namespace replacement_policy
68{
69 class Base;
70}
71struct StridePrefetcherParams;
72
73namespace prefetch
74{
75
81{
82 protected:
83 uint32_t extractSet(const Addr addr) const override;
84 Addr extractTag(const Addr addr) const override;
85
86 public:
88 const StridePrefetcherHashedSetAssociativeParams &p)
90 {
91 }
93};
94
95class Stride : public Queued
96{
97 protected:
100
102 const double threshConf;
103
104 const bool useRequestorId;
105
106 const int degree;
107
114 const int distance;
115
119 const struct PCTableInfo
120 {
121 const int assoc;
122 const int numEntries;
123
126
127 PCTableInfo(int assoc, int num_entries,
128 BaseIndexingPolicy* indexing_policy,
129 replacement_policy::Base* repl_policy)
130 : assoc(assoc), numEntries(num_entries),
131 indexingPolicy(indexing_policy), replacementPolicy(repl_policy)
132 {
133 }
135
137 struct StrideEntry : public TaggedEntry
138 {
139 StrideEntry(const SatCounter8& init_confidence);
140
141 void invalidate() override;
142
146 };
148 std::unordered_map<int, PCTable> pcTables;
149
157 PCTable* findTable(int context);
158
165 PCTable* allocateNewContext(int context);
166
167 public:
168 Stride(const StridePrefetcherParams &p);
169
170 void calculatePrefetch(const PrefetchInfo &pfi,
171 std::vector<AddrPriority> &addresses,
172 const CacheAccessor &cache) override;
173};
174
175} // namespace prefetch
176} // namespace gem5
177
178#endif // __MEM_CACHE_PREFETCH_STRIDE_HH__
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
Associative container based on the previosuly defined Entry type Each element is indexed by a key of ...
A common base class for indexing table locations.
Definition base.hh:67
A set associative indexing policy.
A tagged entry is an entry containing a tag.
Class containing the information needed by the prefetch to train and generate new prefetch requests.
Definition base.hh:111
Override the default set associative to apply a specific hash function when extracting a set.
Definition stride.hh:81
Addr extractTag(const Addr addr) const override
Generate the tag from the given address.
Definition stride.cc:211
StridePrefetcherHashedSetAssociative(const StridePrefetcherHashedSetAssociativeParams &p)
Definition stride.hh:87
uint32_t extractSet(const Addr addr) const override
Apply a hash function to calculate address set.
Definition stride.cc:203
AssociativeSet< StrideEntry > PCTable
Definition stride.hh:147
const SatCounter8 initConfidence
Initial confidence counter value for the pc tables.
Definition stride.hh:99
const double threshConf
Confidence threshold for prefetch generation.
Definition stride.hh:102
PCTable * allocateNewContext(int context)
Create a PC table for the given context.
Definition stride.cc:106
void calculatePrefetch(const PrefetchInfo &pfi, std::vector< AddrPriority > &addresses, const CacheAccessor &cache) override
Definition stride.cc:126
const int distance
How far ahead of the demand stream to start prefetching.
Definition stride.hh:114
Stride(const StridePrefetcherParams &p)
Definition stride.cc:81
std::unordered_map< int, PCTable > pcTables
Definition stride.hh:148
const bool useRequestorId
Definition stride.hh:104
const struct gem5::prefetch::Stride::PCTableInfo pcTableInfo
PCTable * findTable(int context)
Try to find a table of entries for the given context.
Definition stride.cc:94
A common base class of cache replacement policy objects.
Definition base.hh:55
STL vector class.
Definition stl.hh:37
Bitfield< 0 > p
Bitfield< 3 > addr
Definition types.hh:84
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition types.hh:147
Declaration of the Packet class.
Declaration of a set associative indexing policy.
Provides generic cache lookup functions.
Information used to create a new PC table.
Definition stride.hh:120
replacement_policy::Base *const replacementPolicy
Definition stride.hh:125
BaseIndexingPolicy *const indexingPolicy
Definition stride.hh:124
PCTableInfo(int assoc, int num_entries, BaseIndexingPolicy *indexing_policy, replacement_policy::Base *repl_policy)
Definition stride.hh:127
Tagged by hashed PCs.
Definition stride.hh:138
StrideEntry(const SatCounter8 &init_confidence)
Definition stride.cc:66
void invalidate() override
Invalidate the block.
Definition stride.cc:73

Generated on Tue Jun 18 2024 16:24:05 for gem5 by doxygen 1.11.0