config: add port directions and per-router delay in topology.
authorTushar Krishna <tushar@ece.gatech.edu>
Thu, 6 Oct 2016 18:35:20 +0000 (14:35 -0400)
committerTushar Krishna <tushar@ece.gatech.edu>
Thu, 6 Oct 2016 18:35:20 +0000 (14:35 -0400)
This patch adds port direction names to the links during topology
creation, which can be used for better printed names for the links
or for users to code up their own adaptive routing algorithms.
It also adds support for every router to have an independent latency
value to support heterogeneous topologies with the subsequent
garnet2.0 patch.

14 files changed:
configs/topologies/Mesh_XY.py
src/mem/ruby/network/BasicLink.py
src/mem/ruby/network/BasicRouter.cc
src/mem/ruby/network/BasicRouter.hh
src/mem/ruby/network/BasicRouter.py
src/mem/ruby/network/Network.hh
src/mem/ruby/network/Topology.cc
src/mem/ruby/network/Topology.hh
src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc
src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh
src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc
src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh
src/mem/ruby/network/simple/SimpleNetwork.cc
src/mem/ruby/network/simple/SimpleNetwork.hh

index adf3ebe49fbdf65effc86efe829ab1c6600625b7..134a5c07dfc36419512c5501db536260764f37c9 100644 (file)
@@ -109,6 +109,8 @@ class Mesh_XY(SimpleTopology):
                     int_links.append(IntLink(link_id=link_count,
                                              src_node=routers[east_out],
                                              dst_node=routers[west_in],
+                                             src_outport="East",
+                                             dst_inport="West",
                                              weight=1))
                     link_count += 1
 
@@ -121,6 +123,8 @@ class Mesh_XY(SimpleTopology):
                     int_links.append(IntLink(link_id=link_count,
                                              src_node=routers[west_out],
                                              dst_node=routers[east_in],
+                                             src_outport="West",
+                                             dst_inport="East",
                                              weight=1))
                     link_count += 1
 
@@ -133,6 +137,8 @@ class Mesh_XY(SimpleTopology):
                     int_links.append(IntLink(link_id=link_count,
                                              src_node=routers[north_out],
                                              dst_node=routers[south_in],
+                                             src_outport="North",
+                                             dst_inport="South",
                                              weight=2))
                     link_count += 1
 
@@ -145,6 +151,8 @@ class Mesh_XY(SimpleTopology):
                     int_links.append(IntLink(link_id=link_count,
                                              src_node=routers[south_out],
                                              dst_node=routers[north_in],
+                                             src_outport="South",
+                                             dst_inport="North",
                                              weight=2))
                     link_count += 1
 
index 5da5dc6a21096388616d5992f3ce43c4b348ec8b..e3d72700d5acd6c05dac9cf2f433e3f383a4942d 100644 (file)
@@ -46,11 +46,17 @@ class BasicExtLink(BasicLink):
     cxx_header = "mem/ruby/network/BasicLink.hh"
     ext_node = Param.RubyController("External node")
     int_node = Param.BasicRouter("ID of internal node")
-    bandwidth_factor = 16
+    bandwidth_factor = 16 # only used by simple network
 
 class BasicIntLink(BasicLink):
     type = 'BasicIntLink'
     cxx_header = "mem/ruby/network/BasicLink.hh"
     src_node = Param.BasicRouter("Router on src end")
     dst_node = Param.BasicRouter("Router on dst end")
+
+    # only used by Garnet.
+    src_outport = Param.String("", "Outport direction at src router")
+    dst_inport = Param.String("", "Inport direction at dst router")
+
+    # only used by simple network
     bandwidth_factor = 16
index 96564ad0fe6bdd3fdfd7c4927e03aee37b87d5e9..644d3599ac16f0807fd054310bec1436f65dbbe8 100644 (file)
@@ -32,6 +32,7 @@ BasicRouter::BasicRouter(const Params *p)
     : ClockedObject(p)
 {
     m_id = p->router_id;
+    m_latency = p->latency;
 }
 
 void
index 9f2d0ecd9b9350833c44eda4c339e6fdb9084d88..2c89056750f4d54889d53d5bb416a72e82f4f518 100644 (file)
@@ -51,6 +51,7 @@ class BasicRouter : public ClockedObject
     // ID in relation to other routers in the system
     //
     uint32_t m_id;
+    uint32_t m_latency;
 };
 
 inline std::ostream&
index c487e8632bb9e50a9eee006e3a92136a83e38956..28fcdc47eeef8f1e91cb960173436c4510cf09dd 100644 (file)
@@ -34,3 +34,4 @@ class BasicRouter(ClockedObject):
     type = 'BasicRouter'
     cxx_header = "mem/ruby/network/BasicRouter.hh"
     router_id = Param.Int("ID in relation to other routers")
+    latency   = Param.Cycles(1, "number of cycles inside router")
index 529408696823d92ec4ae0ec66cadad7e76e2d5e5..4c0d4edfc515e8e506abd9e1090a2ee22c01abd2 100644 (file)
@@ -85,7 +85,9 @@ class Network : public ClockedObject
     virtual void makeExtInLink(NodeID src, SwitchID dest, BasicLink* link,
                             const NetDest& routing_table_entry) = 0;
     virtual void makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
-                                  const NetDest& routing_table_entry) = 0;
+                                  const NetDest& routing_table_entry,
+                                  PortDirection src_outport,
+                                  PortDirection dst_inport) = 0;
 
     virtual void collateStats() = 0;
     virtual void print(std::ostream& out) const = 0;
index f73e686c5fc675b43b85466b20a830b1f0502a2a..c18f379ae4b699749fa8583b0857225202b674df 100644 (file)
@@ -88,6 +88,9 @@ Topology::Topology(uint32_t num_routers,
         BasicRouter *router_src = int_link->params()->src_node;
         BasicRouter *router_dst = int_link->params()->dst_node;
 
+        PortDirection src_outport = int_link->params()->src_outport;
+        PortDirection dst_inport = int_link->params()->dst_inport;
+
         // Store the IntLink pointers for later
         m_int_link_vector.push_back(int_link);
 
@@ -95,7 +98,7 @@ Topology::Topology(uint32_t num_routers,
         int dst = router_dst->params()->router_id + 2*m_nodes;
 
         // create the internal uni-directional link from src to dst
-        addLink(src, dst, int_link);
+        addLink(src, dst, int_link, src_outport, dst_inport);
     }
 }
 
@@ -153,7 +156,9 @@ Topology::createLinks(Network *net)
 }
 
 void
-Topology::addLink(SwitchID src, SwitchID dest, BasicLink* link)
+Topology::addLink(SwitchID src, SwitchID dest, BasicLink* link,
+                  PortDirection src_outport_dirn,
+                  PortDirection dst_inport_dirn)
 {
     assert(src <= m_number_of_switches+m_nodes+m_nodes);
     assert(dest <= m_number_of_switches+m_nodes+m_nodes);
@@ -164,6 +169,8 @@ Topology::addLink(SwitchID src, SwitchID dest, BasicLink* link)
     src_dest_pair.first = src;
     src_dest_pair.second = dest;
     link_entry.link = link;
+    link_entry.src_outport_dirn = src_outport_dirn;
+    link_entry.dst_inport_dirn  = dst_inport_dirn;
     m_link_map[src_dest_pair] = link_entry;
 }
 
@@ -199,7 +206,9 @@ Topology::makeLink(Network *net, SwitchID src, SwitchID dest,
         link_entry = m_link_map[src_dest];
         net->makeInternalLink(src - (2 * m_nodes), dest - (2 * m_nodes),
                               link_entry.link,
-                              routing_table_entry);
+                              routing_table_entry,
+                              link_entry.src_outport_dirn,
+                              link_entry.dst_inport_dirn);
     }
 }
 
index 7e0b12c63253cb8acb069ea2bf8d6d81471ad3d3..1a5f4b19d41825681010b62866bf78852edc48bb 100644 (file)
@@ -52,11 +52,14 @@ class NetDest;
 class Network;
 
 typedef std::vector<std::vector<int> > Matrix;
+typedef std::string PortDirection;
 
 struct LinkEntry
 {
     BasicLink *link;
     LinkDirection direction;
+    PortDirection src_outport_dirn;
+    PortDirection dst_inport_dirn;
 };
 
 typedef std::map<std::pair<SwitchID, SwitchID>, LinkEntry> LinkMap;
@@ -72,7 +75,9 @@ class Topology
     void print(std::ostream& out) const { out << "[Topology]"; }
 
   private:
