ruby: Converted Garnet to M5 configuration

This commit is contained in:
Brad Beckmann 2010-01-29 20:29:32 -08:00
parent b544462505
commit 8dd45674ae
27 changed files with 297 additions and 202 deletions

View file

@ -41,6 +41,8 @@ parser.add_option("--topology", type="string", default="crossbar",
help="'crossbar'|'mesh'")
parser.add_option("--mesh-rows", type="int", default=1,
help="the number of rows in the mesh topology")
parser.add_option("--garnet-network", type="string", default=none,
help="'fixed'|'flexible'")
# Run duration options
parser.add_option("-m", "--maxtick", type="int", default=m5.MaxTick,

View file

@ -90,7 +90,12 @@ def create_system(options, physmem, piobus = None, dma_devices = []):
len(cpu_sequencers),
options.mesh_rows)
network = SimpleNetwork(topology = net_topology)
if options.garnet_network == "fixed":
network = GarnetNetwork_d(topology = net_topology)
elif options.garnet_network == "flexible":
network = GarnetNetwork(topology = net_topology)
else:
network = SimpleNetwork(topology = net_topology)
#
# determine the total memory size of the ruby system and verify it is equal

View file

@ -0,0 +1,46 @@
/*
* Copyright (c) 2008 Princeton University
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met: redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer;
* redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Authors: Niket Agarwal
*/
#include "mem/ruby/network/garnet/BaseGarnetNetwork.hh"
BaseGarnetNetwork::BaseGarnetNetwork(const Params *p)
: Network(p)
{
m_flit_size = p->flit_size;
m_number_of_pipe_stages = p->number_of_pipe_stages;
m_vcs_per_class = p->vcs_per_class;
m_buffer_size = p->buffer_size;
m_using_network_testing = p->using_network_testing;
}
void BaseGarnetNetwork::init()
{
Network::init();
}

View file

@ -33,40 +33,33 @@
* required by the interconnection network.
*/
#ifndef NETWORKCONFIG_H
#define NETWORKCONFIG_H
#ifndef BASEGARNETNETWORK_H
#define BASEGARNETNETWORK_H
#include "mem/ruby/network/garnet/NetworkHeader.hh"
#include "mem/gems_common/util.hh"
#include "mem/ruby/network/Network.hh"
#include "params/BaseGarnetNetwork.hh"
class BaseGarnetNetwork : public Network {
public:
typedef BaseGarnetNetworkParams Params;
BaseGarnetNetwork(const Params *p);
void init();
bool isNetworkTesting() {return m_using_network_testing; }
int getFlitSize() {return m_flit_size; }
int getNumPipeStages() {return m_number_of_pipe_stages; }
int getVCsPerClass() {return m_vcs_per_class; }
int getBufferSize() {return m_buffer_size; }
protected:
int m_flit_size;
int m_number_of_pipe_stages;
int m_vcs_per_class;
int m_buffer_size;
bool m_using_network_testing;
class NetworkConfig {
private:
int m_flit_size;
int m_number_of_pipe_stages;
int m_vcs_per_class;
int m_buffer_size;
bool m_using_network_testing;
public:
NetworkConfig(){}
void init() {
for (size_t i=0; i<argv.size(); i+=2) {
if (argv[i] == "flit_size")
m_flit_size = atoi(argv[i+1].c_str());
else if (argv[i] == "number_of_pipe_stages")
m_number_of_pipe_stages = atoi(argv[i+1].c_str());
else if (argv[i] == "vcs_per_class")
m_vcs_per_class = atoi(argv[i+1].c_str());
else if (argv[i] == "buffer_size")
m_buffer_size = atoi(argv[i+1].c_str());
else if (argv[i] == "using_network_testing")
m_using_network_testing = atoi(argv[i+1].c_str());
}
}
bool isNetworkTesting() {return m_using_network_testing; }
int getFlitSize() {return m_flit_size; }
int getNumPipeStages() {return m_number_of_pipe_stages; }
int getVCsPerClass() {return m_vcs_per_class; }
int getBufferSize() {return m_buffer_size; }
};

View file

@ -0,0 +1,11 @@
from m5.params import *
from Network import RubyNetwork
class BaseGarnetNetwork(RubyNetwork):
type = 'BaseGarnetNetwork'
abstract = True
flit_size = Param.Int(16, "flit size in bytes")
number_of_pipe_stages = Param.Int(4, "router pipeline stages");
vcs_per_class = Param.Int(4, "virtual channels per message class");
buffer_size = Param.Int(4, "buffer size in bytes");
using_network_testing = Param.Bool(False, "network testing enable");

View file

@ -41,8 +41,6 @@ enum flit_type {HEAD_, BODY_, TAIL_, HEAD_TAIL_, NUM_FLIT_TYPE_};
enum VC_state_type {IDLE_, VC_AB_, ACTIVE_, NUM_VC_STATE_TYPE_};
enum flit_stage {I_, VA_, SA_, ST_, LT_, NUM_FLIT_STAGE_};
#define NETCONFIG_DEFAULTS "netconfig.defaults"
#define INFINITE_ 10000
#endif

View file

@ -0,0 +1,39 @@
# -*- mode:python -*-
# Copyright (c) 2009 The Hewlett-Packard Development Company
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer;
# redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution;
# neither the name of the copyright holders nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Authors: Nathan Binkert
Import('*')
if not env['RUBY']:
Return()
SimObject('BaseGarnetNetwork.py')
Source('BaseGarnetNetwork.cc')

View file

@ -38,69 +38,67 @@
#include "mem/ruby/network/garnet/fixed-pipeline/CreditLink_d.hh"
#include "mem/ruby/common/NetDest.hh"
GarnetNetwork_d::GarnetNetwork_d(const string & name)
: Network(name)
GarnetNetwork_d::GarnetNetwork_d(const Params *p)
: BaseGarnetNetwork(p)
{
m_ruby_start = 0;
m_flits_recieved = 0;
m_flits_injected = 0;
m_network_latency = 0.0;
m_queueing_latency = 0.0;
m_router_ptr_vector.clear();
// Allocate to and from queues
m_toNetQueues.setSize(m_nodes); // Queues that are getting messages from protocol
m_fromNetQueues.setSize(m_nodes); // Queues that are feeding the protocol
m_in_use.setSize(m_virtual_networks);
m_ordered.setSize(m_virtual_networks);
for (int i = 0; i < m_virtual_networks; i++)
{
m_in_use[i] = false;
m_ordered[i] = false;
}
for (int node = 0; node < m_nodes; node++)
{
//Setting how many vitual message buffers will there be per Network Queue
m_toNetQueues[node].setSize(m_virtual_networks);
m_fromNetQueues[node].setSize(m_virtual_networks);
for (int j = 0; j < m_virtual_networks; j++)
{
m_toNetQueues[node][j] = new MessageBuffer(); // Instantiating the Message Buffers that interact with the coherence protocol
m_fromNetQueues[node][j] = new MessageBuffer();
}
}
}
void GarnetNetwork_d::init()
{
Network::init(argv);
BaseGarnetNetwork::init();
//added by SS
m_network_config_ptr = new NetworkConfig;
m_network_config_ptr->init(argv);
//
// The topology pointer should have already been initialized in the parent
// network constructor.
//
assert(m_topology_ptr != NULL);
m_ruby_start = 0;
m_flits_recieved = 0;
m_flits_injected = 0;
m_network_latency = 0.0;
m_queueing_latency = 0.0;
int number_of_routers = m_topology_ptr->numSwitches();
for (int i=0; i<number_of_routers; i++) {
m_router_ptr_vector.insertAtBottom(new Router_d(i, this));
}
m_router_ptr_vector.clear();
// Allocate to and from queues
m_toNetQueues.setSize(m_nodes); // Queues that are getting messages from protocol
m_fromNetQueues.setSize(m_nodes); // Queues that are feeding the protocol
m_in_use.setSize(m_virtual_networks);
m_ordered.setSize(m_virtual_networks);
for (int i = 0; i < m_virtual_networks; i++)
{
m_in_use[i] = false;
m_ordered[i] = false;
}
for (int node = 0; node < m_nodes; node++)
{
//Setting how many vitual message buffers will there be per Network Queue
m_toNetQueues[node].setSize(m_virtual_networks);
m_fromNetQueues[node].setSize(m_virtual_networks);
for (int j = 0; j < m_virtual_networks; j++)
{
m_toNetQueues[node][j] = new MessageBuffer(); // Instantiating the Message Buffers that interact with the coherence protocol
m_fromNetQueues[node][j] = new MessageBuffer();
}
}
// Setup the network switches
m_topology_ptr->makeTopology();
int number_of_routers = m_topology_ptr->numSwitches();
for (int i=0; i<number_of_routers; i++) {
m_router_ptr_vector.insertAtBottom(new Router_d(i, this));
}
for (int i=0; i < m_nodes; i++) {
NetworkInterface_d *ni = new NetworkInterface_d(i, m_virtual_networks, this);
ni->addNode(m_toNetQueues[i], m_fromNetQueues[i]);
m_ni_ptr_vector.insertAtBottom(ni);
}
m_topology_ptr->createLinks(this, false); // false because this isn't a reconfiguration
for(int i = 0; i < m_router_ptr_vector.size(); i++)
{
m_router_ptr_vector[i]->init();
}
for (int i=0; i < m_nodes; i++) {
NetworkInterface_d *ni = new NetworkInterface_d(i, m_virtual_networks, this);
ni->addNode(m_toNetQueues[i], m_fromNetQueues[i]);
m_ni_ptr_vector.insertAtBottom(ni);
}
m_topology_ptr->createLinks(this, false); // false because this isn't a reconfiguration
for(int i = 0; i < m_router_ptr_vector.size(); i++)
{
m_router_ptr_vector[i]->init();
}
}
GarnetNetwork_d::~GarnetNetwork_d()
@ -245,9 +243,9 @@ Time GarnetNetwork_d::getRubyStartTime()
void GarnetNetwork_d::printStats(ostream& out) const
{ double average_link_utilization = 0;
Vector<double > average_vc_load;
average_vc_load.setSize(m_virtual_networks*m_network_config_ptr->getVCsPerClass());
average_vc_load.setSize(m_virtual_networks*m_vcs_per_class);
for(int i = 0; i < m_virtual_networks*m_network_config_ptr->getVCsPerClass(); i++)
for(int i = 0; i < m_virtual_networks*m_vcs_per_class; i++)
{
average_vc_load[i] = 0;
}
@ -263,7 +261,7 @@ void GarnetNetwork_d::printStats(ostream& out) const
Vector<int > vc_load = m_link_ptr_vector[i]->getVcLoad();
for(int j = 0; j < vc_load.size(); j++)
{
assert(vc_load.size() == m_network_config_ptr->getVCsPerClass()*m_virtual_networks);
assert(vc_load.size() == m_vcs_per_class*m_virtual_networks);
average_vc_load[j] += vc_load[j];
}
}
@ -271,7 +269,7 @@ void GarnetNetwork_d::printStats(ostream& out) const
out << "Average Link Utilization :: " << average_link_utilization << " flits/cycle" << endl;
out << "-------------" << endl;
for(int i = 0; i < m_network_config_ptr->getVCsPerClass()*m_virtual_networks; i++)
for(int i = 0; i < m_vcs_per_class*m_virtual_networks; i++)
{
average_vc_load[i] = (double(average_vc_load[i]) / (double(g_eventQueue_ptr->getTime()) - m_ruby_start));
out << "Average VC Load [" << i << "] = " << average_vc_load[i] << " flits/cycle " << endl;
@ -348,3 +346,9 @@ void GarnetNetwork_d::print(ostream& out) const
{
out << "[GarnetNetwork_d]";
}
GarnetNetwork_d *
GarnetNetwork_dParams::create()
{
return new GarnetNetwork_d(this);
}

View file

@ -33,8 +33,9 @@
#include "mem/ruby/network/garnet/NetworkHeader.hh"
#include "mem/gems_common/Vector.hh"
#include "mem/ruby/network/garnet-flexible-pipeline/NetworkConfig.hh"
#include "mem/ruby/network/garnet/BaseGarnetNetwork.hh"
#include "mem/ruby/network/Network.hh"
#include "params/GarnetNetwork_d.hh"
class NetworkInterface_d;
class MessageBuffer;
@ -44,17 +45,15 @@ class NetDest;
class NetworkLink_d;
class CreditLink_d;
class GarnetNetwork_d : public Network{
class GarnetNetwork_d : public BaseGarnetNetwork {
public:
GarnetNetwork_d(const string & name);
typedef GarnetNetwork_dParams Params;
GarnetNetwork_d(const Params *p);
~GarnetNetwork_d();
void init();
//added by SS
NetworkConfig* getNetworkConfig() { return m_network_config_ptr; }
int getNumNodes(){ return m_nodes;}
// returns the queue requested for the given component
@ -99,8 +98,6 @@ public:
void makeInternalLink(SwitchID src, NodeID dest, const NetDest& routing_table_entry, int link_latency, int link_weight, int bw_multiplier, bool isReconfiguration);
private:
NetworkConfig* m_network_config_ptr;
void checkNetworkAllocation(NodeID id, bool ordered, int network_num);
// Private copy constructor and assignment operator

View file

@ -0,0 +1,6 @@
from m5.params import *
from BaseGarnetNetwork import BaseGarnetNetwork
class GarnetNetwork_d(BaseGarnetNetwork):
type = 'GarnetNetwork_d'

View file

@ -38,7 +38,7 @@ NetworkInterface_d::NetworkInterface_d(int id, int virtual_networks, GarnetNetwo
m_id = id;
m_net_ptr = network_ptr;
m_virtual_networks = virtual_networks;
m_vc_per_vnet = m_net_ptr->getNetworkConfig()->getVCsPerClass();
m_vc_per_vnet = m_net_ptr->getVCsPerClass();
m_num_vcs = m_vc_per_vnet*m_virtual_networks;
m_vc_round_robin = 0;
@ -109,7 +109,7 @@ bool NetworkInterface_d::flitisizeMessage(MsgPtr msg_ptr, int vnet)
NetDest net_msg_dest = net_msg_ptr->getInternalDestination();
Vector<NodeID> dest_nodes = net_msg_dest.getAllDest(); // gets all the destinations associated with this message.
int num_flits = (int) ceil((double) m_net_ptr->MessageSizeType_to_int(net_msg_ptr->getMessageSize())/m_net_ptr->getNetworkConfig()->getFlitSize() ); // Number of flits is dependent on the link bandwidth available. This is expressed in terms of bytes/cycle or the flit size
int num_flits = (int) ceil((double) m_net_ptr->MessageSizeType_to_int(net_msg_ptr->getMessageSize())/m_net_ptr->getFlitSize() ); // Number of flits is dependent on the link bandwidth available. This is expressed in terms of bytes/cycle or the flit size
for(int ctr = 0; ctr < dest_nodes.size(); ctr++) // loop because we will be converting all multicast messages into unicast messages
{
@ -216,7 +216,7 @@ void NetworkInterface_d::wakeup()
if(t_flit->get_type() == TAIL_ || t_flit->get_type() == HEAD_TAIL_)
{
free_signal = true;
if(!m_net_ptr->getNetworkConfig()->isNetworkTesting()) // When we are doing network only testing, the messages do not have to be buffered into the message buffers
if(!m_net_ptr->isNetworkTesting()) // When we are doing network only testing, the messages do not have to be buffered into the message buffers
{
outNode_ptr[t_flit->get_vnet()]->enqueue(t_flit->get_msg_ptr(), 1); // enqueueing for protocol buffer. This is not required when doing network only testing
}

View file

@ -29,7 +29,6 @@
*/
#include "mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh"
#include "mem/ruby/network/garnet-flexible-pipeline/NetworkConfig.hh"
#include "mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh"
/*
@ -54,9 +53,9 @@ NetworkLink_d::NetworkLink_d(int id, int link_latency, GarnetNetwork_d *net_ptr)
m_latency = link_latency;
linkBuffer = new flitBuffer_d();
m_link_utilized = 0;
m_vc_load.setSize(m_net_ptr->getNetworkConfig()->getVCsPerClass()*net_ptr->getNumberOfVirtualNetworks());
m_vc_load.setSize(m_net_ptr->getVCsPerClass()*net_ptr->getNumberOfVirtualNetworks());
for(int i = 0; i < m_net_ptr->getNetworkConfig()->getVCsPerClass()*net_ptr->getNumberOfVirtualNetworks(); i++)
for(int i = 0; i < m_net_ptr->getVCsPerClass()*net_ptr->getNumberOfVirtualNetworks(); i++)
m_vc_load[i] = 0;
}

View file

@ -53,8 +53,8 @@ public:
int get_id(){return m_id;}
void wakeup();
double calculate_offline_power(power_bus*);
double calculate_power();
double calculate_offline_power(power_bus*) { return 0.0; }
double calculate_power() { return 0.0; }
inline bool isReady()
{

View file

@ -29,7 +29,6 @@
*/
#include "mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.hh"
#include "mem/ruby/network/garnet-flexible-pipeline/NetworkConfig.hh"
#include "mem/ruby/eventqueue/RubyEventQueue.hh"
OutVcState_d::OutVcState_d(int id, GarnetNetwork_d *network_ptr)
@ -38,5 +37,5 @@ OutVcState_d::OutVcState_d(int id, GarnetNetwork_d *network_ptr)
m_id = id;
m_vc_state = IDLE_;
m_time = g_eventQueue_ptr->getTime();
m_credit_count = m_network_ptr->getNetworkConfig()->getBufferSize();
m_credit_count = m_network_ptr->getBufferSize();
}

View file

@ -30,7 +30,6 @@
#include "mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh"
#include "mem/ruby/network/garnet/fixed-pipeline/Router_d.hh"
#include "mem/ruby/network/garnet-flexible-pipeline/NetworkConfig.hh"
OutputUnit_d::OutputUnit_d(int id, Router_d *router)
{

View file

@ -44,9 +44,9 @@ Router_d::Router_d(int id, GarnetNetwork_d *network_ptr)
m_id = id;
m_network_ptr = network_ptr;
m_virtual_networks = network_ptr->getNumberOfVirtualNetworks();
m_vc_per_vnet = m_network_ptr->getNetworkConfig()->getVCsPerClass();
m_vc_per_vnet = m_network_ptr->getVCsPerClass();
m_num_vcs = m_virtual_networks*m_vc_per_vnet;
m_flit_width = m_network_ptr->getNetworkConfig()->getFlitSize();
m_flit_width = m_network_ptr->getFlitSize();
m_routing_unit = new RoutingUnit_d(this);
m_vc_alloc = new VCallocator_d(this);

View file

@ -74,8 +74,11 @@ public:
void swarb_req();
void power_router_initialize(power_router *router, power_router_info *info);
double calculate_power();
double calculate_offline_power(power_router*, power_router_info*);
double calculate_power() { return 0.0; }
double calculate_offline_power(power_router*, power_router_info*)
{
return 0.0;
}
void calculate_performance_numbers();
private:

View file

@ -30,14 +30,13 @@
Import('*')
# temporarily disable
Return()
if not env['RUBY']:
Return()
Source('GarnetNetwork_d.cc')
Source('InputUnit_d.cc')
SimObject('GarnetNetwork_d.py')
Source('GarnetNetwork_d.cc', Werror=False)
Source('InputUnit_d.cc', Werror=False)
Source('NetworkInterface_d.cc')
Source('NetworkLink_d.cc')
Source('OutVcState_d.cc')

View file

@ -28,7 +28,6 @@
* Authors: Niket Agarwal
*/
#include "mem/ruby/network/garnet-flexible-pipeline/NetworkConfig.hh"
#include "mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.hh"
#include "mem/ruby/network/garnet/fixed-pipeline/Router_d.hh"
#include "mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh"

View file

@ -39,63 +39,54 @@
#include "mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh"
#include "mem/ruby/common/NetDest.hh"
GarnetNetwork::GarnetNetwork(const string & name)
: Network(name)
GarnetNetwork::GarnetNetwork(const Params *p)
: BaseGarnetNetwork(p)
{
m_ruby_start = 0;
// Allocate to and from queues
m_toNetQueues.setSize(m_nodes); // Queues that are getting messages from protocol
m_fromNetQueues.setSize(m_nodes); // Queues that are feeding the protocol
m_in_use.setSize(m_virtual_networks);
m_ordered.setSize(m_virtual_networks);
for (int i = 0; i < m_virtual_networks; i++)
{
m_in_use[i] = false;
m_ordered[i] = false;
}
for (int node = 0; node < m_nodes; node++)
{
//Setting how many vitual message buffers will there be per Network Queue
m_toNetQueues[node].setSize(m_virtual_networks);
m_fromNetQueues[node].setSize(m_virtual_networks);
for (int j = 0; j < m_virtual_networks; j++)
{
m_toNetQueues[node][j] = new MessageBuffer(); // Instantiating the Message Buffers that interact with the coherence protocol
m_fromNetQueues[node][j] = new MessageBuffer();
}
}
}
void GarnetNetwork::init()
{
// printf("hello\n");
Network::init(argv);
//added by SS
// assert (m_topology_ptr!=NULL);
BaseGarnetNetwork::init();
m_network_config_ptr = new NetworkConfig;
// Setup the network switches
assert (m_topology_ptr!=NULL);
m_network_config_ptr->init(argv);
int number_of_routers = m_topology_ptr->numSwitches();
for (int i=0; i<number_of_routers; i++) {
m_router_ptr_vector.insertAtBottom(new Router(i, this));
}
m_ruby_start = 0;
// Allocate to and from queues
m_toNetQueues.setSize(m_nodes); // Queues that are getting messages from protocol
m_fromNetQueues.setSize(m_nodes); // Queues that are feeding the protocol
m_in_use.setSize(m_virtual_networks);
m_ordered.setSize(m_virtual_networks);
for (int i = 0; i < m_virtual_networks; i++)
{
m_in_use[i] = false;
m_ordered[i] = false;
}
for (int node = 0; node < m_nodes; node++)
{
//Setting how many vitual message buffers will there be per Network Queue
m_toNetQueues[node].setSize(m_virtual_networks);
m_fromNetQueues[node].setSize(m_virtual_networks);
for (int j = 0; j < m_virtual_networks; j++)
{
m_toNetQueues[node][j] = new MessageBuffer(); // Instantiating the Message Buffers that interact with the coherence protocol
m_fromNetQueues[node][j] = new MessageBuffer();
}
}
// Setup the network switches
assert (m_topology_ptr!=NULL);
m_topology_ptr->makeTopology();
int number_of_routers = m_topology_ptr->numSwitches();
for (int i=0; i<number_of_routers; i++) {
m_router_ptr_vector.insertAtBottom(new Router(i, this));
}
for (int i=0; i < m_nodes; i++) {
NetworkInterface *ni = new NetworkInterface(i, m_virtual_networks, this);
ni->addNode(m_toNetQueues[i], m_fromNetQueues[i]);
m_ni_ptr_vector.insertAtBottom(ni);
}
m_topology_ptr->createLinks(this, false); // false because this isn't a reconfiguration
for (int i=0; i < m_nodes; i++) {
NetworkInterface *ni = new NetworkInterface(i, m_virtual_networks, this);
ni->addNode(m_toNetQueues[i], m_fromNetQueues[i]);
m_ni_ptr_vector.insertAtBottom(ni);
}
m_topology_ptr->createLinks(this, false); // false because this isn't a reconfiguration
}
GarnetNetwork::~GarnetNetwork()
@ -216,9 +207,9 @@ Time GarnetNetwork::getRubyStartTime()
void GarnetNetwork::printStats(ostream& out) const
{ double average_link_utilization = 0;
Vector<double > average_vc_load;
average_vc_load.setSize(m_virtual_networks*m_network_config_ptr->getVCsPerClass());
average_vc_load.setSize(m_virtual_networks*m_vcs_per_class);
for(int i = 0; i < m_virtual_networks*m_network_config_ptr->getVCsPerClass(); i++)
for(int i = 0; i < m_virtual_networks*m_vcs_per_class; i++)
{
average_vc_load[i] = 0;
}
@ -233,7 +224,7 @@ void GarnetNetwork::printStats(ostream& out) const
Vector<int > vc_load = m_link_ptr_vector[i]->getVcLoad();
for(int j = 0; j < vc_load.size(); j++)
{
assert(vc_load.size() == m_network_config_ptr->getVCsPerClass()*m_virtual_networks);
assert(vc_load.size() == m_vcs_per_class*m_virtual_networks);
average_vc_load[j] += vc_load[j];
}
}
@ -241,7 +232,7 @@ void GarnetNetwork::printStats(ostream& out) const
out << "Average Link Utilization :: " << average_link_utilization << " flits/cycle" <<endl;
out << "-------------" << endl;
for(int i = 0; i < m_network_config_ptr->getVCsPerClass()*m_virtual_networks; i++)
for(int i = 0; i < m_vcs_per_class*m_virtual_networks; i++)
{
average_vc_load[i] = (double(average_vc_load[i]) / (double(g_eventQueue_ptr->getTime()) - m_ruby_start));
out << "Average VC Load [" << i << "] = " << average_vc_load[i] << " flits/cycle" << endl;
@ -295,3 +286,9 @@ void GarnetNetwork::print(ostream& out) const
{
out << "[GarnetNetwork]";
}
GarnetNetwork *
GarnetNetworkParams::create()
{
return new GarnetNetwork(this);
}

View file

@ -32,9 +32,10 @@
#define GARNET_NETWORK_H
#include "mem/ruby/network/garnet/NetworkHeader.hh"
#include "mem/ruby/network/garnet/BaseGarnetNetwork.hh"
#include "mem/gems_common/Vector.hh"
#include "mem/ruby/network/garnet/flexible-pipeline/NetworkConfig.hh"
#include "mem/ruby/network/Network.hh"
#include "params/GarnetNetwork.hh"
class NetworkInterface;
class MessageBuffer;
@ -43,17 +44,15 @@ class Topology;
class NetDest;
class NetworkLink;
class GarnetNetwork : public Network{
class GarnetNetwork : public BaseGarnetNetwork {
public:
GarnetNetwork(const string & name);
typedef GarnetNetworkParams Params;
GarnetNetwork(const Params *p);
~GarnetNetwork();
~GarnetNetwork();
void init();
//added by SS
NetworkConfig* getNetworkConfig() { return m_network_config_ptr; }
// 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);
@ -100,8 +99,6 @@ private:
// Topology* m_topology_ptr;
Time m_ruby_start;
NetworkConfig* m_network_config_ptr;
};
// Output operator declaration

View file

@ -0,0 +1,6 @@
from m5.params import *
from BaseGarnetNetwork import BaseGarnetNetwork
class GarnetNetwork(BaseGarnetNetwork):
type = 'GarnetNetwork'

View file

@ -38,7 +38,7 @@ NetworkInterface::NetworkInterface(int id, int virtual_networks, GarnetNetwork *
m_id = id;
m_net_ptr = network_ptr;
m_virtual_networks = virtual_networks;
m_vc_per_vnet = m_net_ptr->getNetworkConfig()->getVCsPerClass();
m_vc_per_vnet = m_net_ptr->getVCsPerClass();
m_num_vcs = m_vc_per_vnet*m_virtual_networks;
m_vc_round_robin = 0;
@ -104,7 +104,7 @@ bool NetworkInterface::flitisizeMessage(MsgPtr msg_ptr, int vnet)
NetworkMessage *net_msg_ptr = dynamic_cast<NetworkMessage*>(msg_ptr.ref());
NetDest net_msg_dest = net_msg_ptr->getInternalDestination();
Vector<NodeID> dest_nodes = net_msg_dest.getAllDest(); // gets all the destinations associated with this message.
int num_flits = (int) ceil((double) m_net_ptr->MessageSizeType_to_int(net_msg_ptr->getMessageSize())/m_net_ptr->getNetworkConfig()->getFlitSize() ); // Number of flits is dependent on the link bandwidth available. This is expressed in terms of bytes/cycle or the flit size
int num_flits = (int) ceil((double) m_net_ptr->MessageSizeType_to_int(net_msg_ptr->getMessageSize())/m_net_ptr->getFlitSize() ); // Number of flits is dependent on the link bandwidth available. This is expressed in terms of bytes/cycle or the flit size
for(int ctr = 0; ctr < dest_nodes.size(); ctr++) // loop because we will be converting all multicast messages into unicast messages
{
@ -231,7 +231,7 @@ void NetworkInterface::wakeup()
DEBUG_EXPR(NETWORK_COMP, HighPrio, m_id);
DEBUG_MSG(NETWORK_COMP, HighPrio, "Message got delivered");
DEBUG_EXPR(NETWORK_COMP, HighPrio, g_eventQueue_ptr->getTime());
if(!m_net_ptr->getNetworkConfig()->isNetworkTesting()) // When we are doing network only testing, the messages do not have to be buffered into the message buffers
if(!m_net_ptr->isNetworkTesting()) // When we are doing network only testing, the messages do not have to be buffered into the message buffers
{
outNode_ptr[t_flit->get_vnet()]->enqueue(t_flit->get_msg_ptr(), 1); // enqueueing for protocol buffer. This is not required when doing network only testing
}

View file

@ -29,7 +29,6 @@
*/
#include "mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh"
#include "mem/ruby/network/garnet/flexible-pipeline/NetworkConfig.hh"
#include "mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh"
NetworkLink::NetworkLink(int id, int latency, GarnetNetwork *net_ptr)
@ -42,7 +41,7 @@ NetworkLink::NetworkLink(int id, int latency, GarnetNetwork *net_ptr)
m_net_ptr = net_ptr;
m_latency = latency;
int num_net = net_ptr->getNumberOfVirtualNetworks();
int num_vc = m_net_ptr->getNetworkConfig()->getVCsPerClass();
int num_vc = m_net_ptr->getVCsPerClass();
m_vc_load.setSize(num_net*num_vc);
for(int i = 0; i < num_net*num_vc; i++)

View file

@ -39,7 +39,7 @@ Router::Router(int id, GarnetNetwork *network_ptr)
m_id = id;
m_net_ptr = network_ptr;
m_virtual_networks = m_net_ptr->getNumberOfVirtualNetworks();
m_vc_per_vnet = m_net_ptr->getNetworkConfig()->getVCsPerClass();
m_vc_per_vnet = m_net_ptr->getVCsPerClass();
m_round_robin_inport = 0;
m_round_robin_start = 0;
m_num_vcs = m_vc_per_vnet*m_virtual_networks;
@ -98,7 +98,7 @@ void Router::addOutPort(NetworkLink *out_link, const NetDest& routing_table_entr
Vector<flitBuffer *> intermediateQueues;
for(int i = 0; i < m_num_vcs; i++)
{
intermediateQueues.insertAtBottom(new flitBuffer(m_net_ptr->getNetworkConfig()->getBufferSize()));
intermediateQueues.insertAtBottom(new flitBuffer(m_net_ptr->getBufferSize()));
}
m_router_buffers.insertAtBottom(intermediateQueues);
@ -241,17 +241,17 @@ void Router::routeCompute(flit *m_flit, int inport)
int outport = m_in_vc_state[inport][invc]->get_outport();
int outvc = m_in_vc_state[inport][invc]->get_outvc();
assert(m_net_ptr->getNetworkConfig()->getNumPipeStages() >= 1);
m_flit->set_time(g_eventQueue_ptr->getTime() + (m_net_ptr->getNetworkConfig()->getNumPipeStages() - 1)); // Becasuse 1 cycle will be consumed in scheduling the output link
assert(m_net_ptr->getNumPipeStages() >= 1);
m_flit->set_time(g_eventQueue_ptr->getTime() + (m_net_ptr->getNumPipeStages() - 1)); // Becasuse 1 cycle will be consumed in scheduling the output link
m_flit->set_vc(outvc);
m_router_buffers[outport][outvc]->insert(m_flit);
if(m_net_ptr->getNetworkConfig()->getNumPipeStages() > 1)
g_eventQueue_ptr->scheduleEvent(this, m_net_ptr->getNetworkConfig()->getNumPipeStages() -1 );
if(m_net_ptr->getNumPipeStages() > 1)
g_eventQueue_ptr->scheduleEvent(this, m_net_ptr->getNumPipeStages() -1 );
if((m_flit->get_type() == HEAD_) || (m_flit->get_type() == HEAD_TAIL_))
{
NetDest destination = dynamic_cast<NetworkMessage*>(m_flit->get_msg_ptr().ref())->getInternalDestination();
if(m_net_ptr->getNetworkConfig()->getNumPipeStages() > 1)
if(m_net_ptr->getNumPipeStages() > 1)
{
m_out_vc_state[outport][outvc]->setState(VC_AB_, g_eventQueue_ptr->getTime() + 1);
m_out_link[outport]->request_vc_link(outvc, destination, g_eventQueue_ptr->getTime() + 1);

View file

@ -30,12 +30,11 @@
Import('*')
# temporarily disable
Return()
if not env['RUBY']:
Return()
SimObject('GarnetNetwork.py')
Source('GarnetNetwork.cc')
Source('InVcState.cc')
Source('NetworkInterface.cc')

View file

@ -53,8 +53,6 @@
#include "mem/ruby/network/simple/Topology.hh"
#include "mem/ruby/network/simple/SimpleNetwork.hh"
#include "mem/ruby/system/RubyPort.hh"
//#include "mem/ruby/network/garnet-flexible-pipeline/GarnetNetwork.hh"
//#include "mem/ruby/network/garnet-fixed-pipeline/GarnetNetwork_d.hh"
#include "mem/ruby/system/MemoryControl.hh"
#include "base/output.hh"