gem5  v22.0.0.1
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 "arch/generic/mmu.hh"
46 #include "base/statistics.hh"
47 #include "base/types.hh"
49 #include "mem/packet.hh"
50 
51 namespace gem5
52 {
53 
54 struct QueuedPrefetcherParams;
55 
57 namespace prefetch
58 {
59 
60 class Queued : public Base
61 {
62  protected:
64  {
74  int32_t priority;
79 
89  int32_t prio) : owner(o), pfInfo(pfi), tick(t), pkt(nullptr),
90  priority(prio), translationRequest(), tc(nullptr),
91  ongoingTranslation(false) {
92  }
93 
94  bool operator>(const DeferredPacket& that) const
95  {
96  return priority > that.priority;
97  }
98  bool operator<(const DeferredPacket& that) const
99  {
100  return priority < that.priority;
101  }
102  bool operator<=(const DeferredPacket& that) const
103  {
104  return !(*this > that);
105  }
106 
117  void createPkt(Addr paddr, unsigned blk_size, RequestorID requestor_id,
118  bool tag_prefetch, Tick t);
119 
126  {
127  translationRequest = req;
128  }
129 
130  void markDelayed() override
131  {}
132 
133  void finish(const Fault &fault, const RequestPtr &req,
134  ThreadContext *tc, BaseMMU::Mode mode) override;
135 
141  };
142 
145 
148 
149  // PARAMETERS
150 
152  const unsigned queueSize;
153 
159 
162 
164  const bool queueSquash;
165 
167  const bool queueFilter;
168 
170  const bool cacheSnoop;
171 
173  const bool tagPrefetch;
174 
176  const unsigned int throttleControlPct;
177 
179  {
181  // STATS
189  } statsQueued;
190  public:
192 
193  Queued(const QueuedPrefetcherParams &p);
194  virtual ~Queued();
195 
196  void notify(const PacketPtr &pkt, const PrefetchInfo &pfi) override;
197 
198  void insert(const PacketPtr &pkt, PrefetchInfo &new_pfi, int32_t priority);
199 
200  virtual void calculatePrefetch(const PrefetchInfo &pfi,
201  std::vector<AddrPriority> &addresses) = 0;
202  PacketPtr getPacket() override;
203 
204  Tick nextPrefetchReadyTime() const override
205  {
206  return pfq.empty() ? MaxTick : pfq.front().tick;
207  }
208 
209  void printQueue(const std::list<DeferredPacket> &queue) const;
210 
211  private:
212 
218  void addToQueue(std::list<DeferredPacket> &queue, DeferredPacket &dpp);
219 
227  void processMissingTranslations(unsigned max);
228 
236  void translationComplete(DeferredPacket *dp, bool failed);
237 
247  const PrefetchInfo &pfi, int32_t priority);
248 
257  size_t getMaxPermittedPrefetches(size_t total) const;
258 
259  RequestPtr createPrefetchRequest(Addr addr, PrefetchInfo const &pfi,
260  PacketPtr pkt);
261 };
262 
263 } // namespace prefetch
264 } // namespace gem5
265 
266 #endif //__MEM_CACHE_PREFETCH_QUEUED_HH__
gem5::statistics::Scalar
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:1930
gem5::prefetch::Queued::DeferredPacket::finish
void finish(const Fault &fault, const RequestPtr &req, ThreadContext *tc, BaseMMU::Mode mode) override
Definition: queued.cc:92
gem5::prefetch::Queued::~Queued
virtual ~Queued()
Definition: queued.cc:112
gem5::prefetch::Queued::cacheSnoop
const bool cacheSnoop
Snoop the cache before generating prefetch (cheating basically)
Definition: queued.hh:170
gem5::prefetch::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:173
gem5::prefetch::Queued::DeferredPacket::owner
Queued * owner
Owner of the packet.
Definition: queued.hh:66
gem5::prefetch::Queued::QueuedStats
Definition: queued.hh:178
gem5::prefetch::Queued::iterator
std::list< DeferredPacket >::iterator iterator
Definition: queued.hh:147
gem5::prefetch::Queued::addToQueue
void addToQueue(std::list< DeferredPacket > &queue, DeferredPacket &dpp)
Adds a DeferredPacket to the specified queue.
Definition: queued.cc:484
gem5::prefetch::Queued::QueuedStats::pfRemovedDemand
statistics::Scalar pfRemovedDemand
Definition: queued.hh:185
gem5::prefetch::Queued::DeferredPacket::tick
Tick tick
Time when this prefetch becomes ready.
Definition: queued.hh:70
gem5::prefetch::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:143
gem5::prefetch::Queued::DeferredPacket::setTranslationRequest
void setTranslationRequest(const RequestPtr &req)
Sets the translation request needed to obtain the physical address of this request.
Definition: queued.hh:125
gem5::prefetch::Queued::DeferredPacket::priority
int32_t priority
The priority of this prefetch.
Definition: queued.hh:74
gem5::prefetch::Queued::QueuedStats::pfInCache
statistics::Scalar pfInCache
Definition: queued.hh:184
gem5::prefetch::Queued::QueuedStats::pfSpanPage
statistics::Scalar pfSpanPage
Definition: queued.hh:187
gem5::BaseMMU::Mode
Mode
Definition: mmu.hh:56
gem5::prefetch::Queued::missingTranslationQueueSize
const unsigned missingTranslationQueueSize
Maximum size of the queue holding prefetch requests with missing address translations.
Definition: queued.hh:158
gem5::MaxTick
const Tick MaxTick
Definition: types.hh:60
std::vector
STL vector class.
Definition: stl.hh:37
gem5::prefetch::Queued::printQueue
void printQueue(const std::list< DeferredPacket > &queue) const
Definition: queued.cc:121
gem5::prefetch::Queued::QueuedStats::pfIdentified
statistics::Scalar pfIdentified
Definition: queued.hh:182
gem5::prefetch::Queued::tagPrefetch
const bool tagPrefetch
Tag prefetch with PC of generating access?
Definition: queued.hh:173
gem5::prefetch::Queued::DeferredPacket::operator<=
bool operator<=(const DeferredPacket &that) const
Definition: queued.hh:102
gem5::prefetch::Queued::insert
void insert(const PacketPtr &pkt, PrefetchInfo &new_pfi, int32_t priority)
Definition: queued.cc:385
gem5::prefetch::Queued::calculatePrefetch
virtual void calculatePrefetch(const PrefetchInfo &pfi, std::vector< AddrPriority > &addresses)=0
packet.hh
gem5::Cycles
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:78
gem5::prefetch::Queued::QueuedStats::pfUsefulSpanPage
statistics::Scalar pfUsefulSpanPage
Definition: queued.hh:188
gem5::prefetch::Queued::DeferredPacket::translationRequest
RequestPtr translationRequest
Request used when a translation is needed.
Definition: queued.hh:76
gem5::prefetch::Queued::latency
const Cycles latency
Cycles after generation when a prefetch can first be issued.
Definition: queued.hh:161
base.hh
gem5::ThreadContext
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Definition: thread_context.hh:94
gem5::VegaISA::t
Bitfield< 51 > t
Definition: pagetable.hh:56
gem5::Fault
std::shared_ptr< FaultBase > Fault
Definition: types.hh:248
gem5::VegaISA::p
Bitfield< 54 > p
Definition: pagetable.hh:70
gem5::Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:291
gem5::prefetch::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:339
gem5::prefetch::Queued::DeferredPacket::startTranslation
void startTranslation(BaseTLB *tlb)
Issues the translation request to the provided TLB.
Definition: queued.cc:81
statistics.hh
gem5::Tick
uint64_t Tick
Tick count type.
Definition: types.hh:58
gem5::RequestPtr
std::shared_ptr< Request > RequestPtr
Definition: request.hh:92
mmu.hh
gem5::prefetch::Queued::DeferredPacket::ongoingTranslation
bool ongoingTranslation
Definition: queued.hh:78
gem5::BaseTLB
Definition: tlb.hh:58
gem5::prefetch::Queued::QueuedStats::pfBufferHit
statistics::Scalar pfBufferHit
Definition: queued.hh:183
gem5::prefetch::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:59
gem5::prefetch::Queued::throttleControlPct
const unsigned int throttleControlPct
Percentage of requests that can be throttled.
Definition: queued.hh:176
std::pair
STL pair class.
Definition: stl.hh:58
gem5::prefetch::Queued::getPacket
PacketPtr getPacket() override
Definition: queued.cc:238
gem5::prefetch::Queued::pfq
std::list< DeferredPacket > pfq
Definition: queued.hh:143
gem5::prefetch::Queued::QueuedStats::QueuedStats
QueuedStats(statistics::Group *parent)
Definition: queued.cc:265
gem5::prefetch::Queued::queueFilter
const bool queueFilter
Filter prefetches if already queued.
Definition: queued.hh:167
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
gem5::prefetch::Queued::DeferredPacket::markDelayed
void markDelayed() override
Signal that the translation has been delayed due to a hw page table walk.
Definition: queued.hh:130
gem5::GEM5_DEPRECATED_NAMESPACE
GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi)
gem5::prefetch::Queued::DeferredPacket::operator<
bool operator<(const DeferredPacket &that) const
Definition: queued.hh:98
gem5::prefetch::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:302
gem5::prefetch::Queued::DeferredPacket::tc
ThreadContext * tc
Definition: queued.hh:77
gem5::prefetch::Queued
Definition: queued.hh:60
gem5::prefetch::Queued::queueSize
const unsigned queueSize
Maximum size of the prefetch queue.
Definition: queued.hh:152
gem5::BaseMMU::Translation
Definition: mmu.hh:58
gem5::prefetch::Queued::DeferredPacket::pfInfo
PrefetchInfo pfInfo
Prefetch info corresponding to this packet.
Definition: queued.hh:68
gem5::prefetch::Queued::processMissingTranslations
void processMissingTranslations(unsigned max)
Starts the translations of the queued prefetches with a missing translation.
Definition: queued.cc:287
gem5::prefetch::Queued::DeferredPacket::pkt
PacketPtr pkt
The memory packet generated by this prefetch.
Definition: queued.hh:72
types.hh
gem5::prefetch::Queued::Queued
Queued(const QueuedPrefetcherParams &p)
Definition: queued.cc:101
gem5::statistics::Group
Statistics container.
Definition: group.hh:93
gem5::prefetch::Queued::DeferredPacket::DeferredPacket
DeferredPacket(Queued *o, PrefetchInfo const &pfi, Tick t, int32_t prio)
Constructor.
Definition: queued.hh:88
gem5::RequestorID
uint16_t RequestorID
Definition: request.hh:95
gem5::prefetch::Base::tlb
BaseTLB * tlb
Registered tlb for address translations.
Definition: base.hh:368
gem5::context_switch_task_id::Prefetcher
@ Prefetcher
Definition: request.hh:83
gem5::prefetch::Queued::createPrefetchRequest
RequestPtr createPrefetchRequest(Addr addr, PrefetchInfo const &pfi, PacketPtr pkt)
Definition: queued.cc:374
std::list< DeferredPacket >
gem5::prefetch::Queued::const_iterator
std::list< DeferredPacket >::const_iterator const_iterator
Definition: queued.hh:146
gem5::prefetch::Queued::DeferredPacket
Definition: queued.hh:63
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37
gem5::statistics::total
const FlagsType total
Print the total.
Definition: info.hh:60
gem5::prefetch::Base
Definition: base.hh:72
gem5::prefetch::Base::PrefetchInfo
Class containing the information needed by the prefetch to train and generate new prefetch requests.
Definition: base.hh:97
gem5::prefetch::Queued::DeferredPacket::operator>
bool operator>(const DeferredPacket &that) const
Definition: queued.hh:94
gem5::ArmISA::dp
Bitfield< 47, 44 > dp
Definition: misc_types.hh:95
gem5::prefetch::Queued::nextPrefetchReadyTime
Tick nextPrefetchReadyTime() const override
Definition: queued.hh:204
gem5::prefetch::Queued::QueuedStats::pfRemovedFull
statistics::Scalar pfRemovedFull
Definition: queued.hh:186
gem5::ArmISA::mode
Bitfield< 4, 0 > mode
Definition: misc_types.hh:74
gem5::X86ISA::addr
Bitfield< 3 > addr
Definition: types.hh:84
gem5::prefetch::Queued::pfqMissingTranslation
std::list< DeferredPacket > pfqMissingTranslation
Definition: queued.hh:144
gem5::prefetch::Queued::queueSquash
const bool queueSquash
Squash queued prefetch if demand access observed.
Definition: queued.hh:164
gem5::prefetch::Queued::statsQueued
gem5::prefetch::Queued::QueuedStats statsQueued

Generated on Sat Jun 18 2022 08:12:27 for gem5 by doxygen 1.8.17