gem5 [DEVELOP-FOR-25.0]
Loading...
Searching...
No Matches
Sequencer.hh
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019-2021 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
50#include "mem/ruby/protocol/MachineType.hh"
51#include "mem/ruby/protocol/RubyRequestType.hh"
52#include "mem/ruby/protocol/SequencerRequestType.hh"
55#include "params/RubySequencer.hh"
56
57namespace gem5
58{
59
60namespace ruby
61{
62
64{
66 RubyRequestType m_type;
67 RubyRequestType m_second_type;
69 SequencerRequest(PacketPtr _pkt, RubyRequestType _m_type,
70 RubyRequestType _m_second_type, Cycles _issue_time)
71 : pkt(_pkt), m_type(_m_type), m_second_type(_m_second_type),
72 issue_time(_issue_time)
73 {}
74
75 bool functionalWrite(Packet *func_pkt) const
76 {
77 // Follow-up on RubyRequest::functionalWrite
78 // This makes sure the hitCallback won't overrite the value we
79 // expect to find
80 assert(func_pkt->isWrite());
81 return func_pkt->trySatisfyFunctional(pkt);
82 }
83};
84
85class Sequencer : public RubyPort
86{
87 public:
88 typedef RubySequencerParams Params;
89 Sequencer(const Params &);
90 ~Sequencer();
91
96 void writeCallbackScFail(Addr address,
98
99 // Public Methods
100 virtual void wakeup(); // Used only for deadlock detection
101 void resetStats() override;
103
104 void writeCallback(Addr address,
106 const bool externalHit = false,
107 const MachineType mach = MachineType_NUM,
108 const Cycles initialRequestTime = Cycles(0),
109 const Cycles forwardRequestTime = Cycles(0),
110 const Cycles firstResponseTime = Cycles(0),
111 const bool noCoales = false);
112
113 // Write callback that prevents coalescing
115 {
116 writeCallback(address, data, true, MachineType_NUM, Cycles(0),
117 Cycles(0), Cycles(0), true);
118 }
119
120 void readCallback(Addr address,
122 const bool externalHit = false,
123 const MachineType mach = MachineType_NUM,
124 const Cycles initialRequestTime = Cycles(0),
125 const Cycles forwardRequestTime = Cycles(0),
126 const Cycles firstResponseTime = Cycles(0));
127
128 void atomicCallback(Addr address,
130 const bool externalHit = false,
131 const MachineType mach = MachineType_NUM,
132 const Cycles initialRequestTime = Cycles(0),
133 const Cycles forwardRequestTime = Cycles(0),
134 const Cycles firstResponseTime = Cycles(0));
135
136 void unaddressedCallback(Addr unaddressedReqId,
137 RubyRequestType requestType,
138 const MachineType mach = MachineType_NUM,
139 const Cycles initialRequestTime = Cycles(0),
140 const Cycles forwardRequestTime = Cycles(0),
141 const Cycles firstResponseTime = Cycles(0));
142
144 void invL1Callback();
145 void invL1();
146
147 RequestStatus makeRequest(PacketPtr pkt) override;
148 virtual bool empty() const;
149 int outstandingCount() const override { return m_outstanding_count; }
150
151 bool isDeadlockEventScheduled() const override
152 { return deadlockCheckEvent.scheduled(); }
153
156
157 virtual void print(std::ostream& out) const;
158
159 void markRemoved();
160 void evictionCallback(Addr address);
161 int coreId() const { return m_coreId; }
162
163 virtual int functionalWrite(Packet *func_pkt) override;
164
165 void recordRequestType(SequencerRequestType requestType);
167
171
175
178
181
186
189
191 getMissTypeMachLatencyHist(uint32_t r, uint32_t t) const
192 { return *m_missTypeMachLatencyHist[r][t]; }
193
196
198 getInitialToForwardDelayHist(const MachineType t) const
199 { return *m_InitialToForwardDelayHist[t]; }
200
204
208
209 statistics::Counter getIncompleteTimes(const MachineType t) const
210 { return m_IncompleteTimes[t]; }
211
212 protected:
213 void issueRequest(PacketPtr pkt, RubyRequestType type);
214 virtual void hitCallback(SequencerRequest* srequest, DataBlock& data,
215 bool llscSuccess,
216 const MachineType mach, const bool externalHit,
217 const Cycles initialRequestTime,
218 const Cycles forwardRequestTime,
219 const Cycles firstResponseTime,
220 const bool was_coalesced);
221
222 virtual bool processReadCallback(SequencerRequest &seq_req,
224 const bool rubyRequest,
225 bool externalHit,
226 const MachineType mach,
227 Cycles initialRequestTime,
228 Cycles forwardRequestTime,
229 Cycles firstResponseTime);
230
231 void recordMissLatency(SequencerRequest* srequest, bool llscSuccess,
232 const MachineType respondingMach,
233 bool isExternalHit, Cycles initialRequestTime,
234 Cycles forwardRequestTime,
235 Cycles firstResponseTime);
236
237 private:
238 // Private copy constructor and assignment operator
239 Sequencer(const Sequencer& obj);
241
242 protected:
243 // RequestTable contains both read and write requests, handles aliasing
244 std::unordered_map<Addr, std::list<SequencerRequest>> m_RequestTable;
245 // UnadressedRequestTable contains "unaddressed" requests,
246 // guaranteed not to alias each other
247 std::unordered_map<uint64_t, SequencerRequest> m_UnaddressedRequestTable;
248
250
251 virtual RequestStatus insertRequest(PacketPtr pkt,
252 RubyRequestType primary_type,
253 RubyRequestType secondary_type);
254
256
257 private:
259
261
263
265
266 // The cache access latency for top-level caches (L0/L1). These are
267 // currently assessed at the beginning of each memory access through the
268 // sequencer.
269 // TODO: Migrate these latencies into top-level cache controllers.
272
273 // Global outstanding request count, across all request tables
276
278
280
282
285
289
294
299
304
310
317
319
320 // support for LL/SC
321
326 void llscLoadLinked(const Addr);
327
332 void llscClearMonitor(const Addr);
333
342 bool llscStoreConditional(const Addr);
343
344
349
354 uint64_t getCurrentUnaddressedTransactionID() const;
355
356 public:
363 bool llscCheckMonitor(const Addr);
364
365
371};
372
373inline std::ostream&
374operator<<(std::ostream& out, const Sequencer& obj)
375{
376 obj.print(out);
377 out << std::flush;
378 return out;
379}
380
381} // namespace ruby
382} // namespace gem5
383
384#endif // __MEM_RUBY_SYSTEM_SEQUENCER_HH__
const char data[]
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
bool isWrite() const
Definition packet.hh:594
bool trySatisfyFunctional(PacketPtr other)
Check a functional request against a memory value stored in another packet (i.e.
Definition packet.hh:1399
RubyPort(const Params &p)
Definition RubyPort.cc:61
statistics::Histogram m_outstandReqHist
Histogram for number of outstanding requests per cycle.
Definition Sequencer.hh:284
void resetStats() override
Callback to reset stats.
Definition Sequencer.cc:281
statistics::Histogram & getLatencyHist()
Definition Sequencer.hh:168
Sequencer(const Sequencer &obj)
std::unordered_map< Addr, std::list< SequencerRequest > > m_RequestTable
Definition Sequencer.hh:244
int outstandingCount() const override
Definition Sequencer.hh:149
virtual bool empty() const
Definition Sequencer.cc:933
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), const bool noCoales=false)
Definition Sequencer.cc:464
statistics::Histogram & getMissTypeLatencyHist(uint32_t t)
Definition Sequencer.hh:184
std::vector< statistics::Counter > m_IncompleteTimes
Definition Sequencer.hh:316
bool llscCheckMonitor(const Addr)
Searches for cache line address in the global monitor tagged with this Sequencer object's version id.
Definition Sequencer.cc:207
virtual int functionalWrite(Packet *func_pkt) override
Definition Sequencer.cc:264
std::vector< statistics::Histogram * > m_InitialToForwardDelayHist
Definition Sequencer.hh:313
RubySystem * m_ruby_system
Definition Sequencer.hh:255
statistics::Histogram & getMissMachLatencyHist(uint32_t t) const
Definition Sequencer.hh:187
std::vector< statistics::Histogram * > m_hitMachLatencyHist
Histograms for profiling the latencies for requests that did not required external messages.
Definition Sequencer.hh:297
void recordMissLatency(SequencerRequest *srequest, bool llscSuccess, const MachineType respondingMach, bool isExternalHit, Cycles initialRequestTime, Cycles forwardRequestTime, Cycles firstResponseTime)
Definition Sequencer.cc:391
void completeHitCallback(std::vector< PacketPtr > &list)
Definition Sequencer.cc:851
std::vector< statistics::Histogram * > m_typeLatencyHist
Definition Sequencer.hh:288
PacketPtr m_cache_inv_pkt
Definition Sequencer.hh:262
void atomicCallback(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:640
bool isDeadlockEventScheduled() const override
Definition Sequencer.hh:151
void writeCallbackScFail(Addr address, DataBlock &data)
Proxy function to writeCallback that first invalidates the line address in the local monitor.
Definition Sequencer.cc:457
statistics::Histogram & getHitTypeMachLatencyHist(uint32_t r, uint32_t t)
Definition Sequencer.hh:179
CacheMemory * m_dataCache_ptr
Definition Sequencer.hh:264
std::vector< statistics::Histogram * > m_FirstResponseToCompletionDelayHist
Definition Sequencer.hh:315
void incrementUnaddressedTransactionCnt()
Increment the unaddressed transaction counter.
statistics::Histogram & getTypeLatencyHist(uint32_t t)
Definition Sequencer.hh:169
virtual void hitCallback(SequencerRequest *srequest, DataBlock &data, bool llscSuccess, const MachineType mach, const bool externalHit, const Cycles initialRequestTime, const Cycles forwardRequestTime, const Cycles firstResponseTime, const bool was_coalesced)
Definition Sequencer.cc:696
statistics::Counter getIncompleteTimes(const MachineType t) const
Definition Sequencer.hh:209
void llscLoadLinked(const Addr)
Places the cache line address into the global monitor tagged with this Sequencer object's version id.
Definition Sequencer.cc:157
uint64_t getCurrentUnaddressedTransactionID() const
Generate the current unaddressed transaction ID based on the counter and the Sequencer object's versi...
Sequencer(const Params &)
Definition Sequencer.cc:70
statistics::Histogram m_latencyHist
Histogram for holding latency profile of all requests.
Definition Sequencer.hh:287
statistics::Histogram & getHitMachLatencyHist(uint32_t t)
Definition Sequencer.hh:176
void issueRequest(PacketPtr pkt, RubyRequestType type)
bool llscStoreConditional(const Addr)
Searches for cache line address in the global monitor tagged with this Sequencer object's version id.
Definition Sequencer.cc:184
statistics::Histogram & getIssueToInitialDelayHist(uint32_t t) const
Definition Sequencer.hh:194
statistics::Histogram & getInitialToForwardDelayHist(const MachineType t) const
Definition Sequencer.hh:198
void unaddressedCallback(Addr unaddressedReqId, RubyRequestType requestType, const MachineType mach=MachineType_NUM, const Cycles initialRequestTime=Cycles(0), const Cycles forwardRequestTime=Cycles(0), const Cycles firstResponseTime=Cycles(0))
Definition Sequencer.cc:801
virtual RequestStatus insertRequest(PacketPtr pkt, RubyRequestType primary_type, RubyRequestType secondary_type)
Definition Sequencer.cc:313
Sequencer & operator=(const Sequencer &obj)
EventFunctionWrapper deadlockCheckEvent
Definition Sequencer.hh:318
std::unordered_map< uint64_t, SequencerRequest > m_UnaddressedRequestTable
Definition Sequencer.hh:247
uint64_t m_unaddressedTransactionCnt
Definition Sequencer.hh:279
std::vector< statistics::Histogram * > m_hitTypeLatencyHist
Definition Sequencer.hh:293
statistics::Histogram m_hitLatencyHist
Histogram for holding latency profile of all requests that hit in the controller connected to this se...
Definition Sequencer.hh:292
RequestStatus makeRequest(PacketPtr pkt) override
Definition Sequencer.cc:940
statistics::Histogram & getMissTypeMachLatencyHist(uint32_t r, uint32_t t) const
Definition Sequencer.hh:191
void descheduleDeadlockEvent() override
Definition Sequencer.hh:154
Cycles m_data_cache_hit_latency
Definition Sequencer.hh:270
statistics::Histogram & getFirstResponseToCompletionDelayHist(const MachineType t) const
Definition Sequencer.hh:206
void llscClearLocalMonitor()
Removes all addresses from the local monitor.
Definition Sequencer.cc:223
void recordRequestType(SequencerRequestType requestType)
std::vector< statistics::Histogram * > m_IssueToInitialDelayHist
Histograms for recording the breakdown of miss latency.
Definition Sequencer.hh:312
virtual void print(std::ostream &out) const
statistics::Histogram & getOutstandReqHist()
Definition Sequencer.hh:166
statistics::Histogram & getHitLatencyHist()
Definition Sequencer.hh:172
virtual bool processReadCallback(SequencerRequest &seq_req, DataBlock &data, const bool rubyRequest, bool externalHit, const MachineType mach, Cycles initialRequestTime, Cycles forwardRequestTime, Cycles firstResponseTime)
Definition Sequencer.cc:568
statistics::Histogram & getHitTypeLatencyHist(uint32_t t)
Definition Sequencer.hh:173
RubySequencerParams Params
Definition Sequencer.hh:88
std::vector< std::vector< statistics::Histogram * > > m_hitTypeMachLatencyHist
Definition Sequencer.hh:298
statistics::Histogram & getMissLatencyHist()
Definition Sequencer.hh:182
void llscClearMonitor(const Addr)
Removes the cache line address from the global monitor.
Definition Sequencer.cc:170
void writeUniqueCallback(Addr address, DataBlock &data)
Definition Sequencer.hh:114
Cycles m_inst_cache_hit_latency
Definition Sequencer.hh:271
virtual void wakeup()
Definition Sequencer.cc:229
void evictionCallback(Addr address)
std::vector< statistics::Histogram * > m_ForwardToFirstResponseDelayHist
Definition Sequencer.hh:314
statistics::Histogram & getForwardRequestToFirstResponseHist(const MachineType t) const
Definition Sequencer.hh:202
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:595
std::vector< statistics::Histogram * > m_missMachLatencyHist
Histograms for profiling the latencies for requests that required external messages.
Definition Sequencer.hh:307
std::vector< statistics::Histogram * > m_missTypeLatencyHist
Definition Sequencer.hh:303
statistics::Histogram m_missLatencyHist
Histogram for holding latency profile of all requests that miss in the controller connected to this s...
Definition Sequencer.hh:302
std::vector< std::vector< statistics::Histogram * > > m_missTypeMachLatencyHist
Definition Sequencer.hh:309
A simple histogram stat.
STL list class.
Definition stl.hh:51
STL vector class.
Definition stl.hh:37
void deschedule(Event &event)
Definition eventq.hh:1021
Bitfield< 5 > t
Definition misc_types.hh:71
std::ostream & operator<<(std::ostream &os, const BoolVec &myvector)
Definition BoolVec.cc:49
double Counter
All counters are of 64-bit values.
Definition types.hh:46
Copyright (c) 2024 Arm Limited All rights reserved.
Definition binary32.hh:36
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition types.hh:147
Packet * PacketPtr
SequencerRequest(PacketPtr _pkt, RubyRequestType _m_type, RubyRequestType _m_second_type, Cycles _issue_time)
Definition Sequencer.hh:69
RubyRequestType m_second_type
Definition Sequencer.hh:67
bool functionalWrite(Packet *func_pkt) const
Definition Sequencer.hh:75

Generated on Mon May 26 2025 09:19:12 for gem5 by doxygen 1.13.2