gem5 [DEVELOP-FOR-25.1]
Loading...
Searching...
No Matches
fdp.hh
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022-2023 The University of Edinburgh
3 * Copyright (c) 2025 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 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions are
17 * met: redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer;
19 * redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution;
22 * neither the name of the copyright holders nor the names of its
23 * contributors may be used to endorse or promote products derived from
24 * this software without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
30 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 */
38
42
43#ifndef __MEM_CACHE_PREFETCH_FDP_HH__
44#define __MEM_CACHE_PREFETCH_FDP_HH__
45
46#include <list>
47
48#include "arch/generic/mmu.hh"
49#include "cpu/base.hh"
50#include "cpu/o3/ftq.hh"
51#include "mem/cache/base.hh"
53
54namespace gem5
55{
56
57struct FetchDirectedPrefetcherParams;
58
59namespace prefetch
60{
61
63{
64
65 public:
66 FetchDirectedPrefetcher(const FetchDirectedPrefetcherParams &p);
68
70 void regProbeListeners() override;
71 void
73 {
74 cache = _cache;
75 }
76
78 PacketPtr getPacket() override;
79
80 Tick
81 nextPrefetchReadyTime() const override
82 {
83 return pfq.empty() ? MaxTick : pfq.front().readyTime;
84 }
85
87 void notify(const CacheAccessProbeArg &acc,
88 const PrefetchInfo &pfi) override {};
89
90 private:
93
96
99
102
105
107 const unsigned int latency;
108
110 const unsigned int pfqSize;
111
113 const unsigned int tqSize;
114
116 const bool cacheSnoop;
117
120 {
121 PrefetchRequest(FetchDirectedPrefetcher &_owner, uint64_t _addr,
123
126
128 const uint64_t addr;
129
132
136
139
144
145 bool
146 operator==(const int &a) const
147 {
148 return this->addr == a;
149 }
150
152 void createPkt();
153
154 void finish(const Fault &fault, const RequestPtr &req,
155 ThreadContext *tc, BaseMMU::Mode mode) override;
156
158 void startTranslation();
159
160 void
161 markDelayed() override
162 {}
163
164 void
166 {
167 canceled = true;
168 }
169
170 bool
172 {
173 return canceled;
174 }
175 };
176
180
183 void notifyFTQInsert(const o3::FetchTargetPtr &ft);
184
187 void notifyFTQRemove(const o3::FetchTargetPtr &ft);
188
190 void translationComplete(PrefetchRequest *pf_req, const bool failed);
191
192 protected:
219};
220
221} // namespace prefetch
222} // namespace gem5
223
224#endif // __MEM_CACHE_PREFETCH_FDP_HH__
A basic cache interface.
Definition base.hh:104
Information provided to probes on a cache event.
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Class containing the information needed by the prefetch to train and generate new prefetch requests.
Definition base.hh:113
Base(const BasePrefetcherParams &p)
Definition base.cc:101
std::list< PrefetchRequest > pfq
The prefetch queue.
Definition fdp.hh:178
void translationComplete(PrefetchRequest *pf_req, const bool failed)
A translation has completed and can now be added to the PFQ.
Definition fdp.cc:147
const unsigned int tqSize
Translation queue size: Maximum number of outstanding translations.
Definition fdp.hh:113
const bool markReqAsPrefetch
Mark memory requests as prefetches.
Definition fdp.hh:101
gem5::prefetch::FetchDirectedPrefetcher::Stats stats
const bool cacheSnoop
Probe the cache before a prefetch gets inserted into the PFQ.
Definition fdp.hh:116
void notifyFTQRemove(const o3::FetchTargetPtr &ft)
Notifies the prefetcher that a fetch target was removed from the FTQ.
Definition fdp.cc:114
BaseCPU * cpu
Pointer to the CPU object that contains the FTQ.
Definition fdp.hh:95
std::list< PrefetchRequest > translationq
Definition fdp.hh:179
void setCache(BaseCache *_cache)
Definition fdp.hh:72
const unsigned int pfqSize
Prefetch queue size: Maximum number of queued prefetches.
Definition fdp.hh:110
const bool squashPrefetches
Squash prefetches in case its fetch target is removed from the FTQ.
Definition fdp.hh:104
const unsigned int latency
The latency of the prefetcher.
Definition fdp.hh:107
void regProbeListeners() override
Base class overrides.
Definition fdp.cc:268
void notify(const CacheAccessProbeArg &acc, const PrefetchInfo &pfi) override
Notify functions are not used by this prefetcher.
Definition fdp.hh:87
BaseCache * cache
Pointer to the cache it is attached to.
Definition fdp.hh:98
FetchDirectedPrefetcher(const FetchDirectedPrefetcherParams &p)
Definition fdp.cc:53
Tick nextPrefetchReadyTime() const override
Definition fdp.hh:81
std::vector< ProbeListenerPtr<> > listeners
Array of probe listeners.
Definition fdp.hh:92
PacketPtr getPacket() override
Gets a packet from the prefetch queue to be prefetched.
Definition fdp.cc:204
void notifyFTQInsert(const o3::FetchTargetPtr &ft)
Notifies the prefetcher that a new fetch target was inserted into the FTQ.
Definition fdp.cc:68
A simple distribution stat.
Statistics container.
Definition group.hh:93
This is a simple scalar statistic, like a counter.
STL list class.
Definition stl.hh:51
STL vector class.
Definition stl.hh:37
Declares a basic cache interface BaseCache.
Miss and writeback queue declarations.
Bitfield< 4, 0 > mode
Definition misc_types.hh:74
Bitfield< 8 > a
Definition misc_types.hh:66
Bitfield< 0 > p
InstSeqNum FTSeqNum
Definition ftq.hh:67
std::shared_ptr< FetchTarget > FetchTargetPtr
Definition bac.hh:62
Copyright (c) 2024 Arm Limited All rights reserved.
Definition binary32.hh:36
std::shared_ptr< FaultBase > Fault
Definition types.hh:249
int16_t ThreadID
Thread index/ID type.
Definition types.hh:235
std::shared_ptr< Request > RequestPtr
Definition request.hh:94
uint64_t Tick
Tick count type.
Definition types.hh:58
const Tick MaxTick
Definition types.hh:60
Packet * PacketPtr
The prefetch queue entry objects.
Definition fdp.hh:120
PrefetchRequest(FetchDirectedPrefetcher &_owner, uint64_t _addr, ThreadID tid, o3::FTSeqNum ftn)
Definition fdp.cc:221
Tick readyTime
The time when the prefetch is ready to be sent to the cache.
Definition fdp.hh:138
bool canceled
Marks a Prefetch Request as canceled if notifyFTQRemove was called during translation.
Definition fdp.hh:143
void startTranslation()
Issues the translation request.
Definition fdp.cc:250
const uint64_t addr
The virtual address.
Definition fdp.hh:128
RequestPtr req
The request and packet that will be sent to the cache.
Definition fdp.hh:134
const o3::FTSeqNum ftn
The fetch target number that created this request.
Definition fdp.hh:131
FetchDirectedPrefetcher & owner
Owner of the packet.
Definition fdp.hh:125
void finish(const Fault &fault, const RequestPtr &req, ThreadContext *tc, BaseMMU::Mode mode) override
Definition fdp.cc:258
void createPkt()
Creates the packet that is send to the memory.
Definition fdp.cc:242
void markDelayed() override
Signal that the translation has been delayed due to a hw page table walk.
Definition fdp.hh:161
Stats(statistics::Group *parent, int pfq_size, int tq_size)
Definition fdp.cc:286
statistics::Distribution pfqSizeDistAtNotify
Definition fdp.hh:210
statistics::Distribution tqSizeDistAtNotify
Definition fdp.hh:211

Generated on Mon Oct 27 2025 04:13:03 for gem5 by doxygen 1.14.0