gem5 v24.0.0.0
Loading...
Searching...
No Matches
queued.hh
Go to the documentation of this file.
1/*
2 * Copyright (c) 2014-2015, 2023 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated
11 * unmodified and in its entirety in all distributions of the software,
12 * modified or unmodified, in source code or in binary form.
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions are
16 * met: redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer;
18 * redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution;
21 * neither the name of the copyright holders nor the names of its
22 * contributors may be used to endorse or promote products derived from
23 * this software without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 */
37
38#ifndef __MEM_CACHE_PREFETCH_QUEUED_HH__
39#define __MEM_CACHE_PREFETCH_QUEUED_HH__
40
41#include <cstdint>
42#include <list>
43#include <utility>
44
45#include "arch/generic/mmu.hh"
46#include "base/statistics.hh"
47#include "base/types.hh"
49#include "mem/packet.hh"
50
51namespace gem5
52{
53
54struct QueuedPrefetcherParams;
55
56namespace prefetch
57{
58
59class Queued : public Base
60{
61 protected:
63 {
73 int32_t priority;
79
89 int32_t prio, const CacheAccessor &_cache)
90 : owner(o), pfInfo(pfi), tick(t), pkt(nullptr),
91 priority(prio), translationRequest(), tc(nullptr),
92 ongoingTranslation(false), cache(&_cache) {
93 }
94
95 bool operator>(const DeferredPacket& that) const
96 {
97 return priority > that.priority;
98 }
99 bool operator<(const DeferredPacket& that) const
100 {
101 return priority < that.priority;
102 }
103 bool operator<=(const DeferredPacket& that) const
104 {
105 return !(*this > that);
106 }
107
118 void createPkt(Addr paddr, unsigned blk_size, RequestorID requestor_id,
119 bool tag_prefetch, Tick t);
120
127 {
128 translationRequest = req;
129 }
130
131 void markDelayed() override
132 {}
133
134 void finish(const Fault &fault, const RequestPtr &req,
136
142 };
143
146
149
150 // PARAMETERS
151
153 const unsigned queueSize;
154
160
163
165 const bool queueSquash;
166
168 const bool queueFilter;
169
171 const bool cacheSnoop;
172
174 const bool tagPrefetch;
175
177 const unsigned int throttleControlPct;
178
191 public:
193
194 Queued(const QueuedPrefetcherParams &p);
195 virtual ~Queued();
196
197 void
198 notify(const CacheAccessProbeArg &acc, const PrefetchInfo &pfi) override;
199
200 void insert(const PacketPtr &pkt, PrefetchInfo &new_pfi, int32_t priority,
201 const CacheAccessor &cache);
202
203 virtual void calculatePrefetch(const PrefetchInfo &pfi,
204 std::vector<AddrPriority> &addresses,
205 const CacheAccessor &cache) = 0;
206 PacketPtr getPacket() override;
207
209 {
210 return pfq.empty() ? MaxTick : pfq.front().tick;
211 }
212
213 void printQueue(const std::list<DeferredPacket> &queue) const;
214
215 private:
216
222 void addToQueue(std::list<DeferredPacket> &queue, DeferredPacket &dpp);
223
231 void processMissingTranslations(unsigned max);
232
241 void translationComplete(DeferredPacket *dp, bool failed,
242 const CacheAccessor &cache);
243
253 const PrefetchInfo &pfi, int32_t priority);
254
263 size_t getMaxPermittedPrefetches(size_t total) const;
264
265 RequestPtr createPrefetchRequest(Addr addr, PrefetchInfo const &pfi,
266 PacketPtr pkt);
267};
268
269} // namespace prefetch
270} // namespace gem5
271
272#endif //__MEM_CACHE_PREFETCH_QUEUED_HH__
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
Information provided to probes on a cache event.
Cycles is a wrapper class for representing cycle counts, i.e.
Definition types.hh:79
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition packet.hh:295
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:111
BaseMMU * mmu
Registered mmu for address translations.
Definition base.hh:377
void translationComplete(DeferredPacket *dp, bool failed, const CacheAccessor &cache)
Indicates that the translation of the address of the provided deferred packet has been successfully c...
Definition queued.cc:303
const bool queueSquash
Squash queued prefetch if demand access observed.
Definition queued.hh:165
gem5::prefetch::Queued::QueuedStats statsQueued
void insert(const PacketPtr &pkt, PrefetchInfo &new_pfi, int32_t priority, const CacheAccessor &cache)
Definition queued.cc:388
std::list< DeferredPacket >::iterator iterator
Definition queued.hh:148
void notify(const CacheAccessProbeArg &acc, const PrefetchInfo &pfi) override
Notify prefetcher of cache access (may be any access or just misses, depending on cache parameters....
Definition queued.cc:172
Queued(const QueuedPrefetcherParams &p)
Definition queued.cc:100
void printQueue(const std::list< DeferredPacket > &queue) const
Definition queued.cc:120
const unsigned queueSize
Maximum size of the prefetch queue.
Definition queued.hh:153
std::list< DeferredPacket > pfqMissingTranslation
Definition queued.hh:145
void processMissingTranslations(unsigned max)
Starts the translations of the queued prefetches with a missing translation.
Definition queued.cc:288
RequestPtr createPrefetchRequest(Addr addr, PrefetchInfo const &pfi, PacketPtr pkt)
Definition queued.cc:377
const bool queueFilter
Filter prefetches if already queued.
Definition queued.hh:168
std::list< DeferredPacket >::const_iterator const_iterator
Definition queued.hh:147
virtual void calculatePrefetch(const PrefetchInfo &pfi, std::vector< AddrPriority > &addresses, const CacheAccessor &cache)=0
const bool tagPrefetch
Tag prefetch with PC of generating access?
Definition queued.hh:174
const Cycles latency
Cycles after generation when a prefetch can first be issued.
Definition queued.hh:162
const bool cacheSnoop
Snoop the cache before generating prefetch (cheating basically)
Definition queued.hh:171
const unsigned int throttleControlPct
Percentage of requests that can be throttled.
Definition queued.hh:177
PacketPtr getPacket() override
Definition queued.cc:239
void addToQueue(std::list< DeferredPacket > &queue, DeferredPacket &dpp)
Adds a DeferredPacket to the specified queue.
Definition queued.cc:487
bool alreadyInQueue(std::list< DeferredPacket > &queue, const PrefetchInfo &pfi, int32_t priority)
Checks whether the specified prefetch request is already in the specified queue.
Definition queued.cc:342
Tick nextPrefetchReadyTime() const override
Definition queued.hh:208
size_t getMaxPermittedPrefetches(size_t total) const
Returns the maxmimum number of prefetch requests that are allowed to be created from the number of pr...
Definition queued.cc:142
const unsigned missingTranslationQueueSize
Maximum size of the queue holding prefetch requests with missing address translations.
Definition queued.hh:159
std::list< DeferredPacket > pfq
Definition queued.hh:144
Statistics container.
Definition group.hh:93
This is a simple scalar statistic, like a counter.
STL list class.
Definition stl.hh:51
STL pair class.
Definition stl.hh:58
STL vector class.
Definition stl.hh:37
Miss and writeback queue declarations.
Bitfield< 4, 0 > mode
Definition misc_types.hh:74
Bitfield< 5 > t
Definition misc_types.hh:71
Bitfield< 7, 4 > dp
Bitfield< 3, 0 > priority
Bitfield< 0 > p
Bitfield< 3 > addr
Definition types.hh:84
const FlagsType total
Print the total.
Definition info.hh:59
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
std::shared_ptr< FaultBase > Fault
Definition types.hh:249
std::shared_ptr< Request > RequestPtr
Definition request.hh:94
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition types.hh:147
uint64_t Tick
Tick count type.
Definition types.hh:58
const Tick MaxTick
Definition types.hh:60
uint16_t RequestorID
Definition request.hh:95
Declaration of the Packet class.
Declaration of Statistics objects.
Provides generic cache lookup functions.
bool operator>(const DeferredPacket &that) const
Definition queued.hh:95
int32_t priority
The priority of this prefetch.
Definition queued.hh:73
Tick tick
Time when this prefetch becomes ready.
Definition queued.hh:69
DeferredPacket(Queued *o, PrefetchInfo const &pfi, Tick t, int32_t prio, const CacheAccessor &_cache)
Constructor.
Definition queued.hh:88
bool operator<=(const DeferredPacket &that) const
Definition queued.hh:103
const CacheAccessor * cache
Definition queued.hh:78
void startTranslation(BaseMMU *mmu)
Issues the translation request to the provided MMU.
Definition queued.cc:80
void setTranslationRequest(const RequestPtr &req)
Sets the translation request needed to obtain the physical address of this request.
Definition queued.hh:126
void createPkt(Addr paddr, unsigned blk_size, RequestorID requestor_id, bool tag_prefetch, Tick t)
Create the associated memory packet.
Definition queued.cc:58
Queued * owner
Owner of the packet.
Definition queued.hh:65
void finish(const Fault &fault, const RequestPtr &req, ThreadContext *tc, BaseMMU::Mode mode) override
Definition queued.cc:91
RequestPtr translationRequest
Request used when a translation is needed.
Definition queued.hh:75
PacketPtr pkt
The memory packet generated by this prefetch.
Definition queued.hh:71
bool operator<(const DeferredPacket &that) const
Definition queued.hh:99
void markDelayed() override
Signal that the translation has been delayed due to a hw page table walk.
Definition queued.hh:131
PrefetchInfo pfInfo
Prefetch info corresponding to this packet.
Definition queued.hh:67
statistics::Scalar pfUsefulSpanPage
Definition queued.hh:189
statistics::Scalar pfBufferHit
Definition queued.hh:184
statistics::Scalar pfIdentified
Definition queued.hh:183
statistics::Scalar pfRemovedDemand
Definition queued.hh:186
statistics::Scalar pfRemovedFull
Definition queued.hh:187
statistics::Scalar pfSpanPage
Definition queued.hh:188
QueuedStats(statistics::Group *parent)
Definition queued.cc:266

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