Go to the documentation of this file.
38 #include "debug/QOS.hh"
41 #include "params/QoSMemCtrl.hh"
45 #include <unordered_map>
49 #ifndef __MEM_QOS_MEM_CTRL_HH__
50 #define __MEM_QOS_MEM_CTRL_HH__
67 const std::unique_ptr<Policy>
policy;
88 std::unordered_map<RequestorID, const std::string>
requestors;
190 Addr addr, uint64_t entries,
double delay);
201 template<
typename Queues>
202 uint8_t
qosSchedule(std::initializer_list<Queues*> queues_ptr,
203 uint64_t queue_entry_size,
const PacketPtr pkt);
237 template<
typename Queues>
238 void escalate(std::initializer_list<Queues*> queues,
239 uint64_t queue_entry_size,
257 template<
typename Queues>
259 RequestorID id, uint8_t curr_prio, uint8_t tgt_prio);
267 MemCtrl(
const QoSMemCtrlParams*);
353 template<
typename Queues>
356 RequestorID id, uint8_t curr_prio, uint8_t tgt_prio)
358 auto it = queues[curr_prio].begin();
359 while (it != queues[curr_prio].end()) {
367 "QoSMemCtrl::escalate checking priority %d packet "
368 "id %d address %d\n", curr_prio,
369 pkt->requestorId(), pkt->getAddr());
372 if (pkt->requestorId() ==
id) {
374 uint64_t moved_entries =
divCeil(pkt->getSize(),
378 "QoSMemCtrl::escalate Requestor %s [id %d] moving "
379 "packet addr %d size %d (p size %d) from priority %d "
381 "this requestor packets %d (entries to move %d)\n",
384 queue_entry_size, curr_prio, tgt_prio,
390 "QoSMemCtrl::escalate requestor %s negative READ "
391 "packets for priority %d",
395 }
else if (pkt->isWrite()) {
397 "QoSMemCtrl::escalate requestor %s negative WRITE "
398 "packets for priority %d",
405 pkt->qosValue(tgt_prio);
406 queues[tgt_prio].push_back(pkt);
410 it = queues[curr_prio].erase(it);
412 "QoSMemCtrl::escalate requestor %s negative packets "
425 template<
typename Queues>
428 uint64_t queue_entry_size,
436 "QoSMemCtrl::escalate Requestor %s [id %d] to priority "
437 "%d (currently %d packets)\n",
requestors[
id],
id, tgt_prio,
440 for (uint8_t curr_prio = 0; curr_prio <
numPriorities(); ++curr_prio) {
442 if (curr_prio == tgt_prio)
448 "QoSMemCtrl::escalate MID %d checking priority %d "
449 "(packets %d)- current packets in prio %d: %d\n"
450 "\t(source read %d source write %d target read %d, "
451 "target write %d)\n",
459 for (
auto q : queues) {
461 curr_prio, tgt_prio);
467 "QoSMemCtrl::escalate Completed requestor %s [id %d] to priority "
468 "%d (now %d packets)\n\t(total read %d, total write %d)\n",
473 template<
typename Queues>
476 const uint64_t queue_entry_size,
480 uint8_t pkt_priority =
schedule(pkt);
493 uint8_t prio =
schedule(requestor.first, 0);
497 "QoSMemCtrl::qosSchedule: (syncro) escalating "
498 "REQUESTOR %s to assigned priority %d\n",
501 escalate(queues, queue_entry_size, requestor.first, prio);
508 "QoSMemCtrl::qosSchedule: escalating "
509 "REQUESTOR %s to assigned priority %d\n",
BusState getBusState() const
Gets the current bus state.
Stats::VectorStandardDeviation avgPriority
per-requestor average QoS priority
void escalate(std::initializer_list< Queues * > queues, uint64_t queue_entry_size, RequestorID id, uint8_t tgt_prio)
Escalates/demotes priority of all packets belonging to the passed requestor to given priority value.
std::unordered_map< RequestorID, std::unordered_map< uint64_t, std::deque< uint64_t > > > requestTimes
Hash of requestors - address of request - queue of times of request.
The QoS::MemCtrl is a base class for Memory objects which support QoS - it provides access to a set o...
void setCurrentBusState()
Set current bus direction (READ or WRITE) from next selected one.
QoS::MemCtrl::MemCtrlStats stats
uint8_t schedule(RequestorID id, uint64_t data)
void recordTurnaroundStats()
Record statistics on turnarounds based on busStateNext and busState values.
Stats::Vector priorityMaxLatency
per-priority maximum latency
const std::unique_ptr< Policy > policy
QoS Policy, assigns QoS priority to the incoming packets.
uint8_t numPriorities() const
Gets the total number of priority levels in the QoS memory controller.
uint64_t Tick
Tick count type.
RequestorID requestorId() const
A vector of scalar stats.
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
MemCtrl(const QoSMemCtrlParams *)
QoS Memory base class.
uint8_t qosSchedule(std::initializer_list< Queues * > queues_ptr, uint64_t queue_entry_size, const PacketPtr pkt)
Assign priority to a packet by executing the configured QoS policy.
This is a simple scalar statistic, like a counter.
void logResponse(BusState dir, RequestorID id, uint8_t qos, Addr addr, uint64_t entries, double delay)
Called upon receiving a response, updates statistics and updates queues status.
uint64_t totalWriteQueueSize
Total write request packets queue length in #packets.
const bool qosSyncroScheduler
Enables QoS synchronized scheduling invokes the QoS scheduler on all requestors, at every packet arri...
uint8_t qosValue() const
QoS Value getter Returns 0 if QoS value was never set (constructor default).
T divCeil(const T &a, const U &b)
void schedule(Event &event, Tick when)
void regStats() override
Callback to set stat parameters.
std::unordered_map< RequestorID, std::vector< uint64_t > > packetPriorities
Hash of requestors - number of packets queued per priority.
void logRequest(BusState dir, RequestorID id, uint8_t qos, Addr addr, uint64_t entries)
Called upon receiving a request or updates statistics and updates queues status.
const bool qosPriorityEscalation
Enables QoS priority escalation.
BusState busStateNext
bus state for next request event triggered
void addRequestor(const RequestorID id)
Initializes dynamically counters and statistics for a given Requestor.
System * _system
Pointer to the System object.
uint64_t totalReadQueueSize
Total read request packets queue length in #packets.
bool hasRequestor(RequestorID id) const
hasRequestor returns true if the selected requestor(ID) has been registered in the memory controller,...
Stats::Scalar numStayReadState
Count the number of times bus staying in READ state.
uint64_t getTotalReadQueueSize() const
Gets the total combined READ queues size.
uint64_t getReadQueueSize(const uint8_t prio) const
Gets a READ queue size.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Tick getServiceTick(const uint8_t prio) const
Gets the last service tick related to a QoS Priority.
Stats::Scalar numWriteReadTurnArounds
Count the number of turnarounds WRITE to READ.
std::vector< uint64_t > readQueueSizes
Read request packets queue length in #packets, per QoS priority.
Stats::VectorStandardDeviation avgPriorityDistance
per-requestor average QoS distance between assigned and queued values
Stats::Scalar numReadWriteTurnArounds
Count the number of turnarounds READ to WRITE.
Stats::Vector priorityMinLatency
per-priority minimum latency
const std::unique_ptr< TurnaroundPolicy > turnPolicy
QoS Bus Turnaround Policy: selects the bus direction (READ/WRITE)
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
std::vector< Tick > serviceTick
Vector of QoS priorities/last service time.
MemCtrlStats(MemCtrl &mc)
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
uint64_t getTotalWriteQueueSize() const
Gets the total combined WRITE queues size.
uint64_t getWriteQueueSize(const uint8_t prio) const
Gets a WRITE queue size.
std::string getRequestorName(RequestorID requestor_id)
Get the name of an object for a given request id.
System * system() const
read the system pointer
std::unordered_map< RequestorID, const std::string > requestors
Hash of requestor ID - requestor name.
Stats::Scalar numStayWriteState
Count the number of times bus staying in WRITE state.
const std::unique_ptr< QueuePolicy > queuePolicy
QoS Queue Policy: selects packet among same-priority queue.
This is a vector of StandardDeviation stats.
BusState busState
Bus state used to control the read/write switching and drive the scheduling of the next request.
BusState selectNextBusState()
Returns next bus direction (READ or WRITE) based on configured policy.
BusState getBusStateNext() const
Gets the next bus state.
void escalateQueues(Queues &queues, uint64_t queue_entry_size, RequestorID id, uint8_t curr_prio, uint8_t tgt_prio)
Escalates/demotes priority of all packets belonging to the passed requestor to given priority value i...
const uint8_t _numPriorities
Number of configured QoS priorities.
Tick curTick()
The current simulated tick.
std::vector< uint64_t > writeQueueSizes
Write request packets queue length in #packets, per QoS priority.
Generated on Wed Sep 30 2020 14:02:13 for gem5 by doxygen 1.8.17