network: moved network config params
authorBrad Beckmann <Brad.Beckmann@amd.com>
Fri, 29 Apr 2011 00:18:14 +0000 (17:18 -0700)
committerBrad Beckmann <Brad.Beckmann@amd.com>
Fri, 29 Apr 2011 00:18:14 +0000 (17:18 -0700)
Moved the buffer_size, endpoint_bandwidth, and adaptive_routing params out of
the top-level parent network object and to only those networks that actually
use those parameters.

13 files changed:
src/mem/ruby/network/Network.cc
src/mem/ruby/network/Network.hh
src/mem/ruby/network/Network.py
src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc
src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh
src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.py
src/mem/ruby/network/simple/SimpleNetwork.cc
src/mem/ruby/network/simple/SimpleNetwork.hh
src/mem/ruby/network/simple/SimpleNetwork.py
src/mem/ruby/network/simple/Switch.cc
src/mem/ruby/network/simple/Switch.hh
src/mem/ruby/network/simple/Throttle.cc
src/mem/ruby/network/simple/Throttle.hh

index aad6574fbcb4099ab554cafdd53c50cfa29773ee..b7f025eeba0feeddeffc86848729c1d0c03fe0cd 100644 (file)
@@ -36,9 +36,6 @@ Network::Network(const Params *p)
 {
     m_virtual_networks = p->number_of_virtual_networks;
     m_topology_ptr = p->topology;
-    m_buffer_size = p->buffer_size;
-    m_endpoint_bandwidth = p->endpoint_bandwidth;
-    m_adaptive_routing = p->adaptive_routing;
     m_link_latency = p->link_latency;
     m_control_msg_size = p->control_msg_size;
 
index a33360e6add97b8a3d95197d6a171f634b80ec7c..2208c0e7288653c58e88ffa39759afa02aab801a 100644 (file)
@@ -66,10 +66,7 @@ class Network : public SimObject
 
     virtual void init();
 
-    int getBufferSize() { return m_buffer_size; }
     int getNumberOfVirtualNetworks() { return m_virtual_networks; }
-    int getEndpointBandwidth() { return m_endpoint_bandwidth; }
-    bool getAdaptiveRouting() {return m_adaptive_routing; }
     int getLinkLatency() { return m_link_latency; }
     int MessageSizeType_to_int(MessageSizeType size_type);
 
@@ -110,10 +107,7 @@ class Network : public SimObject
     const std::string m_name;
     int m_nodes;
     int m_virtual_networks;
-    int m_buffer_size;
-    int m_endpoint_bandwidth;
     Topology* m_topology_ptr;
-    bool m_adaptive_routing;
     int m_link_latency;
     int m_control_msg_size;
     int m_data_msg_size;
index c539f7191d5471a6304e9356dd862a7cbad839cf..55c049081484c8262629f914b98efa8c6de928a1 100644 (file)
@@ -47,10 +47,6 @@ class RubyNetwork(SimObject):
     abstract = True
     number_of_virtual_networks = Param.Int(10, "");
     topology = Param.Topology("");
-    buffer_size = Param.Int(0,
-        "default buffer size; 0 indicates infinite buffering");
-    endpoint_bandwidth = Param.Int(10000, "");
-    adaptive_routing = Param.Bool(False, "enable adaptive routing");
     link_latency = Param.Int(1,
         "local memory latency ?? NetworkLinkLatency");
     control_msg_size = Param.Int(8, "");
index 16c56e95e76430e6d4b8d7f4f711fbd982b073c1..551e83fa35f3793292e2d500c0f9de65d1be36b4 100644 (file)
@@ -48,6 +48,8 @@ using m5::stl_helpers::deletePointers;
 GarnetNetwork::GarnetNetwork(const Params *p)
     : BaseGarnetNetwork(p)
 {
+    m_buffer_size = p->buffer_size;
+
     m_ruby_start = 0;
     m_flits_received = 0;
     m_flits_injected = 0;
index a89a70ba753422a77f69856e8bf59b1eb07ad42b..9437390416cadee1bee5e4ade0a5c22bdfbbeea3 100644 (file)
@@ -56,6 +56,8 @@ class GarnetNetwork : public BaseGarnetNetwork
 
     void init();
 
+    int getBufferSize() { return m_buffer_size; }
+
     // returns the queue requested for the given component
     MessageBuffer* getToNetQueue(NodeID id, bool ordered, int network_num);
     MessageBuffer* getFromNetQueue(NodeID id, bool ordered, int network_num);
@@ -122,6 +124,7 @@ class GarnetNetwork : public BaseGarnetNetwork
     std::vector<NetworkInterface *> m_ni_ptr_vector; // All NI's in Network
 
     Time m_ruby_start;
+    int m_buffer_size;
 };
 
 inline std::ostream&
index 0f57d5be7fb44ee172d08bd01dcd2fae73a48530..0844fe3b442b0dbb74a3cb29c2a8f1aea17e3690 100644 (file)
@@ -33,4 +33,6 @@ from BaseGarnetNetwork import BaseGarnetNetwork
 
 class GarnetNetwork(BaseGarnetNetwork):
     type = 'GarnetNetwork'
+    buffer_size = Param.Int(0,
+        "default buffer size; 0 indicates infinite buffering");
 
index 8829b2eb503b51a0c452677b121b909b8ba05bee..eb561b61252c2718c2579338a37f8c9556acfe74 100644 (file)
@@ -62,6 +62,10 @@ Network::createNetwork(int nodes)
 SimpleNetwork::SimpleNetwork(const Params *p)
     : Network(p)
 {
+    m_buffer_size = p->buffer_size;
+    m_endpoint_bandwidth = p->endpoint_bandwidth;
+    m_adaptive_routing = p->adaptive_routing;
+
     // Note: the parent Network Object constructor is called before the
     // SimpleNetwork child constructor.  Therefore, the member variables
     // used below should already be initialized.
index 13a4b173ef0278e01e9ee0cc6515d9855629db1b..093ed959efce20f27db50656f9081a1fd65981b3 100644 (file)
@@ -53,6 +53,10 @@ class SimpleNetwork : public Network
 
     void init();
 
+    int getBufferSize() { return m_buffer_size; }
+    int getEndpointBandwidth() { return m_endpoint_bandwidth; }
+    bool getAdaptiveRouting() {return m_adaptive_routing; }
+
     void printStats(std::ostream& out) const;
     void clearStats();
     void printConfig(std::ostream& out) const;
@@ -107,6 +111,10 @@ class SimpleNetwork : public Network
     std::vector<Switch*> m_switch_ptr_vector;
     std::vector<MessageBuffer*> m_buffers_to_free;
     std::vector<Switch*> m_endpoint_switches;
+
+    int m_buffer_size;
+    int m_endpoint_bandwidth;
+    bool m_adaptive_routing;    
 };
 
 inline std::ostream&
index d8bf55a226bc32c5b0105c401b300a48957bf2ff..e9a3a1987ba50046eddd85523fb95fabc8557d80 100644 (file)
@@ -32,3 +32,7 @@ from Network import RubyNetwork
 
 class SimpleNetwork(RubyNetwork):
     type = 'SimpleNetwork'
+    buffer_size = Param.Int(0,
+        "default buffer size; 0 indicates infinite buffering");
+    endpoint_bandwidth = Param.Int(10000, "");
+    adaptive_routing = Param.Bool(False, "enable adaptive routing");
index 391e087247c5f81272a233b00a6f2e9c1807877d..bcc1347a3928a20b9d447f9f02a365ac933ad358 100644 (file)
@@ -33,9 +33,9 @@
 #include "mem/protocol/Protocol.hh"
 #include "mem/ruby/buffers/MessageBuffer.hh"
 #include "mem/ruby/network/simple/PerfectSwitch.hh"
+#include "mem/ruby/network/simple/SimpleNetwork.hh"
 #include "mem/ruby/network/simple/Switch.hh"
 #include "mem/ruby/network/simple/Throttle.hh"
-#include "mem/ruby/network/Network.hh"
 
 using namespace std;
 using m5::stl_helpers::deletePointers;
@@ -69,10 +69,12 @@ Switch::addOutPort(const vector<MessageBuffer*>& out,
     const NetDest& routing_table_entry, int link_latency, int bw_multiplier)
 {
     Throttle* throttle_ptr = NULL;
+    SimpleNetwork* net_ptr = 
+        safe_cast<SimpleNetwork*>(RubySystem::getNetwork());
 
     // Create a throttle
     throttle_ptr = new Throttle(m_switch_id, m_throttles.size(), link_latency,
-        bw_multiplier);
+                                bw_multiplier, net_ptr->getEndpointBandwidth());
     m_throttles.push_back(throttle_ptr);
 
     // Create one buffer per vnet (these are intermediaryQueues)
@@ -81,7 +83,6 @@ Switch::addOutPort(const vector<MessageBuffer*>& out,
         MessageBuffer* buffer_ptr = new MessageBuffer;
         // Make these queues ordered
         buffer_ptr->setOrdering(true);
-        Network* net_ptr = RubySystem::getNetwork();
         if (net_ptr->getBufferSize() > 0) {
             buffer_ptr->resize(net_ptr->getBufferSize());
         }
index 6e80c86427798136935b8debdb1356c60a440c18..c7630f200203ef52ffd7a3bbf8f5c20606eb8399 100644 (file)
@@ -49,7 +49,6 @@ class PerfectSwitch;
 class NetDest;
 class SimpleNetwork;
 class Throttle;
-class Network;
 
 class Switch
 {
@@ -79,7 +78,7 @@ class Switch
     Switch& operator=(const Switch& obj);
 
     PerfectSwitch* m_perfect_switch_ptr;
-    Network* m_network_ptr;
+    SimpleNetwork* m_network_ptr;
     std::vector<Throttle*> m_throttles;
     std::vector<MessageBuffer*> m_buffers_to_free;
     SwitchID m_switch_id;
index 905a7aa28b9138f67bc993bca188cbbc5a495624..108dd843d04c1f5dd1e028addbc3cf6e6c5639b8 100644 (file)
@@ -49,21 +49,22 @@ 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 link_bandwidth_multiplier, int endpoint_bandwidth)
 {
-    init(node, link_latency, link_bandwidth_multiplier);
+    init(node, link_latency, link_bandwidth_multiplier, endpoint_bandwidth);
     m_sID = sID;
 }
 
 Throttle::Throttle(NodeID node, int link_latency,
-    int link_bandwidth_multiplier)
+                   int link_bandwidth_multiplier, int endpoint_bandwidth)
 {
-    init(node, link_latency, link_bandwidth_multiplier);
+    init(node, link_latency, link_bandwidth_multiplier, endpoint_bandwidth);
     m_sID = 0;
 }
 
 void
-Throttle::init(NodeID node, int link_latency, int link_bandwidth_multiplier)
+Throttle::init(NodeID node, int link_latency, int link_bandwidth_multiplier, 
+               int endpoint_bandwidth)
 {
     m_node = node;
     m_vnets = 0;
@@ -71,6 +72,7 @@ Throttle::init(NodeID node, int link_latency, int link_bandwidth_multiplier)
     assert(link_bandwidth_multiplier > 0);
     m_link_bandwidth_multiplier = link_bandwidth_multiplier;
     m_link_latency = link_latency;
+    m_endpoint_bandwidth = endpoint_bandwidth;
 
     m_wakeups_wo_switch = 0;
     clearStats();
index 0a1fc9a301184efc87c870d25748413ffb4bebe2..09eac79a88a775ada0244266e57985d54f5deee7 100644 (file)
@@ -54,8 +54,9 @@ class Throttle : public Consumer
 {
   public:
     Throttle(int sID, NodeID node, int link_latency,
-        int link_bandwidth_multiplier);
-    Throttle(NodeID node, int link_latency, int link_bandwidth_multiplier);
+             int link_bandwidth_multiplier, int endpoint_bandwidth);
+    Throttle(NodeID node, int link_latency, int link_bandwidth_multiplier,
+             int endpoint_bandwidth);
     ~Throttle() {}
 
     std::string name()
@@ -73,8 +74,7 @@ class Throttle : public Consumer
     int
     getLinkBandwidth() const
     {
-        return RubySystem::getNetwork()->getEndpointBandwidth() *
-            m_link_bandwidth_multiplier;
+        return m_endpoint_bandwidth * m_link_bandwidth_multiplier;
     }
     int getLatency() const { return m_link_latency; }
 
@@ -89,7 +89,8 @@ class Throttle : public Consumer
     void print(std::ostream& out) const;
 
   private:
-    void init(NodeID node, int link_latency, int link_bandwidth_multiplier);
+    void init(NodeID node, int link_latency, int link_bandwidth_multiplier,
+              int endpoint_bandwidth);
     void addVirtualNetwork(MessageBuffer* in_ptr, MessageBuffer* out_ptr);
     void linkUtilized(double ratio) { m_links_utilized += ratio; }
 
@@ -107,6 +108,7 @@ class Throttle : public Consumer
     int m_link_bandwidth_multiplier;
     int m_link_latency;
     int m_wakeups_wo_switch;
+    int m_endpoint_bandwidth;
 
     // For tracking utilization
     Time m_ruby_start;