changeset fa4eedccce17 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=fa4eedccce17
description:
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:
src/mem/ruby/common/Global.cc | 1 +
src/mem/ruby/common/Global.hh | 5 +
src/mem/ruby/network/garnet/BaseGarnetNetwork.cc | 9 +--
src/mem/ruby/network/garnet/BaseGarnetNetwork.hh | 3 -
src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc | 4 +-
src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc | 2 +-
src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc | 1 -
src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc | 9 +-
src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.hh | 1 -
src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc | 4 +-
src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh | 2 +-
src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc | 4 +-
src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc | 1 -
src/mem/ruby/network/garnet/flexible-pipeline/OutVcState.cc | 1 +
src/mem/ruby/network/orion/NetworkPower.cc | 5 +-
src/mem/ruby/profiler/Profiler.cc | 6 +-
src/mem/ruby/system/System.cc | 34
++++++---
src/mem/ruby/system/System.hh | 2 -
18 files changed, 44 insertions(+), 50 deletions(-)
diffs (truncated from 350 to 300 lines):
diff -r c5b24e8ed428 -r fa4eedccce17 src/mem/ruby/common/Global.cc
--- a/src/mem/ruby/common/Global.cc Mon Apr 22 13:20:34 2013 -0400
+++ b/src/mem/ruby/common/Global.cc Tue Apr 23 00:03:02 2013 -0500
@@ -32,3 +32,4 @@
RubySystem* g_system_ptr = 0;
vector<map<uint32_t, AbstractController *> > g_abs_controls;
+Cycles g_ruby_start;
diff -r c5b24e8ed428 -r fa4eedccce17 src/mem/ruby/common/Global.hh
--- a/src/mem/ruby/common/Global.hh Mon Apr 22 13:20:34 2013 -0400
+++ b/src/mem/ruby/common/Global.hh Tue Apr 23 00:03:02 2013 -0500
@@ -33,6 +33,7 @@
#include <vector>
#include "base/str.hh"
+#include "base/types.hh"
class RubySystem;
extern RubySystem* g_system_ptr;
@@ -40,5 +41,9 @@
class AbstractController;
extern std::vector<std::map<uint32_t, AbstractController *> > g_abs_controls;
+// A globally visible time at which the actual execution started. Meant only
+// for components with in Ruby. Initialized in RubySystem::startup().
+extern Cycles g_ruby_start;
+
#endif // __MEM_RUBY_COMMON_GLOBAL_HH__
diff -r c5b24e8ed428 -r fa4eedccce17
src/mem/ruby/network/garnet/BaseGarnetNetwork.cc
--- a/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc Mon Apr 22 13:20:34
2013 -0400
+++ b/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc Tue Apr 23 00:03:02
2013 -0500
@@ -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 @@
void
BaseGarnetNetwork::clearStats()
{
- m_ruby_start = curCycle();
-}
-
-Cycles
-BaseGarnetNetwork::getRubyStartTime()
-{
- return m_ruby_start;
}
void
diff -r c5b24e8ed428 -r fa4eedccce17
src/mem/ruby/network/garnet/BaseGarnetNetwork.hh
--- a/src/mem/ruby/network/garnet/BaseGarnetNetwork.hh Mon Apr 22 13:20:34
2013 -0400
+++ b/src/mem/ruby/network/garnet/BaseGarnetNetwork.hh Tue Apr 23 00:03:02
2013 -0500
@@ -80,7 +80,6 @@
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 @@
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 -r c5b24e8ed428 -r fa4eedccce17
src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc
--- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc Mon Apr
22 13:20:34 2013 -0400
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc Tue Apr
23 00:03:02 2013 -0500
@@ -270,7 +270,7 @@
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 @@
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 -r c5b24e8ed428 -r fa4eedccce17
src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc
--- a/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc Mon Apr 22
13:20:34 2013 -0400
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc Tue Apr 23
00:03:02 2013 -0500
@@ -53,7 +53,7 @@
// 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 -r c5b24e8ed428 -r fa4eedccce17
src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc
--- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc Mon Apr
22 13:20:34 2013 -0400
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc Tue Apr
23 00:03:02 2013 -0500
@@ -71,7 +71,6 @@
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 -r c5b24e8ed428 -r fa4eedccce17
src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc
--- a/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc Mon Apr
22 13:20:34 2013 -0400
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc Tue Apr
23 00:03:02 2013 -0500
@@ -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 -r c5b24e8ed428 -r fa4eedccce17
src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.hh
--- a/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.hh Mon Apr
22 13:20:34 2013 -0400
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.hh Tue Apr
23 00:03:02 2013 -0500
@@ -61,7 +61,6 @@
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 -r c5b24e8ed428 -r fa4eedccce17
src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc
--- a/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc Mon Apr
22 13:20:34 2013 -0400
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc Tue Apr
23 00:03:02 2013 -0500
@@ -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 -r c5b24e8ed428 -r fa4eedccce17
src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh
--- a/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh Mon Apr
22 13:20:34 2013 -0400
+++ b/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh Tue Apr
23 00:03:02 2013 -0500
@@ -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 -r c5b24e8ed428 -r fa4eedccce17
src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc
--- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc Mon Apr
22 13:20:34 2013 -0400
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc Tue Apr
23 00:03:02 2013 -0500
@@ -254,7 +254,7 @@
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 @@
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 -r c5b24e8ed428 -r fa4eedccce17
src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc
--- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc Mon Apr
22 13:20:34 2013 -0400
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc Tue Apr
23 00:03:02 2013 -0500
@@ -68,7 +68,6 @@
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 -r c5b24e8ed428 -r fa4eedccce17
src/mem/ruby/network/garnet/flexible-pipeline/OutVcState.cc
--- a/src/mem/ruby/network/garnet/flexible-pipeline/OutVcState.cc Mon Apr
22 13:20:34 2013 -0400
+++ b/src/mem/ruby/network/garnet/flexible-pipeline/OutVcState.cc Tue Apr
23 00:03:02 2013 -0500
@@ -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_;
diff -r c5b24e8ed428 -r fa4eedccce17 src/mem/ruby/network/orion/NetworkPower.cc
--- a/src/mem/ruby/network/orion/NetworkPower.cc Mon Apr 22 13:20:34
2013 -0400
+++ b/src/mem/ruby/network/orion/NetworkPower.cc Tue Apr 23 00:03:02
2013 -0500
@@ -39,7 +39,7 @@
{
//Network Activities from garnet
calculate_performance_numbers();
- double sim_cycles = curCycle() - m_network_ptr->getRubyStartTime();
+ double sim_cycles = curCycle() - g_ruby_start;
// Number of virtual networks/message classes declared in Ruby
// maybe greater than active virtual networks.
@@ -245,8 +245,7 @@
channel_width_bits,
orion_cfg_ptr);
- double sim_cycles =
- (double)(m_net_ptr->curCycle() - m_net_ptr->getRubyStartTime());
+ double sim_cycles = (double)(m_net_ptr->curCycle() - g_ruby_start);
// Dynamic Power
// Assume half the bits flipped on every link activity
diff -r c5b24e8ed428 -r fa4eedccce17 src/mem/ruby/profiler/Profiler.cc
--- a/src/mem/ruby/profiler/Profiler.cc Mon Apr 22 13:20:34 2013 -0400
+++ b/src/mem/ruby/profiler/Profiler.cc Tue Apr 23 00:03:02 2013 -0500
@@ -515,11 +515,7 @@
m_cycles_executed_at_start.resize(m_num_of_sequencers);
for (int i = 0; i < m_num_of_sequencers; i++) {
- if (g_system_ptr == NULL) {
- m_cycles_executed_at_start[i] = 0;
- } else {
- m_cycles_executed_at_start[i] = g_system_ptr->curCycle();
- }
+ m_cycles_executed_at_start[i] = g_system_ptr->curCycle();
}
m_busyBankCount = 0;
diff -r c5b24e8ed428 -r fa4eedccce17 src/mem/ruby/system/System.cc
--- a/src/mem/ruby/system/System.cc Mon Apr 22 13:20:34 2013 -0400
+++ b/src/mem/ruby/system/System.cc Tue Apr 23 00:03:02 2013 -0500
@@ -94,13 +94,6 @@
}
void
-RubySystem::init()
-{
- m_profiler_ptr->clearStats();
- m_network_ptr->clearStats();
-}
-
-void
RubySystem::registerNetwork(Network* network_ptr)
{
m_network_ptr = network_ptr;
@@ -311,12 +304,6 @@
void
RubySystem::unserialize(Checkpoint *cp, const string §ion)
{
- //
- // The main purpose for clearing stats in the unserialize process is so
- // that the profiler can correctly set its start time to the unserialized
- // value of curTick()
- //
- resetStats();
uint8_t *uncompressed_trace = NULL;
if (m_mem_vec_ptr != NULL) {
@@ -368,6 +355,23 @@
void
RubySystem::startup()
{
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev