diff options
author | Nilay Vaish <nilay@cs.wisc.edu> | 2014-09-15 16:19:38 -0500 |
---|---|---|
committer | Nilay Vaish <nilay@cs.wisc.edu> | 2014-09-15 16:19:38 -0500 |
commit | 2ccdfc547d5b58bdc859e4497658e972d7af5c45 (patch) | |
tree | 4f1d75beb873b84f66612e250b774a149fe2e91e /src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc | |
parent | 8d18713d28854cef9beef20f22065a769d7a0396 (diff) | |
download | gem5-2ccdfc547d5b58bdc859e4497658e972d7af5c45.tar.xz |
ruby: network: revert some of the changes from ad9c042dce54
The changeset ad9c042dce54 made changes to the structures under the network
directory to use a map of buffers instead of vector of buffers.
The reasoning was that not all vnets that are created are used and we
needlessly allocate more buffers than required and then iterate over them
while processing network messages. But the move to map resulted in a slow
down which was pointed out by Andreas Hansson. This patch moves things
back to using vector of message buffers.
Diffstat (limited to 'src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc')
-rw-r--r-- | src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc index 26d2423e8..32066f0e1 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc +++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc @@ -90,20 +90,23 @@ NetworkInterface::addOutPort(NetworkLink *out_link) } void -NetworkInterface::addNode(map<int, MessageBuffer*>& in, - map<int, MessageBuffer*>& out) +NetworkInterface::addNode(vector<MessageBuffer*>& in, + vector<MessageBuffer*>& out) { inNode_ptr = in; outNode_ptr = out; for (auto& it: in) { - // the protocol injects messages into the NI - it.second->setConsumer(this); - it.second->setReceiver(this); + if (it != nullptr) { + it->setConsumer(this); + it->setReceiver(this); + } } for (auto& it : out) { - it.second->setSender(this); + if (it != nullptr) { + it->setSender(this); + } } } @@ -242,9 +245,11 @@ NetworkInterface::wakeup() //Checking for messages coming from the protocol // can pick up a message/cycle for each virtual net - for (auto it = inNode_ptr.begin(); it != inNode_ptr.end(); ++it) { - int vnet = (*it).first; - MessageBuffer *b = (*it).second; + for (int vnet = 0; vnet < inNode_ptr.size(); ++vnet) { + MessageBuffer *b = inNode_ptr[vnet]; + if (b == nullptr) { + continue; + } while (b->isReady()) { // Is there a message waiting msg_ptr = b->peekMsgPtr(); @@ -326,9 +331,11 @@ void NetworkInterface::checkReschedule() { for (const auto& it : inNode_ptr) { - MessageBuffer *b = it.second; + if (it == nullptr) { + continue; + } - while (b->isReady()) { // Is there a message waiting + while (it->isReady()) { // Is there a message waiting scheduleEvent(Cycles(1)); return; } |