summaryrefslogtreecommitdiff
path: root/src/mem/ruby/network/garnet
diff options
context:
space:
mode:
authorNilay Vaish <nilay@cs.wisc.edu>2013-04-23 00:03:02 -0500
committerNilay Vaish <nilay@cs.wisc.edu>2013-04-23 00:03:02 -0500
commitaa86800e7a142f41a8fe957c367c133dea8d61bf (patch)
tree8d39b0c46569e171263c36de91f9b543502eb783 /src/mem/ruby/network/garnet
parente23e3bea8bc332626e026078dc8b23c983fc890f (diff)
downloadgem5-aa86800e7a142f41a8fe957c367c133dea8d61bf.tar.xz
ruby: patch checkpoint restore with garnet
Due to recent changes to clocking system in Ruby and the way Ruby restores state from a checkpoint, garnet was failing to run from a checkpointed state. The problem is that Ruby resets the time to zero while warming up the caches. If any component records a local copy of the time (read calls curCycle()) before the simulation has started, then that component will not operate until that time is reached. In the context of this particular patch, the Garnet Network class calls curCycle() at multiple places. Any non-operational component can block in requests in the memory system, which the system interprets as a deadlock. This patch makes changes so that Garnet can successfully run from checkpointed state. It adds a globally visible time at which the actual execution started. This time is initialized in RubySystem::startup() function. This variable is only meant for components with in Ruby. This replaces the private variable that was maintained within Garnet since it is not possible to figure out the correct time when the value of this variable can be set. The patch also does away with all cases where curCycle() is called with in some Ruby component before the system has actually started executing. This is required due to the quirky manner in which ruby restores from a checkpoint.
Diffstat (limited to 'src/mem/ruby/network/garnet')
-rw-r--r--src/mem/ruby/network/garnet/BaseGarnetNetwork.cc9
-rw-r--r--src/mem/ruby/network/garnet/BaseGarnetNetwork.hh3
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc4
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc2
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc1
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc9
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.hh1
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc4
-rw-r--r--src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh2
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc4
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc1
-rw-r--r--src/mem/ruby/network/garnet/flexible-pipeline/OutVcState.cc1
12 files changed, 14 insertions, 27 deletions
diff --git a/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc b/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc
index 3b24ada49..3e70900dc 100644
--- a/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc
+++ b/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc
@@ -36,7 +36,7 @@
using namespace std;
BaseGarnetNetwork::BaseGarnetNetwork(const Params *p)
- : Network(p), m_ruby_start(0)
+ : Network(p)
{
m_ni_flit_size = p->ni_flit_size;
m_vcs_per_vnet = p->vcs_per_vnet;
@@ -123,13 +123,6 @@ BaseGarnetNetwork::getFromNetQueue(NodeID id, bool ordered, int network_num,
void
BaseGarnetNetwork::clearStats()
{
- m_ruby_start = curCycle();
-}
-
-Cycles
-BaseGarnetNetwork::getRubyStartTime()
-{
- return m_ruby_start;
}
void
diff --git a/src/mem/ruby/network/garnet/BaseGarnetNetwork.hh b/src/mem/ruby/network/garnet/BaseGarnetNetwork.hh
index 15e63925a..b9f86df59 100644
--- a/src/mem/ruby/network/garnet/BaseGarnetNetwork.hh
+++ b/src/mem/ruby/network/garnet/BaseGarnetNetwork.hh
@@ -80,7 +80,6 @@ class BaseGarnetNetwork : public Network
virtual void checkNetworkAllocation(NodeID id, bool ordered,
int network_num, std::string vnet_type) = 0;
- Cycles getRubyStartTime();
void clearStats();
void printStats(std::ostream& out) const;
void printPerformanceStats(std::ostream& out) const;
@@ -102,8 +101,6 @@ class BaseGarnetNetwork : public Network
std::vector<std::vector<MessageBuffer*> > m_toNetQueues;
std::vector<std::vector<MessageBuffer*> > m_fromNetQueues;
-
- Cycles m_ruby_start;
};
#endif // __MEM_RUBY_NETWORK_GARNET_BASEGARNETNETWORK_HH__
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc
index c4965af17..4b1e0d0d7 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc
@@ -270,7 +270,7 @@ GarnetNetwork_d::printLinkStats(ostream& out) const
for (int i = 0; i < m_link_ptr_vector.size(); i++) {
average_link_utilization +=
(double(m_link_ptr_vector[i]->getLinkUtilization())) /
- (double(curCycle() - m_ruby_start));
+ (double(curCycle() - g_ruby_start));
vector<int> vc_load = m_link_ptr_vector[i]->getVcLoad();
for (int j = 0; j < vc_load.size(); j++) {
@@ -289,7 +289,7 @@ GarnetNetwork_d::printLinkStats(ostream& out) const
continue;
average_vc_load[i] = (double(average_vc_load[i])) /
- (double(curCycle() - m_ruby_start));
+ (double(curCycle() - g_ruby_start));
out << "Average VC Load [" << i << "] = " << average_vc_load[i]
<< " flits/cycle " << endl;
}
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 7db9db56b..82d89912e 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc
@@ -53,7 +53,7 @@ InputUnit_d::InputUnit_d(int id, Router_d *router) : Consumer(router)
// Instantiating the virtual channels
m_vcs.resize(m_num_vcs);
for (int i=0; i < m_num_vcs; i++) {
- m_vcs[i] = new VirtualChannel_d(i, m_router->curCycle());
+ m_vcs[i] = new VirtualChannel_d(i);
}
}
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 e49216476..adf1c1a4d 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc
@@ -71,7 +71,6 @@ NetworkInterface_d::NetworkInterface_d(int id, int virtual_networks,
for (int i = 0; i < m_num_vcs; i++) {
m_out_vc_state.push_back(new OutVcState_d(i, m_net_ptr));
- m_out_vc_state[i]->setState(IDLE_, m_net_ptr->curCycle());
}
}
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc
index d006591c0..a11bf0c2d 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc
@@ -33,16 +33,15 @@
#include "mem/ruby/system/System.hh"
OutVcState_d::OutVcState_d(int id, GarnetNetwork_d *network_ptr)
+ : m_time(0)
{
- m_network_ptr = network_ptr;
m_id = id;
m_vc_state = IDLE_;
- m_time = m_network_ptr->curCycle();
- if (m_network_ptr->get_vnet_type(id) == DATA_VNET_)
- m_credit_count = m_network_ptr->getBuffersPerDataVC();
+ if (network_ptr->get_vnet_type(id) == DATA_VNET_)
+ m_credit_count = network_ptr->getBuffersPerDataVC();
else
- m_credit_count = m_network_ptr->getBuffersPerCtrlVC();
+ m_credit_count = network_ptr->getBuffersPerCtrlVC();
assert(m_credit_count >= 1);
}
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.hh
index 07b197cf5..08ceecec0 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.hh
@@ -61,7 +61,6 @@ class OutVcState_d
inline void decrement_credit() { m_credit_count--; }
private:
- GarnetNetwork_d *m_network_ptr;
int m_id ;
Cycles m_time;
VC_state_type m_vc_state;
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc
index bfeecbc25..510a79e8d 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc
@@ -30,13 +30,13 @@
#include "mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh"
-VirtualChannel_d::VirtualChannel_d(int id, Cycles curTime)
+VirtualChannel_d::VirtualChannel_d(int id)
: m_enqueue_time(INFINITE_)
{
m_id = id;
m_input_buffer = new flitBuffer_d();
m_vc_state.first = IDLE_;
- m_vc_state.second = curTime;
+ m_vc_state.second = Cycles(0);
}
VirtualChannel_d::~VirtualChannel_d()
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh
index 9e8b95d9d..d19630305 100644
--- a/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh
@@ -39,7 +39,7 @@
class VirtualChannel_d
{
public:
- VirtualChannel_d(int id, Cycles curTime);
+ VirtualChannel_d(int id);
~VirtualChannel_d();
bool need_stage(VC_state_type state, flit_stage stage, Cycles curTime);
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc
index ed75a26d1..ee54dc2c5 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc
@@ -254,7 +254,7 @@ GarnetNetwork::printLinkStats(ostream& out) const
for (int i = 0; i < m_link_ptr_vector.size(); i++) {
average_link_utilization +=
(double(m_link_ptr_vector[i]->getLinkUtilization())) /
- (double(curCycle() - m_ruby_start));
+ (double(curCycle() - g_ruby_start));
vector<int> vc_load = m_link_ptr_vector[i]->getVcLoad();
for (int j = 0; j < vc_load.size(); j++) {
@@ -273,7 +273,7 @@ GarnetNetwork::printLinkStats(ostream& out) const
continue;
average_vc_load[i] = double(average_vc_load[i]) /
- (double(curCycle() - m_ruby_start));
+ (double(curCycle() - g_ruby_start));
out << "Average VC Load [" << i << "] = " << average_vc_load[i]
<< " flits/cycle " << endl;
}
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc
index 870560af0..09e068557 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc
@@ -68,7 +68,6 @@ NetworkInterface::NetworkInterface(int id, int virtual_networks,
for (int i = 0; i < m_num_vcs; i++) {
m_out_vc_state.push_back(new OutVcState(i));
- m_out_vc_state[i]->setState(IDLE_, m_net_ptr->curCycle());
}
}
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/OutVcState.cc b/src/mem/ruby/network/garnet/flexible-pipeline/OutVcState.cc
index e08f7f93a..114baa5cd 100644
--- a/src/mem/ruby/network/garnet/flexible-pipeline/OutVcState.cc
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/OutVcState.cc
@@ -31,6 +31,7 @@
#include "mem/ruby/network/garnet/flexible-pipeline/OutVcState.hh"
OutVcState::OutVcState(int id)
+ : m_time(0)
{
m_id = id;
m_vc_state = IDLE_;