gem5  v20.1.0.0
Sequencer.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019-2020 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  * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
15  * All rights reserved.
16  *
17  * Redistribution and use in source and binary forms, with or without
18  * modification, are permitted provided that the following conditions are
19  * met: redistributions of source code must retain the above copyright
20  * notice, this list of conditions and the following disclaimer;
21  * redistributions in binary form must reproduce the above copyright
22  * notice, this list of conditions and the following disclaimer in the
23  * documentation and/or other materials provided with the distribution;
24  * neither the name of the copyright holders nor the names of its
25  * contributors may be used to endorse or promote products derived from
26  * this software without specific prior written permission.
27  *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39  */
40 
41 #ifndef __MEM_RUBY_SYSTEM_SEQUENCER_HH__
42 #define __MEM_RUBY_SYSTEM_SEQUENCER_HH__
43 
44 #include <iostream>
45 #include <list>
46 #include <unordered_map>
47 
49 #include "mem/ruby/protocol/MachineType.hh"
50 #include "mem/ruby/protocol/RubyRequestType.hh"
51 #include "mem/ruby/protocol/SequencerRequestType.hh"
54 #include "params/RubySequencer.hh"
55 
57 {
59  RubyRequestType m_type;
60  RubyRequestType m_second_type;
62  SequencerRequest(PacketPtr _pkt, RubyRequestType _m_type,
63  RubyRequestType _m_second_type, Cycles _issue_time)
64  : pkt(_pkt), m_type(_m_type), m_second_type(_m_second_type),
65  issue_time(_issue_time)
66  {}
67 
68  bool functionalWrite(Packet *func_pkt) const
69  {
70  // Follow-up on RubyRequest::functionalWrite
71  // This makes sure the hitCallback won't overrite the value we
72  // expect to find
73  assert(func_pkt->isWrite());
74  return func_pkt->trySatisfyFunctional(pkt);
75  }
76 };
77 
78 std::ostream& operator<<(std::ostream& out, const SequencerRequest& obj);
79 
80 class Sequencer : public RubyPort
81 {
82  public:
83  typedef RubySequencerParams Params;
84  Sequencer(const Params *);
85  ~Sequencer();
86 
91  void writeCallbackScFail(Addr address,
92  DataBlock& data);
93 
94  // Public Methods
95  virtual void wakeup(); // Used only for deadlock detection
96  void resetStats() override;
97  void collateStats();
98  void regStats() override;
99 
100  void writeCallback(Addr address,
101  DataBlock& data,
102  const bool externalHit = false,
103  const MachineType mach = MachineType_NUM,
104  const Cycles initialRequestTime = Cycles(0),
105  const Cycles forwardRequestTime = Cycles(0),
106  const Cycles firstResponseTime = Cycles(0));
107 
108  void readCallback(Addr address,
109  DataBlock& data,
110  const bool externalHit = false,
111  const MachineType mach = MachineType_NUM,
112  const Cycles initialRequestTime = Cycles(0),
113  const Cycles forwardRequestTime = Cycles(0),
114  const Cycles firstResponseTime = Cycles(0));
115 
116  RequestStatus makeRequest(PacketPtr pkt) override;
117  virtual bool empty() const;
118  int outstandingCount() const override { return m_outstanding_count; }
119 
120  bool isDeadlockEventScheduled() const override
121  { return deadlockCheckEvent.scheduled(); }
122 
123  void descheduleDeadlockEvent() override
125 
126  virtual void print(std::ostream& out) const;
127 
128  void markRemoved();
129  void evictionCallback(Addr address);
130  int coreId() const { return m_coreId; }
131 
132  virtual int functionalWrite(Packet *func_pkt) override;
133 
134  void recordRequestType(SequencerRequestType requestType);
136 
139  { return *m_typeLatencyHist[t]; }
140 
143  { return *m_hitTypeLatencyHist[t]; }
144 
146  { return *m_hitMachLatencyHist[t]; }
147 
149  { return *m_hitTypeMachLatencyHist[r][t]; }
150 
152  { return m_missLatencyHist; }
154  { return *m_missTypeLatencyHist[t]; }
155 
157  { return *m_missMachLatencyHist[t]; }
158 
160  getMissTypeMachLatencyHist(uint32_t r, uint32_t t) const
161  { return *m_missTypeMachLatencyHist[r][t]; }
162 
164  { return *m_IssueToInitialDelayHist[t]; }
165 
167  getInitialToForwardDelayHist(const MachineType t) const
168  { return *m_InitialToForwardDelayHist[t]; }
169 
171  getForwardRequestToFirstResponseHist(const MachineType t) const
173 
175  getFirstResponseToCompletionDelayHist(const MachineType t) const
177 
178  Stats::Counter getIncompleteTimes(const MachineType t) const
179  { return m_IncompleteTimes[t]; }
180 
181  private:
182  void issueRequest(PacketPtr pkt, RubyRequestType type);
183 
184  void hitCallback(SequencerRequest* srequest, DataBlock& data,
185  bool llscSuccess,
186  const MachineType mach, const bool externalHit,
187  const Cycles initialRequestTime,
188  const Cycles forwardRequestTime,
189  const Cycles firstResponseTime);
190 
191  void recordMissLatency(SequencerRequest* srequest, bool llscSuccess,
192  const MachineType respondingMach,
193  bool isExternalHit, Cycles initialRequestTime,
194  Cycles forwardRequestTime,
195  Cycles firstResponseTime);
196 
197  // Private copy constructor and assignment operator
198  Sequencer(const Sequencer& obj);
199  Sequencer& operator=(const Sequencer& obj);
200 
201  protected:
202  // RequestTable contains both read and write requests, handles aliasing
203  std::unordered_map<Addr, std::list<SequencerRequest>> m_RequestTable;
204 
206 
207  virtual RequestStatus insertRequest(PacketPtr pkt,
208  RubyRequestType primary_type,
209  RubyRequestType secondary_type);
210 
211  private:
213 
216 
217  // The cache access latency for top-level caches (L0/L1). These are
218  // currently assessed at the beginning of each memory access through the
219  // sequencer.
220  // TODO: Migrate these latencies into top-level cache controllers.
223 
224  // Global outstanding request count, across all request tables
227 
228  int m_coreId;
229 
231 
234 
238 
243 
248 
253 
258 
265 
267 
268  // support for LL/SC
269 
274  void llscLoadLinked(const Addr);
275 
280  void llscClearMonitor(const Addr);
281 
290  bool llscStoreConditional(const Addr);
291 
292  public:
299  bool llscCheckMonitor(const Addr);
300 
301 
306  void llscClearLocalMonitor();
307 };
308 
309 inline std::ostream&
310 operator<<(std::ostream& out, const Sequencer& obj)
311 {
312  obj.print(out);
313  out << std::flush;
314  return out;
315 }
316 
317 #endif // __MEM_RUBY_SYSTEM_SEQUENCER_HH__
Sequencer::getLatencyHist
Stats::Histogram & getLatencyHist()
Definition: Sequencer.hh:137
Event::scheduled
bool scheduled() const
Determine if the current event is scheduled.
Definition: eventq.hh:460
Sequencer::m_ForwardToFirstResponseDelayHist
std::vector< Stats::Histogram * > m_ForwardToFirstResponseDelayHist
Definition: Sequencer.hh:262
Sequencer::getIncompleteTimes
Stats::Counter getIncompleteTimes(const MachineType t) const
Definition: Sequencer.hh:178
Sequencer::getTypeLatencyHist
Stats::Histogram & getTypeLatencyHist(uint32_t t)
Definition: Sequencer.hh:138
Sequencer::getMissMachLatencyHist
Stats::Histogram & getMissMachLatencyHist(uint32_t t) const
Definition: Sequencer.hh:156
Sequencer::getOutstandReqHist
Stats::Histogram & getOutstandReqHist()
Definition: Sequencer.hh:135
Sequencer::getHitLatencyHist
Stats::Histogram & getHitLatencyHist()
Definition: Sequencer.hh:141
Sequencer::getMissTypeMachLatencyHist
Stats::Histogram & getMissTypeMachLatencyHist(uint32_t r, uint32_t t) const
Definition: Sequencer.hh:160
Sequencer::m_outstanding_count
int m_outstanding_count
Definition: Sequencer.hh:225
Sequencer::functionalWrite
virtual int functionalWrite(Packet *func_pkt) override
Definition: Sequencer.cc:194
Sequencer::m_outstandReqHist
Stats::Histogram m_outstandReqHist
Histogram for number of outstanding requests per cycle.
Definition: Sequencer.hh:233
SequencerRequest::pkt
PacketPtr pkt
Definition: Sequencer.hh:58
Sequencer::getHitMachLatencyHist
Stats::Histogram & getHitMachLatencyHist(uint32_t t)
Definition: Sequencer.hh:145
Sequencer::empty
virtual bool empty() const
Definition: Sequencer.cc:572
Sequencer::m_missMachLatencyHist
std::vector< Stats::Histogram * > m_missMachLatencyHist
Histograms for profiling the latencies for requests that required external messages.
Definition: Sequencer.hh:256
data
const char data[]
Definition: circlebuf.test.cc:42
Sequencer::resetStats
void resetStats() override
Callback to reset stats.
Definition: Sequencer.cc:208
Sequencer::m_max_outstanding_requests
int m_max_outstanding_requests
Definition: Sequencer.hh:212
Sequencer
Definition: Sequencer.hh:80
Sequencer::writeCallbackScFail
void writeCallbackScFail(Addr address, DataBlock &data)
Proxy function to writeCallback that first invalidates the line address in the local monitor.
Definition: Sequencer.cc:339
RubyPort::Params
RubyPortParams Params
Definition: RubyPort.hh:146
Sequencer::m_hitTypeLatencyHist
std::vector< Stats::Histogram * > m_hitTypeLatencyHist
Definition: Sequencer.hh:242
Sequencer::getForwardRequestToFirstResponseHist
Stats::Histogram & getForwardRequestToFirstResponseHist(const MachineType t) const
Definition: Sequencer.hh:171
Sequencer::m_IssueToInitialDelayHist
std::vector< Stats::Histogram * > m_IssueToInitialDelayHist
Histograms for recording the breakdown of miss latency.
Definition: Sequencer.hh:260
Sequencer::getFirstResponseToCompletionDelayHist
Stats::Histogram & getFirstResponseToCompletionDelayHist(const MachineType t) const
Definition: Sequencer.hh:175
Sequencer::isDeadlockEventScheduled
bool isDeadlockEventScheduled() const override
Definition: Sequencer.hh:120
Sequencer::m_data_cache_hit_latency
Cycles m_data_cache_hit_latency
Definition: Sequencer.hh:221
SequencerRequest::m_type
RubyRequestType m_type
Definition: Sequencer.hh:59
type
uint8_t type
Definition: inet.hh:421
Sequencer::m_dataCache_ptr
CacheMemory * m_dataCache_ptr
Definition: Sequencer.hh:214
Sequencer::wakeup
virtual void wakeup()
Definition: Sequencer.cc:159
Sequencer::~Sequencer
~Sequencer()
Definition: Sequencer.cc:90
Sequencer::makeRequest
RequestStatus makeRequest(PacketPtr pkt) override
Definition: Sequencer.cc:578
EventManager::deschedule
void deschedule(Event &event)
Definition: eventq.hh:1014
std::vector< Stats::Histogram * >
Sequencer::m_coreId
int m_coreId
Definition: Sequencer.hh:228
Sequencer::coreId
int coreId() const
Definition: Sequencer.hh:130
Sequencer::collateStats
void collateStats()
Sequencer::m_RequestTable
std::unordered_map< Addr, std::list< SequencerRequest > > m_RequestTable
Definition: Sequencer.hh:203
Sequencer::m_hitLatencyHist
Stats::Histogram m_hitLatencyHist
Histogram for holding latency profile of all requests that hit in the controller connected to this se...
Definition: Sequencer.hh:241
Sequencer::m_latencyHist
Stats::Histogram m_latencyHist
Histogram for holding latency profile of all requests.
Definition: Sequencer.hh:236
Sequencer::m_missTypeMachLatencyHist
std::vector< std::vector< Stats::Histogram * > > m_missTypeMachLatencyHist
Definition: Sequencer.hh:257
Sequencer::m_runningGarnetStandalone
bool m_runningGarnetStandalone
Definition: Sequencer.hh:230
SequencerRequest::SequencerRequest
SequencerRequest(PacketPtr _pkt, RubyRequestType _m_type, RubyRequestType _m_second_type, Cycles _issue_time)
Definition: Sequencer.hh:62
DataBlock
Definition: DataBlock.hh:40
Sequencer::getMissTypeLatencyHist
Stats::Histogram & getMissTypeLatencyHist(uint32_t t)
Definition: Sequencer.hh:153
EventFunctionWrapper
Definition: eventq.hh:1101
Stats::Histogram
A simple histogram stat.
Definition: statistics.hh:2654
SequencerRequest::issue_time
Cycles issue_time
Definition: Sequencer.hh:61
SequencerRequest::m_second_type
RubyRequestType m_second_type
Definition: Sequencer.hh:60
Sequencer::print
virtual void print(std::ostream &out) const
Definition: Sequencer.cc:755
Sequencer::insertRequest
virtual RequestStatus insertRequest(PacketPtr pkt, RubyRequestType primary_type, RubyRequestType secondary_type)
Definition: Sequencer.cc:240
Sequencer::hitCallback
void hitCallback(SequencerRequest *srequest, DataBlock &data, bool llscSuccess, const MachineType mach, const bool externalHit, const Cycles initialRequestTime, const Cycles forwardRequestTime, const Cycles firstResponseTime)
Definition: Sequencer.cc:494
CacheMemory.hh
Sequencer::recordMissLatency
void recordMissLatency(SequencerRequest *srequest, bool llscSuccess, const MachineType respondingMach, bool isExternalHit, Cycles initialRequestTime, Cycles forwardRequestTime, Cycles firstResponseTime)
Definition: Sequencer.cc:273
Sequencer::llscStoreConditional
bool llscStoreConditional(const Addr)
Searches for cache line address in the global monitor tagged with this Sequencer object's version id.
Definition: Sequencer.cc:117
Sequencer::getIssueToInitialDelayHist
Stats::Histogram & getIssueToInitialDelayHist(uint32_t t) const
Definition: Sequencer.hh:163
Sequencer::Params
RubySequencerParams Params
Definition: Sequencer.hh:83
Sequencer::readCallback
void readCallback(Addr address, DataBlock &data, const bool externalHit=false, const MachineType mach=MachineType_NUM, const Cycles initialRequestTime=Cycles(0), const Cycles forwardRequestTime=Cycles(0), const Cycles firstResponseTime=Cycles(0))
Definition: Sequencer.cc:439
Sequencer::descheduleDeadlockEvent
void descheduleDeadlockEvent() override
Definition: Sequencer.hh:123
RubyPort
Definition: RubyPort.hh:58
Sequencer::markRemoved
void markRemoved()
Definition: Sequencer.cc:267
MipsISA::r
r
Definition: pra_constants.hh:95
Sequencer::m_deadlock_check_scheduled
bool m_deadlock_check_scheduled
Definition: Sequencer.hh:226
Sequencer::m_missLatencyHist
Stats::Histogram m_missLatencyHist
Histogram for holding latency profile of all requests that miss in the controller connected to this s...
Definition: Sequencer.hh:251
Sequencer::llscLoadLinked
void llscLoadLinked(const Addr)
Places the cache line address into the global monitor tagged with this Sequencer object's version id.
Definition: Sequencer.cc:95
Sequencer::getHitTypeMachLatencyHist
Stats::Histogram & getHitTypeMachLatencyHist(uint32_t r, uint32_t t)
Definition: Sequencer.hh:148
Sequencer::deadlockCheckEvent
EventFunctionWrapper deadlockCheckEvent
Definition: Sequencer.hh:266
CacheMemory
Definition: CacheMemory.hh:63
Sequencer::evictionCallback
void evictionCallback(Addr address)
Definition: Sequencer.cc:770
Sequencer::m_IncompleteTimes
std::vector< Stats::Counter > m_IncompleteTimes
Definition: Sequencer.hh:264
Sequencer::writeCallback
void writeCallback(Addr address, DataBlock &data, const bool externalHit=false, const MachineType mach=MachineType_NUM, const Cycles initialRequestTime=Cycles(0), const Cycles forwardRequestTime=Cycles(0), const Cycles firstResponseTime=Cycles(0))
Definition: Sequencer.cc:346
Sequencer::llscClearMonitor
void llscClearMonitor(const Addr)
Removes the cache line address from the global monitor.
Definition: Sequencer.cc:106
Sequencer::recordRequestType
void recordRequestType(SequencerRequestType requestType)
Definition: Sequencer.cc:764
SequencerRequest::functionalWrite
bool functionalWrite(Packet *func_pkt) const
Definition: Sequencer.hh:68
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
Sequencer::m_hitTypeMachLatencyHist
std::vector< std::vector< Stats::Histogram * > > m_hitTypeMachLatencyHist
Definition: Sequencer.hh:247
Sequencer::llscCheckMonitor
bool llscCheckMonitor(const Addr)
Searches for cache line address in the global monitor tagged with this Sequencer object's version id.
Definition: Sequencer.cc:138
Sequencer::m_instCache_ptr
CacheMemory * m_instCache_ptr
Definition: Sequencer.hh:215
Sequencer::getMissLatencyHist
Stats::Histogram & getMissLatencyHist()
Definition: Sequencer.hh:151
Sequencer::outstandingCount
int outstandingCount() const override
Definition: Sequencer.hh:118
Stats::Counter
double Counter
All counters are of 64-bit values.
Definition: types.hh:41
Sequencer::m_hitMachLatencyHist
std::vector< Stats::Histogram * > m_hitMachLatencyHist
Histograms for profiling the latencies for requests that did not required external messages.
Definition: Sequencer.hh:246
Sequencer::regStats
void regStats() override
Callback to set stat parameters.
Definition: Sequencer.cc:777
Sequencer::m_InitialToForwardDelayHist
std::vector< Stats::Histogram * > m_InitialToForwardDelayHist
Definition: Sequencer.hh:261
Sequencer::m_deadlock_threshold
Cycles m_deadlock_threshold
Definition: Sequencer.hh:205
Address.hh
ArmISA::t
Bitfield< 5 > t
Definition: miscregs_types.hh:67
Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:257
Sequencer::m_typeLatencyHist
std::vector< Stats::Histogram * > m_typeLatencyHist
Definition: Sequencer.hh:237
Cycles
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:83
Packet::isWrite
bool isWrite() const
Definition: packet.hh:557
SequencerRequest
Definition: Sequencer.hh:56
Sequencer::issueRequest
void issueRequest(PacketPtr pkt, RubyRequestType type)
Definition: Sequencer.cc:694
Sequencer::Sequencer
Sequencer(const Params *)
Definition: Sequencer.cc:70
Packet::trySatisfyFunctional
bool trySatisfyFunctional(PacketPtr other)
Check a functional request against a memory value stored in another packet (i.e.
Definition: packet.hh:1331
RubyPort.hh
Sequencer::operator=
Sequencer & operator=(const Sequencer &obj)
Sequencer::m_inst_cache_hit_latency
Cycles m_inst_cache_hit_latency
Definition: Sequencer.hh:222
operator<<
std::ostream & operator<<(std::ostream &out, const SequencerRequest &obj)
Sequencer::llscClearLocalMonitor
void llscClearLocalMonitor()
Removes all addresses from the local monitor.
Definition: Sequencer.cc:153
Sequencer::getHitTypeLatencyHist
Stats::Histogram & getHitTypeLatencyHist(uint32_t t)
Definition: Sequencer.hh:142
Sequencer::m_FirstResponseToCompletionDelayHist
std::vector< Stats::Histogram * > m_FirstResponseToCompletionDelayHist
Definition: Sequencer.hh:263
Sequencer::m_missTypeLatencyHist
std::vector< Stats::Histogram * > m_missTypeLatencyHist
Definition: Sequencer.hh:252
Sequencer::getInitialToForwardDelayHist
Stats::Histogram & getInitialToForwardDelayHist(const MachineType t) const
Definition: Sequencer.hh:167

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