Go to the documentation of this file.
38 #ifndef __MEM_QOS_MEM_CTRL_HH__
39 #define __MEM_QOS_MEM_CTRL_HH__
44 #include <unordered_map>
53 #include "debug/QOS.hh"
56 #include "params/QoSMemCtrl.hh"
73 class TurnaroundPolicy;
88 const std::unique_ptr<Policy>
policy;
109 std::unordered_map<RequestorID, const std::string>
requestors;
211 Addr addr, uint64_t entries,
double delay);
222 template<
typename Queues>
223 uint8_t
qosSchedule(std::initializer_list<Queues*> queues_ptr,
224 uint64_t queue_entry_size,
const PacketPtr pkt);
258 template<
typename Queues>
259 void escalate(std::initializer_list<Queues*> queues,
260 uint64_t queue_entry_size,
278 template<
typename Queues>
280 RequestorID id, uint8_t curr_prio, uint8_t tgt_prio);
288 MemCtrl(
const QoSMemCtrlParams &);
374 template<
typename Queues>
377 RequestorID id, uint8_t curr_prio, uint8_t tgt_prio)
379 auto it = queues[curr_prio].begin();
380 while (it != queues[curr_prio].end()) {
388 "qos::MemCtrl::escalateQueues checking priority %d packet "
389 "id %d address %d\n", curr_prio,
390 pkt->requestorId(), pkt->getAddr());
393 if (pkt->requestorId() ==
id) {
395 uint64_t moved_entries =
divCeil(pkt->getSize(),
399 "qos::MemCtrl::escalateQueues Requestor %s [id %d] moving "
400 "packet addr %d size %d (p size %d) from priority %d "
402 "this requestor packets %d (entries to move %d)\n",
405 queue_entry_size, curr_prio, tgt_prio,
411 "qos::MemCtrl::escalateQueues requestor %s negative "
412 "READ packets for priority %d",
416 }
else if (pkt->isWrite()) {
418 "qos::MemCtrl::escalateQueues requestor %s negative "
419 "WRITE packets for priority %d",
426 pkt->qosValue(tgt_prio);
427 queues[tgt_prio].push_back(pkt);
431 it = queues[curr_prio].erase(it);
433 "qos::MemCtrl::escalateQueues requestor %s negative "
434 "packets for priority %d",
446 template<
typename Queues>
449 uint64_t queue_entry_size,
457 "qos::MemCtrl::escalate Requestor %s [id %d] to priority "
458 "%d (currently %d packets)\n",
requestors[
id],
id, tgt_prio,
461 for (uint8_t curr_prio = 0; curr_prio <
numPriorities(); ++curr_prio) {
463 if (curr_prio == tgt_prio)
469 "qos::MemCtrl::escalate MID %d checking priority %d "
470 "(packets %d)- current packets in prio %d: %d\n"
471 "\t(source read %d source write %d target read %d, "
472 "target write %d)\n",
480 for (
auto q : queues) {
482 curr_prio, tgt_prio);
488 "qos::MemCtrl::escalate Completed requestor %s [id %d] to "
489 "priority %d (now %d packets)\n\t(total read %d, total write %d)"
494 template<
typename Queues>
497 const uint64_t queue_entry_size,
501 uint8_t pkt_priority =
schedule(pkt);
514 uint8_t prio =
schedule(requestor.first, 0);
518 "qos::MemCtrl::qosSchedule: (syncro) escalating "
519 "REQUESTOR %s to assigned priority %d\n",
522 escalate(queues, queue_entry_size, requestor.first, prio);
529 "qos::MemCtrl::qosSchedule: escalating "
530 "REQUESTOR %s to assigned priority %d\n",
This is a simple scalar statistic, like a counter.
Tick curTick()
The universal simulation clock.
uint64_t totalReadQueueSize
Total read request packets queue length in #packets.
const std::unique_ptr< QueuePolicy > queuePolicy
QoS Queue Policy: selects packet among same-priority queue.
statistics::Scalar numWriteReadTurnArounds
Count the number of turnarounds WRITE to READ.
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.
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.
const uint8_t _numPriorities
Number of configured QoS priorities.
statistics::VectorStandardDeviation avgPriorityDistance
per-requestor average QoS distance between assigned and queued values
void addRequestor(const RequestorID id)
Initializes dynamically counters and statistics for a given Requestor.
System * _system
Pointer to the System object.
uint8_t qosValue() const
QoS Value getter Returns 0 if QoS value was never set (constructor default).
statistics::Scalar numReadWriteTurnArounds
Count the number of turnarounds READ to WRITE.
std::vector< uint64_t > readQueueSizes
Read request packets queue length in #packets, per QoS priority.
statistics::Scalar numStayWriteState
Count the number of times bus staying in WRITE state.
A vector of scalar stats.
MemCtrl(const QoSMemCtrlParams &)
QoS Memory base class.
void schedule(Event &event, Tick when)
GEM5_DEPRECATED_NAMESPACE(QoS, qos)
uint64_t getReadQueueSize(const uint8_t prio) const
Gets a READ queue size.
std::vector< uint64_t > writeQueueSizes
Write request packets queue length in #packets, per QoS priority.
uint64_t getTotalWriteQueueSize() const
Gets the total combined WRITE queues size.
BusState busStateNext
bus state for next request event triggered
BusState busState
Bus state used to control the read/write switching and drive the scheduling of the next request.
bool hasRequestor(RequestorID id) const
hasRequestor returns true if the selected requestor(ID) has been registered in the memory controller,...
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.
const std::unique_ptr< TurnaroundPolicy > turnPolicy
QoS Bus Turnaround Policy: selects the bus direction (READ/WRITE)
uint8_t schedule(RequestorID id, uint64_t data)
This is a vector of StandardDeviation stats.
RequestorID requestorId() const
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.
BusState selectNextBusState()
Returns next bus direction (READ or WRITE) based on configured policy.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
uint64_t Tick
Tick count type.
std::string getRequestorName(RequestorID requestor_id)
Get the name of an object for a given request id.
gem5::memory::qos::MemCtrl::MemCtrlStats stats
System * system() const
read the system pointer
uint64_t totalWriteQueueSize
Total write request packets queue length in #packets.
uint64_t getWriteQueueSize(const uint8_t prio) const
Gets a WRITE queue size.
const bool qosPriorityEscalation
Enables QoS priority escalation.
statistics::VectorStandardDeviation avgPriority
per-requestor average QoS priority
const bool qosSyncroScheduler
Enables QoS synchronized scheduling invokes the QoS scheduler on all requestors, at every packet arri...
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
static constexpr T divCeil(const T &a, const U &b)
void regStats() override
Callback to set stat parameters.
#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.
uint64_t getTotalReadQueueSize() const
Gets the total combined READ queues size.
BusState getBusStateNext() const
Gets the next bus state.
const std::unique_ptr< Policy > policy
QoS Policy, assigns QoS priority to the incoming packets.
BusState getBusState() const
Gets the current bus state.
std::unordered_map< RequestorID, std::vector< uint64_t > > packetPriorities
Hash of requestors - number of packets queued per priority.
uint8_t numPriorities() const
Gets the total number of priority levels in the QoS memory controller.
statistics::Vector priorityMinLatency
per-priority minimum latency
void recordTurnaroundStats()
Record statistics on turnarounds based on busStateNext and busState values.
MemCtrlStats(MemCtrl &mc)
Tick getServiceTick(const uint8_t prio) const
Gets the last service tick related to a QoS Priority.
void setCurrentBusState()
Set current bus direction (READ or WRITE) from next selected one.
The qos::MemCtrl is a base class for Memory objects which support QoS - it provides access to a set o...
std::unordered_map< RequestorID, const std::string > requestors
Hash of requestor ID - requestor name.
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
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.
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...
statistics::Scalar numStayReadState
Count the number of times bus staying in READ state.
statistics::Vector priorityMaxLatency
per-priority maximum latency
Generated on Wed May 4 2022 12:14:00 for gem5 by doxygen 1.8.17