diff options
author | Brad Beckmann <Brad.Beckmann@amd.com> | 2010-01-29 20:29:32 -0800 |
---|---|---|
committer | Brad Beckmann <Brad.Beckmann@amd.com> | 2010-01-29 20:29:32 -0800 |
commit | 8dd45674aef2822d4c6cb57f1a4aedc7d9ee311c (patch) | |
tree | 47d5d83cfdd2a6ff7025c3417fd843b7cd16841f /src | |
parent | b5444625056a93cd676c512a891b0c13c44cf58b (diff) | |
download | gem5-8dd45674aef2822d4c6cb57f1a4aedc7d9ee311c.tar.xz |
ruby: Converted Garnet to M5 configuration
Diffstat (limited to 'src')
25 files changed, 293 insertions, 205 deletions
diff --git a/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc b/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc new file mode 100644 index 000000000..4a0d4157b --- /dev/null +++ b/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc @@ -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(); +} diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkConfig.hh b/src/mem/ruby/network/garnet/BaseGarnetNetwork.hh index 44900d25e..1c90c2ca2 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkConfig.hh +++ b/src/mem/ruby/network/garnet/BaseGarnetNetwork.hh @@ -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; } }; diff --git a/src/mem/ruby/network/garnet/BaseGarnetNetwork.py b/src/mem/ruby/network/garnet/BaseGarnetNetwork.py new file mode 100644 index 000000000..b441b0136 --- /dev/null +++ b/src/mem/ruby/network/garnet/BaseGarnetNetwork.py @@ -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"); diff --git a/src/mem/ruby/network/garnet/NetworkHeader.hh b/src/mem/ruby/network/garnet/NetworkHeader.hh index 62ed9a12c..1922df5ea 100644 --- a/src/mem/ruby/network/garnet/NetworkHeader.hh +++ b/src/mem/ruby/network/garnet/NetworkHeader.hh @@ -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 diff --git a/src/mem/ruby/network/garnet/SConscript b/src/mem/ruby/network/garnet/SConscript new file mode 100644 index 000000000..14540426f --- /dev/null +++ b/src/mem/ruby/network/garnet/SConscript @@ -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') + 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 11a34c0ce..7e9fe0762 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc @@ -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); - - //added by SS - m_network_config_ptr = new NetworkConfig; - m_network_config_ptr->init(argv); - - 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(); - } - } - - // 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(); - } + BaseGarnetNetwork::init(); + + // + // The topology pointer should have already been initialized in the parent + // network constructor. + // + assert(m_topology_ptr != NULL); + + 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(); + } } 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); +} diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh index ccd3e379a..8a36c1572 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh @@ -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 diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.py b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.py new file mode 100644 index 000000000..40a8bfb79 --- /dev/null +++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.py @@ -0,0 +1,6 @@ +from m5.params import * +from BaseGarnetNetwork import BaseGarnetNetwork + +class GarnetNetwork_d(BaseGarnetNetwork): + type = 'GarnetNetwork_d' + 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 4ba885f60..26399e68e 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc @@ -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 } diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc index 229497085..92b2d44f8 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc @@ -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; } diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh index 1fad7509d..6ee1dcdfb 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh @@ -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() { 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 958886573..921f8701a 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc @@ -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(); } diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc index 8a371bb5f..7934dc9bd 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc @@ -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) { diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc index 89a893e3a..7185249e4 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc @@ -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); diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.hh index eca621479..505353089 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.hh @@ -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: diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/SConscript b/src/mem/ruby/network/garnet/fixed-pipeline/SConscript index 84f4ba378..d3cf45878 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/SConscript +++ b/src/mem/ruby/network/garnet/fixed-pipeline/SConscript @@ -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') diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc index 7bfb4948d..e08c70769 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc @@ -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" diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc index a88263c62..82f664d26 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc +++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc @@ -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); - - m_network_config_ptr = new NetworkConfig; - - m_network_config_ptr->init(argv); - - 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 + BaseGarnetNetwork::init(); + + // Setup the network switches + assert (m_topology_ptr!=NULL); + + 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 } 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); +} diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh index 03a17037f..3669799fa 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh +++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh @@ -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 diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.py b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.py new file mode 100644 index 000000000..f8c0983bc --- /dev/null +++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.py @@ -0,0 +1,6 @@ +from m5.params import * +from BaseGarnetNetwork import BaseGarnetNetwork + +class GarnetNetwork(BaseGarnetNetwork): + type = 'GarnetNetwork' + diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc index a8a8fd137..5f48d2f5e 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc +++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc @@ -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 } diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc index 3b1c84eb6..6e106137a 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc +++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkLink.cc @@ -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++) diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc b/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc index 63f0373f8..9963555cb 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc +++ b/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc @@ -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); diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/SConscript b/src/mem/ruby/network/garnet/flexible-pipeline/SConscript index e132741ca..fa23c02d6 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/SConscript +++ b/src/mem/ruby/network/garnet/flexible-pipeline/SConscript @@ -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') diff --git a/src/mem/ruby/system/System.cc b/src/mem/ruby/system/System.cc index 47b53aedd..dc8007b26 100644 --- a/src/mem/ruby/system/System.cc +++ b/src/mem/ruby/system/System.cc @@ -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" |