-    void addLink(SwitchID src, SwitchID dest, BasicLink* link);
+    void addLink(SwitchID src, SwitchID dest, BasicLink* link,
+                 PortDirection src_outport_dirn = "",
+                 PortDirection dest_inport_dirn = "");
     void makeLink(Network *net, SwitchID src, SwitchID dest,
                   const NetDest& routing_table_entry);
 
index 1e36a4cf0148be49cd353bc7b507a804111f9a91..9fd0c866959b470fb58903e0ecea3f7633d2f4fd 100644 (file)
@@ -175,7 +175,9 @@ GarnetNetwork_d::makeExtOutLink(SwitchID src, NodeID dest, BasicLink* link,
 
 void
 GarnetNetwork_d::makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
-                                  const NetDest& routing_table_entry)
+                                  const NetDest& routing_table_entry,
+                                  PortDirection src_outport,
+                                  PortDirection dst_inport)
 {
     GarnetIntLink_d* garnet_link = safe_cast<GarnetIntLink_d*>(link);
     NetworkLink_d* net_link = garnet_link->m_network_links[0];
index a11f3ea5019cef4ac3f248139a616eb0af3080b5..36a96e955f527f9cc062149526929aca4ff8c4f8 100644 (file)
@@ -74,7 +74,9 @@ class GarnetNetwork_d : public BaseGarnetNetwork
     void makeExtInLink(NodeID src, SwitchID dest, BasicLink* link,
                     const NetDest& routing_table_entry);
     void makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
-                          const NetDest& routing_table_entry);
+                          const NetDest& routing_table_entry,
+                          PortDirection src_outport,
+                          PortDirection dst_inport);
 
     //! Function for performing a functional write. The return value
     //! indicates the number of messages that were written.
index 0b33ab009fc99ba657b4145ecce37f0b16987409..bc37c62c5a66dcc640a9ddf252811f5bd5c754b9 100644 (file)
@@ -128,7 +128,9 @@ GarnetNetwork::makeExtOutLink(SwitchID src, NodeID dest, BasicLink* link,
 
 void
 GarnetNetwork::makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
-                                const NetDest& routing_table_entry)
+                                const NetDest& routing_table_entry,
+                                PortDirection src_outport,
+                                PortDirection dst_inport)
 {
     GarnetIntLink* garnet_link = safe_cast<GarnetIntLink*>(link);
     NetworkLink *net_link = garnet_link->m_network_links[0];
index 18360d47542e824c7588edd593df2d0c6b852c52..6ffa063294a762d670509519c33ec56316b51bd9 100644 (file)
@@ -65,7 +65,9 @@ class GarnetNetwork : public BaseGarnetNetwork
     void makeExtInLink(NodeID src, SwitchID dest, BasicLink* link,
                     const NetDest& routing_table_entry);
     void makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
-                          const NetDest& routing_table_entry);
+                          const NetDest& routing_table_entry,
+                          PortDirection src_outport,
+                          PortDirection dst_inport);
 
     //! Function for performing a functional read. The return value
     //! indicates if a message was found that had the required address.
index b30bd87314bdce2720b7368319b4821bc83667ef..1652ae7bb39188ef40f81ad5873663ab6d30b852 100644 (file)
@@ -104,7 +104,9 @@ SimpleNetwork::makeExtInLink(NodeID src, SwitchID dest, BasicLink* link,
 // From a switch to a switch
 void
 SimpleNetwork::makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
-                                const NetDest& routing_table_entry)
+                                const NetDest& routing_table_entry,
+                                PortDirection src_outport,
+                                PortDirection dst_inport)
 {
     // Create a set of new MessageBuffers
     std::vector<MessageBuffer*> queues(m_virtual_networks);
index 6a325d2a4b9de503dad1823a53b3086cad650a0f..8b870e735861f38fb28fcb35bfe8d25d0744ca8f 100644 (file)
@@ -64,7 +64,9 @@ class SimpleNetwork : public Network
     void makeExtInLink(NodeID src, SwitchID dest, BasicLink* link,
                     const NetDest& routing_table_entry);
     void makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
-                          const NetDest& routing_table_entry);
+                          const NetDest& routing_table_entry,
+                          PortDirection src_outport,
+                          PortDirection dst_inport);
 
     void print(std::ostream& out) const;