gem5 v24.0.0.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
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
56namespace gem5
57{
58
59namespace ruby
60{
61
63{
65 RubyRequestType m_type;
66 RubyRequestType m_second_type;
68 SequencerRequest(PacketPtr _pkt, RubyRequestType _m_type,
69 RubyRequestType _m_second_type, Cycles _issue_time)
70 : pkt(_pkt), m_type(_m_type), m_second_type(_m_second_type),
71 issue_time(_issue_time)
72 {}
73
74 bool functionalWrite(Packet *func_pkt) const
75 {
76 // Follow-up on RubyRequest::functionalWrite
77 // This makes sure the hitCallback won't overrite the value we
78 // expect to find
79 assert(func_pkt->isWrite());
80 return func_pkt->trySatisfyFunctional(pkt);
81 }
82};
83
84std::ostream& operator<<(std::ostream& out, const SequencerRequest& obj);
85
86class Sequencer : public RubyPort
87{
88 public:
89 typedef RubySequencerParams Params;
90 Sequencer(const Params &);
91 ~Sequencer();
92
97 void writeCallbackScFail(Addr address,
99
100 // Public Methods
101 virtual void wakeup(); // Used only for deadlock detection
102 void resetStats() override;
104
105 void writeCallback(Addr address,
107 const bool externalHit = false,
108 const MachineType mach = MachineType_NUM,
109 const Cycles initialRequestTime = Cycles(0),
110 const Cycles forwardRequestTime = Cycles(0),
111 const Cycles firstResponseTime = Cycles(0),
112 const bool noCoales = false);
113
114 // Write callback that prevents coalescing
116 {
117 writeCallback(address, data, true, MachineType_NUM, Cycles(0),
118 Cycles(0), Cycles(0), true);
119 }
120
121 void readCallback(Addr address,
123 const bool externalHit = false,
124 const MachineType mach = MachineType_NUM,
125 const Cycles initialRequestTime = Cycles(0),
126 const Cycles forwardRequestTime = Cycles(0),
127 const Cycles firstResponseTime = Cycles(0));
128
129 void atomicCallback(Addr address,
131 const bool externalHit = false,
132 const MachineType mach = MachineType_NUM,
133 const Cycles initialRequestTime = Cycles(0),
134 const Cycles forwardRequestTime = Cycles(0),
135 const Cycles firstResponseTime = Cycles(0));
136
137 void unaddressedCallback(Addr unaddressedReqId,
138 RubyRequestType requestType,
139 const MachineType mach = MachineType_NUM,
140 const Cycles initialRequestTime = Cycles(0),
141 const Cycles forwardRequestTime = Cycles(0),
142 const Cycles firstResponseTime = Cycles(0));
143
145 void invL1Callback();
146 void invL1();
147
148 RequestStatus makeRequest(PacketPtr pkt) override;
149 virtual bool empty() const;
150 int outstandingCount() const override { return m_outstanding_count; }
151
152 bool isDeadlockEventScheduled() const override
153 { return deadlockCheckEvent.scheduled(); }
154
157
158 virtual void print(std::ostream& out) const;
159
160 void markRemoved();
161 void evictionCallback(Addr address);
162 int coreId() const { return m_coreId; }
163
164 virtual int functionalWrite(Packet *func_pkt) override;
165
166 void recordRequestType(SequencerRequestType requestType);
168
172
176
179
182
187
190
192 getMissTypeMachLatencyHist(uint32_t r, uint32_t t) const
193 { return *m_missTypeMachLatencyHist[r][t]; }
194
197
199 getInitialToForwardDelayHist(const MachineType t) const
200 { return *m_InitialToForwardDelayHist[t]; }
201
205
209
210 statistics::Counter getIncompleteTimes(const MachineType t) const
211 { return m_IncompleteTimes[t]; }
212
213 private:
214 void issueRequest(PacketPtr pkt, RubyRequestType type);
215
217 bool llscSuccess,
218 const MachineType mach, const bool externalHit,
219 const Cycles initialRequestTime,
220 const Cycles forwardRequestTime,
221 const Cycles firstResponseTime,
222 const bool was_coalesced);
223
224 void recordMissLatency(SequencerRequest* srequest, bool llscSuccess,
225 const MachineType respondingMach,
226 bool isExternalHit, Cycles initialRequestTime,
227 Cycles forwardRequestTime,
228 Cycles firstResponseTime);
229
230 // Private copy constructor and assignment operator
231 Sequencer(const Sequencer& obj);
233
234 protected:
235 // RequestTable contains both read and write requests, handles aliasing
236 std::unordered_map<Addr, std::list<SequencerRequest>> m_RequestTable;
237 // UnadressedRequestTable contains "unaddressed" requests,
238 // guaranteed not to alias each other
239 std::unordered_map<uint64_t, SequencerRequest> m_UnaddressedRequestTable;
240
242
243 virtual RequestStatus insertRequest(PacketPtr pkt,
244 RubyRequestType primary_type,
245 RubyRequestType secondary_type);
246
247 private:
249
251
253
255
256 // The cache access latency for top-level caches (L0/L1). These are
257 // currently assessed at the beginning of each memory access through the
258 // sequencer.
259 // TODO: Migrate these latencies into top-level cache controllers.
262
263 // Global outstanding request count, across all request tables
266
268
270
272
275
279
284
289
294
300
307
309
310 // support for LL/SC
311
316 void llscLoadLinked(const Addr);
317
322 void llscClearMonitor(const Addr);
323
332 bool llscStoreConditional(const Addr);
333
334
339
344 uint64_t getCurrentUnaddressedTransactionID() const;
345
346 public:
353 bool llscCheckMonitor(const Addr);
354
355
361};
362
363inline std::ostream&
364operator<<(std::ostream& out, const Sequencer& obj)
365{
366 obj.print(out);
367 out << std::flush;
368 return out;
369}
370
371} // namespace ruby
372} // namespace gem5
373
374#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
statistics::Histogram m_outstandReqHist
Histogram for number of outstanding requests per cycle.
Definition Sequencer.hh:274
void resetStats() override
Callback to reset stats.
Definition Sequencer.cc:276
statistics::Histogram & getLatencyHist()
Definition Sequencer.hh:169
Sequencer(const Sequencer &obj)
std::unordered_map< Addr, std::list< SequencerRequest > > m_RequestTable
Definition Sequencer.hh:236
int outstandingCount() const override
Definition Sequencer.hh:150
virtual bool empty() const
Definition Sequencer.cc:907
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:459
statistics::Histogram & getMissTypeLatencyHist(uint32_t t)
Definition Sequencer.hh:185
std::vector< statistics::Counter > m_IncompleteTimes
Definition Sequencer.hh:306
bool llscCheckMonitor(const Addr)
Searches for cache line address in the global monitor tagged with this Sequencer object's version id.
Definition Sequencer.cc:205
virtual int functionalWrite(Packet *func_pkt) override
Definition Sequencer.cc:262
std::vector< statistics::Histogram * > m_InitialToForwardDelayHist
Definition Sequencer.hh:303
statistics::Histogram & getMissMachLatencyHist(uint32_t t) const
Definition Sequencer.hh:188
std::vector< statistics::Histogram * > m_hitMachLatencyHist
Histograms for profiling the latencies for requests that did not required external messages.
Definition Sequencer.hh:287
void recordMissLatency(SequencerRequest *srequest, bool llscSuccess, const MachineType respondingMach, bool isExternalHit, Cycles initialRequestTime, Cycles forwardRequestTime, Cycles firstResponseTime)
Definition Sequencer.cc:386
void completeHitCallback(std::vector< PacketPtr > &list)
Definition Sequencer.cc:827
std::vector< statistics::Histogram * > m_typeLatencyHist
Definition Sequencer.hh:278
PacketPtr m_cache_inv_pkt
Definition Sequencer.hh:252
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:616
bool isDeadlockEventScheduled() const override
Definition Sequencer.hh:152
void writeCallbackScFail(Addr address, DataBlock &data)
Proxy function to writeCallback that first invalidates the line address in the local monitor.
Definition Sequencer.cc:452
statistics::Histogram & getHitTypeMachLatencyHist(uint32_t r, uint32_t t)
Definition Sequencer.hh:180
CacheMemory * m_dataCache_ptr
Definition Sequencer.hh:254
std::vector< statistics::Histogram * > m_FirstResponseToCompletionDelayHist
Definition Sequencer.hh:305
void incrementUnaddressedTransactionCnt()
Increment the unaddressed transaction counter.
statistics::Histogram & getTypeLatencyHist(uint32_t t)
Definition Sequencer.hh:170
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:672
statistics::Counter getIncompleteTimes(const MachineType t) const
Definition Sequencer.hh:210
void llscLoadLinked(const Addr)
Places the cache line address into the global monitor tagged with this Sequencer object's version id.
Definition Sequencer.cc:155
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:277
statistics::Histogram & getHitMachLatencyHist(uint32_t t)
Definition Sequencer.hh:177
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:182
statistics::Histogram & getIssueToInitialDelayHist(uint32_t t) const
Definition Sequencer.hh:195
statistics::Histogram & getInitialToForwardDelayHist(const MachineType t) const
Definition Sequencer.hh:199
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:777
virtual RequestStatus insertRequest(PacketPtr pkt, RubyRequestType primary_type, RubyRequestType secondary_type)
Definition Sequencer.cc:308
Sequencer & operator=(const Sequencer &obj)
EventFunctionWrapper deadlockCheckEvent
Definition Sequencer.hh:308
std::unordered_map< uint64_t, SequencerRequest > m_UnaddressedRequestTable
Definition Sequencer.hh:239
uint64_t m_unaddressedTransactionCnt
Definition Sequencer.hh:269
std::vector< statistics::Histogram * > m_hitTypeLatencyHist
Definition Sequencer.hh:283
statistics::Histogram m_hitLatencyHist
Histogram for holding latency profile of all requests that hit in the controller connected to this se...
Definition Sequencer.hh:282
RequestStatus makeRequest(PacketPtr pkt) override
Definition Sequencer.cc:914
statistics::Histogram & getMissTypeMachLatencyHist(uint32_t r, uint32_t t) const
Definition Sequencer.hh:192
void descheduleDeadlockEvent() override
Definition Sequencer.hh:155
Cycles m_data_cache_hit_latency
Definition Sequencer.hh:260
statistics::Histogram & getFirstResponseToCompletionDelayHist(const MachineType t) const
Definition Sequencer.hh:207
void llscClearLocalMonitor()
Removes all addresses from the local monitor.
Definition Sequencer.cc:221
void recordRequestType(SequencerRequestType requestType)
std::vector< statistics::Histogram * > m_IssueToInitialDelayHist
Histograms for recording the breakdown of miss latency.
Definition Sequencer.hh:302
virtual void print(std::ostream &out) const
statistics::Histogram & getOutstandReqHist()
Definition Sequencer.hh:167
statistics::Histogram & getHitLatencyHist()
Definition Sequencer.hh:173
statistics::Histogram & getHitTypeLatencyHist(uint32_t t)
Definition Sequencer.hh:174
RubySequencerParams Params
Definition Sequencer.hh:89
std::vector< std::vector< statistics::Histogram * > > m_hitTypeMachLatencyHist
Definition Sequencer.hh:288
statistics::Histogram & getMissLatencyHist()
Definition Sequencer.hh:183
void llscClearMonitor(const Addr)
Removes the cache line address from the global monitor.
Definition Sequencer.cc:168
void writeUniqueCallback(Addr address, DataBlock &data)
Definition Sequencer.hh:115
Cycles m_inst_cache_hit_latency
Definition Sequencer.hh:261
virtual void wakeup()
Definition Sequencer.cc:227
void evictionCallback(Addr address)
std::vector< statistics::Histogram * > m_ForwardToFirstResponseDelayHist
Definition Sequencer.hh:304
statistics::Histogram & getForwardRequestToFirstResponseHist(const MachineType t) const
Definition Sequencer.hh:203
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:563
std::vector< statistics::Histogram * > m_missMachLatencyHist
Histograms for profiling the latencies for requests that required external messages.
Definition Sequencer.hh:297
std::vector< statistics::Histogram * > m_missTypeLatencyHist
Definition Sequencer.hh:293
statistics::Histogram m_missLatencyHist
Histogram for holding latency profile of all requests that miss in the controller connected to this s...
Definition Sequencer.hh:292
std::vector< std::vector< statistics::Histogram * > > m_missTypeMachLatencyHist
Definition Sequencer.hh:299
A simple histogram stat.
STL vector class.
Definition stl.hh:37
void deschedule(Event &event)
Definition eventq.hh:1021
bool scheduled() const
Determine if the current event is scheduled.
Definition eventq.hh:458
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 - Pranith Kumar Copyright (c) 2020 Inria 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
SequencerRequest(PacketPtr _pkt, RubyRequestType _m_type, RubyRequestType _m_second_type, Cycles _issue_time)
Definition Sequencer.hh:68
RubyRequestType m_second_type
Definition Sequencer.hh:66
bool functionalWrite(Packet *func_pkt) const
Definition Sequencer.hh:74

Generated on Tue Jun 18 2024 16:24:05 for gem5 by doxygen 1.11.0