Tiago Mück has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/41856 )

Change subject: mem-ruby: SimpleNetwork router latencies
......................................................................

mem-ruby: SimpleNetwork router latencies

SimpleNetwork takes into account the network router latency parameter.
The latency may be set to zero. PerfectSwitch and Throttle events were
assigned different priorities to ensure they always execute in the same
order for zero-latency forwarding.

JIRA: https://gem5.atlassian.net/browse/GEM5-920

Change-Id: I6cae6a0fc22b25078c27a1e2f71744c08efd7753
Signed-off-by: Tiago Mück <[email protected]>
---
M src/mem/ruby/network/simple/PerfectSwitch.cc
M src/mem/ruby/network/simple/SimpleNetwork.py
M src/mem/ruby/network/simple/Switch.cc
M src/mem/ruby/network/simple/Switch.hh
M src/mem/ruby/network/simple/Throttle.cc
5 files changed, 32 insertions(+), 5 deletions(-)



diff --git a/src/mem/ruby/network/simple/PerfectSwitch.cc b/src/mem/ruby/network/simple/PerfectSwitch.cc
index b90fd73..a821344 100644
--- a/src/mem/ruby/network/simple/PerfectSwitch.cc
+++ b/src/mem/ruby/network/simple/PerfectSwitch.cc
@@ -1,4 +1,16 @@
 /*
+ * Copyright (c) 2020 ARM Limited
+ * All rights reserved.
+ *
+ * The license below extends only to copyright in the software and shall
+ * not be construed as granting a license to any other intellectual
+ * property including but not limited to intellectual property relating
+ * to a hardware implementation of the functionality of the software
+ * licensed hereunder.  You may use the software subject to the license
+ * terms below provided that you ensure that this notice is replicated
+ * unmodified and in its entirety in all distributions of the software,
+ * modified or unmodified, in source code or in binary form.
+ *
  * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
  * All rights reserved.
  *
@@ -49,7 +61,8 @@
 }

 PerfectSwitch::PerfectSwitch(SwitchID sid, Switch *sw, uint32_t virt_nets)
-    : Consumer(sw), m_switch_id(sid), m_switch(sw)
+    : Consumer(sw, Switch::PERFECTSWITCH_EV_PRI),
+      m_switch_id(sid), m_switch(sw)
 {
     m_round_robin_start = 0;
     m_wakeups_wo_switch = 0;
@@ -275,7 +288,7 @@
                     incoming, vnet, outgoing, vnet);

             m_out[outgoing][vnet]->enqueue(msg_ptr, current_time,
- m_switch->cyclesToTicks(Cycles(1)));
+                                           m_switch->latencyTicks());
         }
     }
 }
diff --git a/src/mem/ruby/network/simple/SimpleNetwork.py b/src/mem/ruby/network/simple/SimpleNetwork.py
index 2e45116..fa01ca2 100644
--- a/src/mem/ruby/network/simple/SimpleNetwork.py
+++ b/src/mem/ruby/network/simple/SimpleNetwork.py
@@ -95,6 +95,7 @@
                 if link.dst_node == router:
                     for i in range(int(self.number_of_virtual_networks)):
                         router_buffers.append(MessageBuffer(ordered = True,
+                                     allow_zero_latency = True,
buffer_size = self.vnet_buffer_size(i)))

# Add message buffers to routers for each external link connection
@@ -103,6 +104,7 @@
                 if link.int_node in self.routers:
                     for i in range(int(self.number_of_virtual_networks)):
                         router_buffers.append(MessageBuffer(ordered = True,
+                                     allow_zero_latency = True,
buffer_size = self.vnet_buffer_size(i)))
             router.port_buffers = router_buffers

diff --git a/src/mem/ruby/network/simple/Switch.cc b/src/mem/ruby/network/simple/Switch.cc
index 501b619..fe04ed0 100644
--- a/src/mem/ruby/network/simple/Switch.cc
+++ b/src/mem/ruby/network/simple/Switch.cc
@@ -52,8 +52,8 @@

 Switch::Switch(const Params &p)
   : BasicRouter(p),
-    perfectSwitch(m_id, this, p.virt_nets), m_num_connected_buffers(0),
-    switchStats(this)
+    perfectSwitch(m_id, this, p.virt_nets),  m_latency(p.latency),
+    m_num_connected_buffers(0), switchStats(this)
 {
     m_port_buffers.reserve(p.port_buffers.size());
     for (auto& buffer : p.port_buffers) {
diff --git a/src/mem/ruby/network/simple/Switch.hh b/src/mem/ruby/network/simple/Switch.hh
index 271d090..180696d 100644
--- a/src/mem/ruby/network/simple/Switch.hh
+++ b/src/mem/ruby/network/simple/Switch.hh
@@ -71,6 +71,12 @@
 class Switch : public BasicRouter
 {
   public:
+
+    // Makes sure throttle sends messages to the links after the switch is
+    // done forwarding the messages in the same cycle
+    static const Event::Priority PERFECTSWITCH_EV_PRI = Event::Default_Pri;
+    static const Event::Priority THROTTLE_EV_PRI = Event::Default_Pri + 1;
+
     typedef SwitchParams Params;
     Switch(const Params &p);
     ~Switch() = default;
@@ -94,6 +100,10 @@
     bool functionalRead(Packet *, WriteMask&);
     uint32_t functionalWrite(Packet *);

+    Cycles latency() const { return m_latency; }
+
+    Tick latencyTicks() const { return cyclesToTicks(m_latency); }
+
   private:
     // Private copy constructor and assignment operator
     Switch(const Switch& obj);
@@ -103,6 +113,8 @@
     SimpleNetwork* m_network_ptr;
     std::list<Throttle> throttles;

+    const Cycles m_latency;
+
     unsigned m_num_connected_buffers;
     std::vector<MessageBuffer*> m_port_buffers;

diff --git a/src/mem/ruby/network/simple/Throttle.cc b/src/mem/ruby/network/simple/Throttle.cc
index a6aa51b..f3dd82c 100644
--- a/src/mem/ruby/network/simple/Throttle.cc
+++ b/src/mem/ruby/network/simple/Throttle.cc
@@ -60,7 +60,7 @@

Throttle::Throttle(int sID, RubySystem *rs, NodeID node, Cycles link_latency,
                    int endpoint_bandwidth, Switch *em)
-    : Consumer(em),
+    : Consumer(em,  Switch::THROTTLE_EV_PRI),
       m_switch_id(sID), m_switch(em), m_node(node),
       m_physical_vnets(false), m_ruby_system(rs),
       throttleStats(em, node)

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/41856
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: I6cae6a0fc22b25078c27a1e2f71744c08efd7753
Gerrit-Change-Number: 41856
Gerrit-PatchSet: 1
Gerrit-Owner: Tiago Mück <[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

Reply via email to