gem5  v20.1.0.0
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 
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 "base/statistics.hh"
46 #include "base/types.hh"
48 #include "mem/packet.hh"
49 
50 struct QueuedPrefetcherParams;
51 
52 namespace Prefetcher {
53 
54 class Queued : public Base
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 
110  void createPkt(Addr paddr, unsigned blk_size, RequestorID requestor_id,
111  bool tag_prefetch, Tick t);
112 
119  {
120  translationRequest = req;
121  }
122 
123  void markDelayed() override
124  {}
125 
126  void finish(const Fault &fault, const RequestPtr &req,
127  ThreadContext *tc, BaseTLB::Mode mode) override;
128 
134  };
135 
138 
141 
142  // PARAMETERS
143 
145  const unsigned queueSize;
146 
152 
155 
157  const bool queueSquash;
158 
160  const bool queueFilter;
161 
163  const bool cacheSnoop;
164 
166  const bool tagPrefetch;
167 
169  const unsigned int throttleControlPct;
170 
171  struct QueuedStats : public Stats::Group
172  {
173  QueuedStats(Stats::Group *parent);
174  // STATS
180  } statsQueued;
181  public:
183 
184  Queued(const QueuedPrefetcherParams *p);
185  virtual ~Queued();
186 
187  void notify(const PacketPtr &pkt, const PrefetchInfo &pfi) override;
188 
189  void insert(const PacketPtr &pkt, PrefetchInfo &new_pfi, int32_t priority);
190 
191  virtual void calculatePrefetch(const PrefetchInfo &pfi,
192  std::vector<AddrPriority> &addresses) = 0;
193  PacketPtr getPacket() override;
194 
195  Tick nextPrefetchReadyTime() const override
196  {
197  return pfq.empty() ? MaxTick : pfq.front().tick;
198  }
199 
200  private:
201 
207  void addToQueue(std::list<DeferredPacket> &queue, DeferredPacket &dpp);
208 
216  void processMissingTranslations(unsigned max);
217 
225  void translationComplete(DeferredPacket *dp, bool failed);
226 
236  const PrefetchInfo &pfi, int32_t priority);
237 
246  size_t getMaxPermittedPrefetches(size_t total) const;
247 
248  RequestPtr createPrefetchRequest(Addr addr, PrefetchInfo const &pfi,
249  PacketPtr pkt);
250 };
251 
252 } // namespace Prefetcher
253 
254 #endif //__MEM_CACHE_PREFETCH_QUEUED_HH__
255 
Prefetcher::Queued::DeferredPacket
Definition: queued.hh:57
Prefetcher::Queued::DeferredPacket::markDelayed
void markDelayed() override
Signal that the translation has been delayed due to a hw page table walk.
Definition: queued.hh:123
Prefetcher::Queued::QueuedStats::pfBufferHit
Stats::Scalar pfBufferHit
Definition: queued.hh:176
Prefetcher::Queued::QueuedStats::QueuedStats
QueuedStats(Stats::Group *parent)
Definition: queued.cc:227
Prefetcher::Queued::pfqMissingTranslation
std::list< DeferredPacket > pfqMissingTranslation
Definition: queued.hh:137
Prefetcher::Queued::nextPrefetchReadyTime
Tick nextPrefetchReadyTime() const override
Definition: queued.hh:195
Prefetcher::Queued::DeferredPacket::priority
int32_t priority
The priority of this prefetch.
Definition: queued.hh:67
Prefetcher::Queued::insert
void insert(const PacketPtr &pkt, PrefetchInfo &new_pfi, int32_t priority)
Definition: queued.cc:340
Prefetcher::Queued::QueuedStats
Definition: queued.hh:171
Prefetcher::Queued::createPrefetchRequest
RequestPtr createPrefetchRequest(Addr addr, PrefetchInfo const &pfi, PacketPtr pkt)
Definition: queued.cc:329
ArmISA::dp
Bitfield< 47, 44 > dp
Definition: miscregs_types.hh:91
Prefetcher::Queued::alreadyInQueue
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:294
Prefetcher::Queued::DeferredPacket::tick
Tick tick
Time when this prefetch becomes ready.
Definition: queued.hh:63
BaseTLB::Mode
Mode
Definition: tlb.hh:57
Tick
uint64_t Tick
Tick count type.
Definition: types.hh:63
Prefetcher::Queued::translationComplete
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:257
RequestPtr
std::shared_ptr< Request > RequestPtr
Definition: request.hh:82
Prefetcher::Queued::Queued
Queued(const QueuedPrefetcherParams *p)
Definition: queued.cc:95
std::vector
STL vector class.
Definition: stl.hh:37
Prefetcher::Queued::DeferredPacket::finish
void finish(const Fault &fault, const RequestPtr &req, ThreadContext *tc, BaseTLB::Mode mode) override
Definition: queued.cc:86
Prefetcher::Queued::tagPrefetch
const bool tagPrefetch
Tag prefetch with PC of generating access?
Definition: queued.hh:166
BaseTLB
Definition: tlb.hh:50
Prefetcher::Base
Definition: base.hh:65
Prefetcher::Queued::throttleControlPct
const unsigned int throttleControlPct
Percentage of requests that can be throttled.
Definition: queued.hh:169
packet.hh
Prefetcher::Queued::notify
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:145
Prefetcher::Queued::DeferredPacket::tc
ThreadContext * tc
Definition: queued.hh:70
Stats::Scalar
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:2533
Prefetcher::Queued::~Queued
virtual ~Queued()
Definition: queued.cc:106
Prefetcher::Queued::QueuedStats::pfIdentified
Stats::Scalar pfIdentified
Definition: queued.hh:175
RequestorID
uint16_t RequestorID
Definition: request.hh:85
Prefetcher::Queued::latency
const Cycles latency
Cycles after generation when a prefetch can first be issued.
Definition: queued.hh:154
Prefetcher::Queued::const_iterator
std::list< DeferredPacket >::const_iterator const_iterator
Definition: queued.hh:139
base.hh
Prefetcher::Base::tlb
BaseTLB * tlb
Registered tlb for address translations.
Definition: base.hh:332
ThreadContext
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Definition: thread_context.hh:88
Prefetcher::Queued::queueFilter
const bool queueFilter
Filter prefetches if already queued.
Definition: queued.hh:160
Prefetcher::Queued::DeferredPacket::operator<=
bool operator<=(const DeferredPacket &that) const
Definition: queued.hh:95
Fault
std::shared_ptr< FaultBase > Fault
Definition: types.hh:240
statistics.hh
ArmISA::mode
Bitfield< 4, 0 > mode
Definition: miscregs_types.hh:70
Prefetcher::Queued::getPacket
PacketPtr getPacket() override
Definition: queued.cc:201
Prefetcher::Queued::queueSize
const unsigned queueSize
Maximum size of the prefetch queue.
Definition: queued.hh:145
Prefetcher
Copyright (c) 2018 Metempsy Technology Consulting All rights reserved.
Definition: base.hh:78
Prefetcher::Queued::DeferredPacket::createPkt
void createPkt(Addr paddr, unsigned blk_size, RequestorID requestor_id, bool tag_prefetch, Tick t)
Create the associated memory packet.
Definition: queued.cc:53
BaseTLB::Translation
Definition: tlb.hh:59
Prefetcher::Queued::calculatePrefetch
virtual void calculatePrefetch(const PrefetchInfo &pfi, std::vector< AddrPriority > &addresses)=0
std::pair
STL pair class.
Definition: stl.hh:58
Prefetcher::Queued::cacheSnoop
const bool cacheSnoop
Snoop the cache before generating prefetch (cheating basically)
Definition: queued.hh:163
Prefetcher::Queued::missingTranslationQueueSize
const unsigned missingTranslationQueueSize
Maximum size of the queue holding prefetch requests with missing address translations.
Definition: queued.hh:151
Prefetcher::Queued::QueuedStats::pfInCache
Stats::Scalar pfInCache
Definition: queued.hh:177
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
Prefetcher::Queued
Definition: queued.hh:54
Prefetcher::Queued::pfq
std::list< DeferredPacket > pfq
Definition: queued.hh:136
Prefetcher::Queued::getMaxPermittedPrefetches
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:115
Prefetcher::Queued::iterator
std::list< DeferredPacket >::iterator iterator
Definition: queued.hh:140
types.hh
ArmISA::t
Bitfield< 5 > t
Definition: miscregs_types.hh:67
Prefetcher::Queued::DeferredPacket::startTranslation
void startTranslation(BaseTLB *tlb)
Issues the translation request to the provided TLB.
Definition: queued.cc:75
Prefetcher::Queued::DeferredPacket::setTranslationRequest
void setTranslationRequest(const RequestPtr &req)
Sets the translation request needed to obtain the physical address of this request.
Definition: queued.hh:118
Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:257
Stats::Group
Statistics container.
Definition: group.hh:83
addr
ip6_addr_t addr
Definition: inet.hh:423
Prefetcher::Base::PrefetchInfo
Class containing the information needed by the prefetch to train and generate new prefetch requests.
Definition: base.hh:90
Prefetcher::Queued::DeferredPacket::pkt
PacketPtr pkt
The memory packet generated by this prefetch.
Definition: queued.hh:65
Cycles
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:83
Prefetcher::Queued::QueuedStats::pfSpanPage
Stats::Scalar pfSpanPage
Definition: queued.hh:179
Prefetcher::Queued::statsQueued
Prefetcher::Queued::QueuedStats statsQueued
Prefetcher::Queued::DeferredPacket::operator<
bool operator<(const DeferredPacket &that) const
Definition: queued.hh:91
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
std::list< DeferredPacket >
Prefetcher::Queued::DeferredPacket::translationRequest
RequestPtr translationRequest
Request used when a translation is needed.
Definition: queued.hh:69
Stats::total
const FlagsType total
Print the total.
Definition: info.hh:49
Prefetcher::Queued::DeferredPacket::pfInfo
PrefetchInfo pfInfo
Prefetch info corresponding to this packet.
Definition: queued.hh:61
Prefetcher::Queued::DeferredPacket::DeferredPacket
DeferredPacket(Queued *o, PrefetchInfo const &pfi, Tick t, int32_t prio)
Constructor.
Definition: queued.hh:81
MaxTick
const Tick MaxTick
Definition: types.hh:65
Prefetcher::Queued::addToQueue
void addToQueue(std::list< DeferredPacket > &queue, DeferredPacket &dpp)
Adds a DeferredPacket to the specified queue.
Definition: queued.cc:439
Prefetcher::Queued::QueuedStats::pfRemovedFull
Stats::Scalar pfRemovedFull
Definition: queued.hh:178
Prefetcher::Queued::DeferredPacket::operator>
bool operator>(const DeferredPacket &that) const
Definition: queued.hh:87
Prefetcher::Queued::DeferredPacket::ongoingTranslation
bool ongoingTranslation
Definition: queued.hh:71
Prefetcher::Queued::DeferredPacket::owner
Queued * owner
Owner of the packet.
Definition: queued.hh:59
Prefetcher::Queued::processMissingTranslations
void processMissingTranslations(unsigned max)
Starts the translations of the queued prefetches with a missing translation.
Definition: queued.cc:242
Prefetcher::Queued::queueSquash
const bool queueSquash
Squash queued prefetch if demand access observed.
Definition: queued.hh:157

Generated on Wed Sep 30 2020 14:02:12 for gem5 by doxygen 1.8.17