Shivani Parekh has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/33535 )
Change subject: mem: Update masterId and master/slave variables in MemCtrl
obj
......................................................................
mem: Update masterId and master/slave variables in MemCtrl obj
Change-Id: If57b3a5c8dab3d96d7297d48d3466f3f2aa436f9
---
M src/mem/mem_master.hh
M src/mem/qos/mem_ctrl.cc
M src/mem/qos/mem_ctrl.hh
3 files changed, 98 insertions(+), 98 deletions(-)
diff --git a/src/mem/mem_master.hh b/src/mem/mem_master.hh
index 468cd11..64c73d7 100644
--- a/src/mem/mem_master.hh
+++ b/src/mem/mem_master.hh
@@ -47,24 +47,24 @@
#include "sim/sim_object.hh"
/**
- * The MasterInfo class contains data about a specific master.
+ * The MasterInfo class contains data about a specific requestor.
*/
struct MasterInfo
{
MasterInfo(const SimObject* _obj,
- std::string master_name,
- MasterID master_id)
- : obj(_obj), masterName(master_name), masterId(master_id)
+ std::string requestor_name,
+ MasterID unique_id)
+ : obj(_obj), req_name(requestor_name), _id(unique_id)
{}
- /** SimObject related to the Master */
+ /** SimObject related to the Requestor */
const SimObject* obj;
- /** Master Name */
- std::string masterName;
+ /** Requestor Name */
+ std::string req_name;
- /** Master ID */
- MasterID masterId;
+ /** Unique id */
+ MasterID _id;
};
#endif // __MEM_MEM_MASTER_HH__
diff --git a/src/mem/qos/mem_ctrl.cc b/src/mem/qos/mem_ctrl.cc
index e8d1ce0..a38de58 100644
--- a/src/mem/qos/mem_ctrl.cc
+++ b/src/mem/qos/mem_ctrl.cc
@@ -83,18 +83,18 @@
}
void
-MemCtrl::logRequest(BusState dir, MasterID m_id, uint8_t qos,
+MemCtrl::logRequest(BusState dir, MasterID id, uint8_t qos,
Addr addr, uint64_t entries)
{
// If needed, initialize all counters and statistics
- // for this master
- addMaster(m_id);
+ // for this requestor
+ addMaster(id);
DPRINTF(QOS,
"QoSMemCtrl::logRequest REQUESTOR %s [id %d] address %d"
" prio %d this requestor q packets %d"
" - queue size %d - requested entries %d\n",
- masters[m_id], m_id, addr, qos, packetPriorities[m_id][qos],
+ requestors[id], id, addr, qos, packetPriorities[id][qos],
(dir == READ) ? readQueueSizes[qos]: writeQueueSizes[qos],
entries);
@@ -106,28 +106,28 @@
totalWriteQueueSize += entries;
}
- packetPriorities[m_id][qos] += entries;
+ packetPriorities[id][qos] += entries;
for (auto j = 0; j < entries; ++j) {
- requestTimes[m_id][addr].push_back(curTick());
+ requestTimes[id][addr].push_back(curTick());
}
// Record statistics
- stats.avgPriority[m_id].sample(qos);
+ stats.avgPriority[id].sample(qos);
// Compute avg priority distance
- for (uint8_t i = 0; i < packetPriorities[m_id].size(); ++i) {
+ for (uint8_t i = 0; i < packetPriorities[id].size(); ++i) {
uint8_t distance =
- (abs(int(qos) - int(i))) * packetPriorities[m_id][i];
+ (abs(int(qos) - int(i))) * packetPriorities[id][i];
if (distance > 0) {
- stats.avgPriorityDistance[m_id].sample(distance);
+ stats.avgPriorityDistance[id].sample(distance);
DPRINTF(QOS,
"QoSMemCtrl::logRequest REQUESTOR %s [id %d]"
" registering priority distance %d for priority %d"
" (packets %d)\n",
- masters[m_id], m_id, distance, i,
- packetPriorities[m_id][i]);
+ requestors[id], id, distance, i,
+ packetPriorities[id][i]);
}
}
@@ -140,17 +140,17 @@
}
void
-MemCtrl::logResponse(BusState dir, MasterID m_id, uint8_t qos,
+MemCtrl::logResponse(BusState dir, MasterID id, uint8_t qos,
Addr addr, uint64_t entries, double delay)
{
- panic_if(!hasMaster(m_id),
- "Logging response with invalid master\n");
+ panic_if(!hasMaster(id),
+ "Logging response with invalid requestor\n");
DPRINTF(QOS,
"QoSMemCtrl::logResponse REQUESTOR %s [id %d] address %d prio"
" %d this requestor q packets %d"
" - queue size %d - requested entries %d\n",
- masters[m_id], m_id, addr, qos, packetPriorities[m_id][qos],
+ requestors[id], id, addr, qos, packetPriorities[id][qos],
(dir == READ) ? readQueueSizes[qos]: writeQueueSizes[qos],
entries);
@@ -162,17 +162,17 @@
totalWriteQueueSize -= entries;
}
- panic_if(packetPriorities[m_id][qos] == 0,
- "QoSMemCtrl::logResponse master %s negative packets for
priority"
- " %d", masters[m_id], qos);
+ panic_if(packetPriorities[id][qos] == 0,
+ "QoSMemCtrl::logResponse requestor %s negative packets "
+ "for priority %d", requestors[id], qos);
- packetPriorities[m_id][qos] -= entries;
+ packetPriorities[id][qos] -= entries;
for (auto j = 0; j < entries; ++j) {
- auto it = requestTimes[m_id].find(addr);
- panic_if(it == requestTimes[m_id].end(),
- "QoSMemCtrl::logResponse master %s unmatched response for"
- " address %d received", masters[m_id], addr);
+ auto it = requestTimes[id].find(addr);
+ panic_if(it == requestTimes[id].end(),
+ "QoSMemCtrl::logResponse requestor %s unmatched response
for"
+ " address %d received", requestors[id], addr);
// Load request time
uint64_t requestTime = it->second.front();
@@ -182,7 +182,7 @@
// Remove whole address entry if last one
if (it->second.empty()) {
- requestTimes[m_id].erase(it);
+ requestTimes[id].erase(it);
}
// Compute latency
double latency = (double) (curTick() + delay - requestTime)
@@ -209,15 +209,15 @@
}
uint8_t
-MemCtrl::schedule(MasterID m_id, uint64_t data)
+MemCtrl::schedule(MasterID id, uint64_t data)
{
if (policy) {
- return policy->schedule(m_id, data);
+ return policy->schedule(id, data);
} else {
DPRINTF(QOS,
"QoSScheduler::schedule unique id [%d] "
"data received [%d], but QoS scheduler not initialized\n",
- m_id,data);
+ id,data);
return 0;
}
}
@@ -266,16 +266,16 @@
}
void
-MemCtrl::addMaster(MasterID m_id)
+MemCtrl::addMaster(MasterID id)
{
- if (!hasMaster(m_id)) {
- masters.emplace(m_id, _system->getMasterName(m_id));
- packetPriorities[m_id].resize(numPriorities(), 0);
+ if (!hasMaster(id)) {
+ requestors.emplace(id, _system->getMasterName(id));
+ packetPriorities[id].resize(numPriorities(), 0);
DPRINTF(QOS,
"QoSMemCtrl::addMaster registering"
- " Master %s [id %d]\n",
- masters[m_id], m_id);
+ " Requestor %s [id %d]\n",
+ requestors[id], id);
}
}
@@ -315,7 +315,7 @@
const auto max_requestors = system->maxMasters();
const auto num_priorities = memCtrl.numPriorities();
- // Initializes per master statistics
+ // Initializes per requestor statistics
avgPriority
.init(max_requestors)
.flags(nozero | nonan)
diff --git a/src/mem/qos/mem_ctrl.hh b/src/mem/qos/mem_ctrl.hh
index c3511e5..dbe52b6 100644
--- a/src/mem/qos/mem_ctrl.hh
+++ b/src/mem/qos/mem_ctrl.hh
@@ -80,17 +80,17 @@
/**
* Enables QoS synchronized scheduling invokes the QoS scheduler
- * on all masters, at every packet arrival.
+ * on all requestors, at every packet arrival.
*/
const bool qosSyncroScheduler;
- /** Hash of master ID - master name */
- std::unordered_map<MasterID, const std::string> masters;
+ /** Hash of requestor ID - requestor name */
+ std::unordered_map<MasterID, const std::string> requestors;
- /** Hash of masters - number of packets queued per priority */
+ /** Hash of requestors - number of packets queued per priority */
std::unordered_map<MasterID, std::vector<uint64_t> > packetPriorities;
- /** Hash of masters - address of request - queue of times of request */
+ /** Hash of requestors - address of request - queue of times of
request */
std::unordered_map<MasterID,
std::unordered_map<uint64_t, std::deque<uint64_t>> >
requestTimes;
@@ -129,10 +129,10 @@
const MemCtrl &memCtrl;
- /** per-master average QoS priority */
+ /** per-requestor average QoS priority */
Stats::VectorStandardDeviation avgPriority;
/**
- * per-master average QoS distance between assigned and
+ * per-requestor average QoS distance between assigned and
* queued values
*/
Stats::VectorStandardDeviation avgPriorityDistance;
@@ -155,21 +155,21 @@
* Initializes dynamically counters and
* statistics for a given Requestor
*
- * @param m_id the master ID
+ * @param id the unique ID
*/
- void addMaster(const MasterID m_id);
+ void addMaster(const MasterID id);
/**
* Called upon receiving a request or
* updates statistics and updates queues status
*
* @param dir request direction
- * @param m_id master id
+ * @param id requestor id
* @param qos packet qos value
* @param addr packet address
* @param entries number of entries to record
*/
- void logRequest(BusState dir, MasterID m_id, uint8_t qos,
+ void logRequest(BusState dir, MasterID id, uint8_t qos,
Addr addr, uint64_t entries);
/**
@@ -177,13 +177,13 @@
* updates statistics and updates queues status
*
* @param dir response direction
- * @param m_id master id
+ * @param id requestor id
* @param qos packet qos value
* @param addr packet address
* @param entries number of entries to record
* @param delay response delay
*/
- void logResponse(BusState dir, MasterID m_id, uint8_t qos,
+ void logResponse(BusState dir, MasterID id, uint8_t qos,
Addr addr, uint64_t entries, double delay);
/**
@@ -200,7 +200,7 @@
uint64_t queue_entry_size, const PacketPtr pkt);
using SimObject::schedule;
- uint8_t schedule(MasterID m_id, uint64_t data);
+ uint8_t schedule(MasterID id, uint64_t data);
uint8_t schedule(const PacketPtr pkt);
/**
@@ -223,22 +223,22 @@
/**
* Escalates/demotes priority of all packets
- * belonging to the passed master to given
+ * belonging to the passed requestor to given
* priority value
*
* @param queues list of pointers to packet queues
* @param queue_entry_size size of an entry in the queue
- * @param m_id master whose packets priority will change
+ * @param id requestor whose packets priority will change
* @param tgt_prio target priority value
*/
template<typename Queues>
void escalate(std::initializer_list<Queues*> queues,
uint64_t queue_entry_size,
- MasterID m_id, uint8_t tgt_prio);
+ MasterID id, uint8_t tgt_prio);
/**
* Escalates/demotes priority of all packets
- * belonging to the passed master to given
+ * belonging to the passed requestor to given
* priority value in a specified cluster of queues
* (e.g. read queues or write queues) which is passed
* as an argument to the function.
@@ -247,13 +247,13 @@
*
* @param queues reference to packet queues
* @param queue_entry_size size of an entry in the queue
- * @param m_id master whose packets priority will change
+ * @param id requestor whose packets priority will change
* @param curr_prio source queue priority value
* @param tgt_prio target queue priority value
*/
template<typename Queues>
void escalateQueues(Queues& queues, uint64_t queue_entry_size,
- MasterID m_id, uint8_t curr_prio, uint8_t
tgt_prio);
+ MasterID id, uint8_t curr_prio, uint8_t tgt_prio);
public:
/**
@@ -285,18 +285,18 @@
BusState getBusStateNext() const { return busStateNext; }
/**
- * hasMaster returns true if the selected master(ID) has
+ * hasMaster returns true if the selected requestor(ID) has
* been registered in the memory controller, which happens if
* the memory controller has received at least a packet from
- * that master.
+ * that requestor.
*
- * @param m_id master id to lookup
+ * @param id requestor id to lookup
* @return true if the memory controller has received a packet
- * from the master, false otherwise.
+ * from the requestor, false otherwise.
*/
- bool hasMaster(MasterID m_id) const
+ bool hasMaster(MasterID id) const
{
- return masters.find(m_id) != masters.end();
+ return requestors.find(id) != requestors.end();
}
/**
@@ -351,23 +351,23 @@
template<typename Queues>
void
MemCtrl::escalateQueues(Queues& queues, uint64_t queue_entry_size,
- MasterID m_id, uint8_t curr_prio, uint8_t tgt_prio)
+ MasterID id, uint8_t curr_prio, uint8_t tgt_prio)
{
auto it = queues[curr_prio].begin();
while (it != queues[curr_prio].end()) {
// No packets left to move
- if (packetPriorities[m_id][curr_prio] == 0)
+ if (packetPriorities[id][curr_prio] == 0)
break;
auto pkt = *it;
DPRINTF(QOS,
"QoSMemCtrl::escalate checking priority %d packet "
- "m_id %d address %d\n", curr_prio,
+ "id %d address %d\n", curr_prio,
pkt->masterId(), pkt->getAddr());
// Found a packet to move
- if (pkt->masterId() == m_id) {
+ if (pkt->masterId() == id) {
uint64_t moved_entries = divCeil(pkt->getSize(),
queue_entry_size);
@@ -376,25 +376,25 @@
"QoSMemCtrl::escalate Requestor %s [id %d] moving "
"packet addr %d size %d (p size %d) from priority %d "
"to priority %d - "
- "this master packets %d (entries to move %d)\n",
- masters[m_id], m_id, pkt->getAddr(),
+ "this requestor packets %d (entries to move %d)\n",
+ requestors[id], id, pkt->getAddr(),
pkt->getSize(),
queue_entry_size, curr_prio, tgt_prio,
- packetPriorities[m_id][curr_prio], moved_entries);
+ packetPriorities[id][curr_prio], moved_entries);
if (pkt->isRead()) {
panic_if(readQueueSizes[curr_prio] < moved_entries,
- "QoSMemCtrl::escalate master %s negative READ "
+ "QoSMemCtrl::escalate requestor %s negative READ "
"packets for priority %d",
- masters[m_id], tgt_prio);
+ requestors[id], tgt_prio);
readQueueSizes[curr_prio] -= moved_entries;
readQueueSizes[tgt_prio] += moved_entries;
} else if (pkt->isWrite()) {
panic_if(writeQueueSizes[curr_prio] < moved_entries,
- "QoSMemCtrl::escalate master %s negative WRITE "
+ "QoSMemCtrl::escalate requestor %s negative
WRITE "
"packets for priority %d",
- masters[m_id], tgt_prio);
+ requestors[id], tgt_prio);
writeQueueSizes[curr_prio] -= moved_entries;
writeQueueSizes[tgt_prio] += moved_entries;
}
@@ -406,13 +406,13 @@
// Erase element from source packet queue, this will
// increment the iterator
it = queues[curr_prio].erase(it);
- panic_if(packetPriorities[m_id][curr_prio] < moved_entries,
- "QoSMemCtrl::escalate master %s negative packets "
+ panic_if(packetPriorities[id][curr_prio] < moved_entries,
+ "QoSMemCtrl::escalate requestor %s negative packets "
"for priority %d",
- masters[m_id], tgt_prio);
+ requestors[id], tgt_prio);
- packetPriorities[m_id][curr_prio] -= moved_entries;
- packetPriorities[m_id][tgt_prio] += moved_entries;
+ packetPriorities[id][curr_prio] -= moved_entries;
+ packetPriorities[id][tgt_prio] += moved_entries;
} else {
// Increment iterator to next location in the queue
it++;
@@ -424,11 +424,11 @@
void
MemCtrl::escalate(std::initializer_list<Queues*> queues,
uint64_t queue_entry_size,
- MasterID m_id, uint8_t tgt_prio)
+ MasterID id, uint8_t tgt_prio)
{
// If needed, initialize all counters and statistics
- // for this master
- addMaster(m_id);
+ // for this requestor
+ addMaster(id);
DPRINTF(QOS,
"QoSMemCtrl::escalate Requestor %s [id %d] to priority "
@@ -441,30 +441,30 @@
continue;
// Process other priority packet
- while (packetPriorities[m_id][curr_prio] > 0) {
+ while (packetPriorities[id][curr_prio] > 0) {
DPRINTF(QOS,
"QoSMemCtrl::escalate MID %d checking priority %d "
"(packets %d)- current packets in prio %d: %d\n"
"\t(source read %d source write %d target read %d, "
"target write %d)\n",
- m_id, curr_prio, packetPriorities[m_id][curr_prio],
- tgt_prio, packetPriorities[m_id][tgt_prio],
+ id, curr_prio, packetPriorities[id][curr_prio],
+ tgt_prio, packetPriorities[id][tgt_prio],
readQueueSizes[curr_prio],
writeQueueSizes[curr_prio], readQueueSizes[tgt_prio],
writeQueueSizes[tgt_prio]);
// Check both read and write queue
for (auto q : queues) {
- escalateQueues(*q, queue_entry_size, m_id,
+ escalateQueues(*q, queue_entry_size, id,
curr_prio, tgt_prio);
}
}
}
DPRINTF(QOS,
- "QoSMemCtrl::escalate Completed master %s [id %d] to
priority %d "
- "(now %d packets)\n\t(total read %d, total write %d)\n",
- masters[m_id], m_id, tgt_prio,
packetPriorities[m_id][tgt_prio],
+ "QoSMemCtrl::escalate Completed requestor %s [id %d] to
priority "
+ "%d (now %d packets)\n\t(total read %d, total write %d)\n",
+ requestors[id], id, tgt_prio, packetPriorities[id][tgt_prio],
readQueueSizes[tgt_prio], writeQueueSizes[tgt_prio]);
}
@@ -482,8 +482,8 @@
pkt->qosValue(pkt_priority);
if (qosSyncroScheduler) {
- // Call the scheduling function on all other masters.
- for (const auto& m : masters) {
+ // Call the scheduling function on all other requestors.
+ for (const auto& m : requestors) {
if (m.first == pkt->masterId())
continue;
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/33535
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: If57b3a5c8dab3d96d7297d48d3466f3f2aa436f9
Gerrit-Change-Number: 33535
Gerrit-PatchSet: 1
Gerrit-Owner: Shivani Parekh <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s