diff options
author | Nilay Vaish <nilay@cs.wisc.edu> | 2012-09-18 22:46:34 -0500 |
---|---|---|
committer | Nilay Vaish <nilay@cs.wisc.edu> | 2012-09-18 22:46:34 -0500 |
commit | 86b1c0fd540b57c1e7bba948ad0417f22f90eb41 (patch) | |
tree | c4dc42939158c13b5eeff2f6809fa800c99e490b /src/mem/ruby/network | |
parent | d2b57a7473768e8aff3707916b40b264cab6821c (diff) | |
download | gem5-86b1c0fd540b57c1e7bba948ad0417f22f90eb41.tar.xz |
ruby: avoid using g_system_ptr for event scheduling
This patch removes the use of g_system_ptr for event scheduling. Each consumer
object now needs to specify upfront an EventManager object it would use for
scheduling events. This makes the ruby memory system more amenable for a
multi-threaded simulation.
Diffstat (limited to 'src/mem/ruby/network')
17 files changed, 25 insertions, 13 deletions
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc index adafa4d24..62b8cd574 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc @@ -35,7 +35,7 @@ using namespace std; using m5::stl_helpers::deletePointers; -InputUnit_d::InputUnit_d(int id, Router_d *router) +InputUnit_d::InputUnit_d(int id, Router_d *router) : Consumer(router) { m_id = id; m_router = router; diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc index 4bdce2a34..b0538d19f 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc @@ -44,6 +44,7 @@ using m5::stl_helpers::deletePointers; NetworkInterface_d::NetworkInterface_d(int id, int virtual_networks, GarnetNetwork_d *network_ptr) + : Consumer(network_ptr) { m_id = id; m_net_ptr = network_ptr; diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc index ac41263e3..432097a91 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc @@ -32,7 +32,7 @@ #include "mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh" NetworkLink_d::NetworkLink_d(const Params *p) - : SimObject(p) + : SimObject(p), Consumer(this) { m_latency = p->link_latency; channel_width = p->channel_width; diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc index 429ff4d91..33d1583e1 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc @@ -36,6 +36,7 @@ using namespace std; using m5::stl_helpers::deletePointers; OutputUnit_d::OutputUnit_d(int id, Router_d *router) + : Consumer(router) { m_id = id; m_router = router; diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc index 530e8f1b2..41ff8d482 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc @@ -35,6 +35,7 @@ #include "mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.hh" SWallocator_d::SWallocator_d(Router_d *router) + : Consumer(router) { m_router = router; m_num_vcs = m_router->get_num_vcs(); diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc index 12c00d9d0..1cb31c3e3 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc @@ -37,6 +37,7 @@ using m5::stl_helpers::deletePointers; Switch_d::Switch_d(Router_d *router) + : Consumer(router) { m_router = router; m_num_vcs = m_router->get_num_vcs(); diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc index 3940e1d6a..75533fb10 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc @@ -35,6 +35,7 @@ #include "mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.hh" VCallocator_d::VCallocator_d(Router_d *router) + : Consumer(router) { m_router = router; m_num_vcs = m_router->get_num_vcs(); diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh b/src/mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh index 04a4ac95a..a2d6db60b 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh +++ b/src/mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh @@ -38,6 +38,7 @@ class FlexibleConsumer : public Consumer { public: + FlexibleConsumer(EventManager *em) : Consumer(em) {} virtual bool isBufferNotFull(int vc, int inport) { return true; } virtual void grant_vc(int out_port, int vc, Time grant_time) {} virtual void release_vc(int out_port, int vc, Time release_time) {} diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc index cc7dd7146..824acce80 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc +++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc @@ -44,6 +44,7 @@ using m5::stl_helpers::deletePointers; NetworkInterface::NetworkInterface(int id, int virtual_networks, GarnetNetwork *network_ptr) + : FlexibleConsumer(network_ptr) { m_id = id; m_net_ptr = network_ptr; diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc index fb7c9bd44..3908d34c3 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc +++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc @@ -32,7 +32,7 @@ #include "mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh" NetworkLink::NetworkLink(const Params *p) - : SimObject(p) + : SimObject(p), FlexibleConsumer(this) { linkBuffer = new flitBuffer(); m_in_port = 0; @@ -140,7 +140,7 @@ NetworkLink::wakeup() flit *t_flit = link_srcQueue->getTopFlit(); t_flit->set_time(g_system_ptr->getTime() + m_latency); linkBuffer->insert(t_flit); - link_consumer->scheduleEvent(this, m_latency); + link_consumer->scheduleEvent(m_latency); m_link_utilized++; m_vc_load[t_flit->get_vc()]++; } diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc b/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc index 28e9fc497..88361d35a 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc +++ b/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc @@ -41,7 +41,7 @@ using namespace std; using m5::stl_helpers::deletePointers; Router::Router(const Params *p) - : BasicRouter(p) + : BasicRouter(p), FlexibleConsumer(this) { m_id = p->router_id; m_virtual_networks = p->virt_nets; diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/VCarbiter.cc b/src/mem/ruby/network/garnet/flexible-pipeline/VCarbiter.cc index e68e1b12f..5ed336699 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/VCarbiter.cc +++ b/src/mem/ruby/network/garnet/flexible-pipeline/VCarbiter.cc @@ -32,6 +32,7 @@ #include "mem/ruby/network/garnet/flexible-pipeline/VCarbiter.hh" VCarbiter::VCarbiter(Router *router) + : Consumer(router) { m_router = router; } diff --git a/src/mem/ruby/network/simple/PerfectSwitch.cc b/src/mem/ruby/network/simple/PerfectSwitch.cc index 66065e22c..0ead3ac30 100644 --- a/src/mem/ruby/network/simple/PerfectSwitch.cc +++ b/src/mem/ruby/network/simple/PerfectSwitch.cc @@ -49,6 +49,7 @@ operator<(const LinkOrder& l1, const LinkOrder& l2) } PerfectSwitch::PerfectSwitch(SwitchID sid, SimpleNetwork* network_ptr) + : Consumer(network_ptr) { m_virtual_networks = network_ptr->getNumberOfVirtualNetworks(); m_switch_id = sid; diff --git a/src/mem/ruby/network/simple/Switch.cc b/src/mem/ruby/network/simple/Switch.cc index 922807a0b..42a4efae3 100644 --- a/src/mem/ruby/network/simple/Switch.cc +++ b/src/mem/ruby/network/simple/Switch.cc @@ -74,7 +74,8 @@ Switch::addOutPort(const vector<MessageBuffer*>& out, // Create a throttle throttle_ptr = new Throttle(m_switch_id, m_throttles.size(), link_latency, - bw_multiplier, net_ptr->getEndpointBandwidth()); + bw_multiplier, net_ptr->getEndpointBandwidth(), + net_ptr); m_throttles.push_back(throttle_ptr); // Create one buffer per vnet (these are intermediaryQueues) @@ -214,4 +215,3 @@ Switch::print(std::ostream& out) const // FIXME printing out << "[Switch]"; } - diff --git a/src/mem/ruby/network/simple/Switch.hh b/src/mem/ruby/network/simple/Switch.hh index 31ea6add1..0bc1e5eca 100644 --- a/src/mem/ruby/network/simple/Switch.hh +++ b/src/mem/ruby/network/simple/Switch.hh @@ -42,8 +42,6 @@ #include <iostream> #include <vector> -#include "mem/ruby/common/Global.hh" - class MessageBuffer; class PerfectSwitch; class NetDest; diff --git a/src/mem/ruby/network/simple/Throttle.cc b/src/mem/ruby/network/simple/Throttle.cc index 05dfc2553..e4dc71527 100644 --- a/src/mem/ruby/network/simple/Throttle.cc +++ b/src/mem/ruby/network/simple/Throttle.cc @@ -49,14 +49,18 @@ const int PRIORITY_SWITCH_LIMIT = 128; static int network_message_to_size(NetworkMessage* net_msg_ptr); Throttle::Throttle(int sID, NodeID node, int link_latency, - int link_bandwidth_multiplier, int endpoint_bandwidth) + int link_bandwidth_multiplier, int endpoint_bandwidth, + EventManager *em) + : Consumer(em) { init(node, link_latency, link_bandwidth_multiplier, endpoint_bandwidth); m_sID = sID; } Throttle::Throttle(NodeID node, int link_latency, - int link_bandwidth_multiplier, int endpoint_bandwidth) + int link_bandwidth_multiplier, int endpoint_bandwidth, + EventManager *em) + : Consumer(em) { init(node, link_latency, link_bandwidth_multiplier, endpoint_bandwidth); m_sID = 0; diff --git a/src/mem/ruby/network/simple/Throttle.hh b/src/mem/ruby/network/simple/Throttle.hh index 37a53b80a..b86a247d2 100644 --- a/src/mem/ruby/network/simple/Throttle.hh +++ b/src/mem/ruby/network/simple/Throttle.hh @@ -53,9 +53,10 @@ class Throttle : public Consumer { public: Throttle(int sID, NodeID node, int link_latency, - int link_bandwidth_multiplier, int endpoint_bandwidth); + int link_bandwidth_multiplier, int endpoint_bandwidth, + EventManager *em); Throttle(NodeID node, int link_latency, int link_bandwidth_multiplier, - int endpoint_bandwidth); + int endpoint_bandwidth, EventManager *em); ~Throttle() {} std::string name() |