gem5  v19.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
queued.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2015 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  * Authors: Mitch Hayenga
38  */
39 
40 #ifndef __MEM_CACHE_PREFETCH_QUEUED_HH__
41 #define __MEM_CACHE_PREFETCH_QUEUED_HH__
42 
43 #include <cstdint>
44 #include <list>
45 #include <utility>
46 
47 #include "base/statistics.hh"
48 #include "base/types.hh"
50 #include "mem/packet.hh"
51 
52 struct QueuedPrefetcherParams;
53 
55 {
56  protected:
67  int32_t priority;
72 
82  int32_t prio) : owner(o), pfInfo(pfi), tick(t), pkt(nullptr),
83  priority(prio), translationRequest(), tc(nullptr),
84  ongoingTranslation(false) {
85  }
86 
87  bool operator>(const DeferredPacket& that) const
88  {
89  return priority > that.priority;
90  }
91  bool operator<(const DeferredPacket& that) const
92  {
93  return priority < that.priority;
94  }
95  bool operator<=(const DeferredPacket& that) const
96  {
97  return !(*this > that);
98  }
99 
109  void createPkt(Addr paddr, unsigned blk_size, MasterID mid,
110  bool tag_prefetch, Tick t);
111 
118  {
119  translationRequest = req;
120  }
121 
122  void markDelayed() override
123  {}
124 
125  void finish(const Fault &fault, const RequestPtr &req,
126  ThreadContext *tc, BaseTLB::Mode mode) override;
127 
133  };
134 
137 
140 
141  // PARAMETERS
142 
144  const unsigned queueSize;
145 
151 
154 
156  const bool queueSquash;
157 
159  const bool queueFilter;
160 
162  const bool cacheSnoop;
163 
165  const bool tagPrefetch;
166 
168  const unsigned int throttleControlPct;
169 
170  // STATS
176 
177  public:
179 
180  QueuedPrefetcher(const QueuedPrefetcherParams *p);
181  virtual ~QueuedPrefetcher();
182 
183  void notify(const PacketPtr &pkt, const PrefetchInfo &pfi) override;
184 
185  void insert(const PacketPtr &pkt, PrefetchInfo &new_pfi, int32_t priority);
186 
187  virtual void calculatePrefetch(const PrefetchInfo &pfi,
188  std::vector<AddrPriority> &addresses) = 0;
189  PacketPtr getPacket() override;
190 
191  Tick nextPrefetchReadyTime() const override
192  {
193  return pfq.empty() ? MaxTick : pfq.front().tick;
194  }
195 
196  void regStats() override;
197 
198  private:
199 
206 
214  void processMissingTranslations(unsigned max);
215 
223  void translationComplete(DeferredPacket *dp, bool failed);
224 
234  const PrefetchInfo &pfi, int32_t priority);
235 
244  size_t getMaxPermittedPrefetches(size_t total) const;
245 
247  PacketPtr pkt);
248 };
249 
250 #endif //__MEM_CACHE_PREFETCH_QUEUED_HH__
251 
RequestPtr translationRequest
Request used when a translation is needed.
Definition: queued.hh:69
const Cycles latency
Cycles after generation when a prefetch can first be issued.
Definition: queued.hh:153
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:83
STL pair class.
Definition: stl.hh:61
PrefetchInfo pfInfo
Prefetch info corresponding to this packet.
Definition: queued.hh:61
const unsigned queueSize
Maximum size of the prefetch queue.
Definition: queued.hh:144
void addToQueue(std::list< DeferredPacket > &queue, DeferredPacket &dpp)
Adds a DeferredPacket to the specified queue.
Definition: queued.cc:450
void translationComplete(DeferredPacket *dp, bool failed)
Indicates that the translation of the address of the provided deferred packet has been successfully c...
Definition: queued.cc:269
std::shared_ptr< Request > RequestPtr
Definition: request.hh:83
ip6_addr_t addr
Definition: inet.hh:335
void regStats() override
Register local statistics.
Definition: queued.cc:227
Bitfield< 47, 44 > dp
Bitfield< 4, 0 > mode
std::list< DeferredPacket >::const_iterator const_iterator
Definition: queued.hh:138
BaseTLB * tlb
Registered tlb for address translations.
Definition: base.hh:331
ThreadContext is the external interface to all thread state for anything outside of the CPU...
Declaration of Statistics objects.
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:2508
STL vector class.
Definition: stl.hh:40
std::list< DeferredPacket >::iterator iterator
Definition: queued.hh:139
bool operator<=(const DeferredPacket &that) const
Definition: queued.hh:95
std::list< DeferredPacket > pfqMissingTranslation
Definition: queued.hh:136
Definition: tlb.hh:52
const Tick MaxTick
Definition: types.hh:65
Class containing the information needed by the prefetch to train and generate new prefetch requests...
Definition: base.hh:92
void finish(const Fault &fault, const RequestPtr &req, ThreadContext *tc, BaseTLB::Mode mode) override
Definition: queued.cc:84
bool operator>(const DeferredPacket &that) const
Definition: queued.hh:87
void markDelayed() override
Signal that the translation has been delayed due to a hw page table walk.
Definition: queued.hh:122
uint64_t Tick
Tick count type.
Definition: types.hh:63
Stats::Scalar pfRemovedFull
Definition: queued.hh:174
QueuedPrefetcher * owner
Owner of the packet.
Definition: queued.hh:59
bool operator<(const DeferredPacket &that) const
Definition: queued.hh:91
Tick nextPrefetchReadyTime() const override
Definition: queued.hh:191
void processMissingTranslations(unsigned max)
Starts the translations of the queued prefetches with a missing translation.
Definition: queued.cc:254
PacketPtr pkt
The memory packet generated by this prefetch.
Definition: queued.hh:65
void setTranslationRequest(const RequestPtr &req)
Sets the translation request needed to obtain the physical address of this request.
Definition: queued.hh:117
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
uint16_t MasterID
Definition: request.hh:86
void notify(const PacketPtr &pkt, const PrefetchInfo &pfi) override
Notify prefetcher of cache access (may be any access or just misses, depending on cache parameters...
Definition: queued.cc:143
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
Definition: packet.hh:255
const bool cacheSnoop
Snoop the cache before generating prefetch (cheating basically)
Definition: queued.hh:162
const FlagsType total
Print the total.
Definition: info.hh:51
QueuedPrefetcher(const QueuedPrefetcherParams *p)
Definition: queued.cc:93
Mode
Definition: tlb.hh:59
const bool tagPrefetch
Tag prefetch with PC of generating access?
Definition: queued.hh:165
const bool queueFilter
Filter prefetches if already queued.
Definition: queued.hh:159
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:306
Stats::Scalar pfSpanPage
Definition: queued.hh:175
const bool queueSquash
Squash queued prefetch if demand access observed.
Definition: queued.hh:156
Declaration of the Packet class.
DeferredPacket(QueuedPrefetcher *o, PrefetchInfo const &pfi, Tick t, int32_t prio)
Constructor.
Definition: queued.hh:81
PacketPtr getPacket() override
Definition: queued.cc:199
const unsigned int throttleControlPct
Percentage of requests that can be throttled.
Definition: queued.hh:168
Stats::Scalar pfInCache
Definition: queued.hh:173
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:113
virtual void calculatePrefetch(const PrefetchInfo &pfi, std::vector< AddrPriority > &addresses)=0
int32_t priority
The priority of this prefetch.
Definition: queued.hh:67
virtual ~QueuedPrefetcher()
Definition: queued.cc:104
RequestPtr createPrefetchRequest(Addr addr, PrefetchInfo const &pfi, PacketPtr pkt)
Definition: queued.cc:341
void createPkt(Addr paddr, unsigned blk_size, MasterID mid, bool tag_prefetch, Tick t)
Create the associated memory packet.
Definition: queued.cc:53
Bitfield< 5 > t
Miss and writeback queue declarations.
Bitfield< 0 > p
void startTranslation(BaseTLB *tlb)
Issues the translation request to the provided TLB.
Definition: queued.cc:73
std::shared_ptr< FaultBase > Fault
Definition: types.hh:240
void insert(const PacketPtr &pkt, PrefetchInfo &new_pfi, int32_t priority)
Definition: queued.cc:352
Tick tick
Time when this prefetch becomes ready.
Definition: queued.hh:63
Stats::Scalar pfIdentified
Definition: queued.hh:171
Stats::Scalar pfBufferHit
Definition: queued.hh:172
const unsigned missingTranslationQueueSize
Maximum size of the queue holding prefetch requests with missing address translations.
Definition: queued.hh:150
std::list< DeferredPacket > pfq
Definition: queued.hh:135

Generated on Fri Feb 28 2020 16:27:01 for gem5 by doxygen 1.8.13