From: Tushar Krishna Date: Sat, 21 May 2011 04:40:57 +0000 (-0400) Subject: garnet: use vnet_type from protocol to decide buffer depths X-Git-Tag: stable_2012_02_02~311 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fc1d2d967924f9e8116d156550786ed0b527d1e3;p=gem5.git garnet: use vnet_type from protocol to decide buffer depths The virtual channels within "response" vnets are made buffers_per_data_vc deep (default=4), while virtual channels within other vnets are made buffers_per_ctrl_vc deep (default = 1). This is for accurate power estimates. --- diff --git a/src/mem/ruby/network/garnet/NetworkHeader.hh b/src/mem/ruby/network/garnet/NetworkHeader.hh index 6917a91d1..713c49439 100644 --- a/src/mem/ruby/network/garnet/NetworkHeader.hh +++ b/src/mem/ruby/network/garnet/NetworkHeader.hh @@ -36,7 +36,7 @@ enum flit_type {HEAD_, BODY_, TAIL_, HEAD_TAIL_, NUM_FLIT_TYPE_}; enum VC_state_type {IDLE_, VC_AB_, ACTIVE_, NUM_VC_STATE_TYPE_}; -enum VNET_type {CTRL_VNET_, DATA_VNET_, NUM_VNET_TYPE_}; +enum VNET_type {CTRL_VNET_, DATA_VNET_, NULL_VNET_, NUM_VNET_TYPE_}; enum flit_stage {I_, VA_, SA_, ST_, LT_, NUM_FLIT_STAGE_}; #define INFINITE_ 10000 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 dc24900c4..7ba2e561a 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc @@ -52,6 +52,11 @@ GarnetNetwork_d::GarnetNetwork_d(const Params *p) m_buffers_per_data_vc = p->buffers_per_data_vc; m_buffers_per_ctrl_vc = p->buffers_per_ctrl_vc; + m_vnet_type.resize(m_virtual_networks); + for (int i = 0; i < m_vnet_type.size(); i++) { + m_vnet_type[i] = NULL_VNET_; // default + } + // record the routers for (vector::const_iterator i = m_topology_ptr->params()->routers.begin(); @@ -85,12 +90,6 @@ GarnetNetwork_d::init() } // false because this isn't a reconfiguration m_topology_ptr->createLinks(this, false); - - m_vnet_type.resize(m_virtual_networks); - for (int i = 0; i < m_vnet_type.size(); i++) { - m_vnet_type[i] = CTRL_VNET_; - // DATA_VNET_ updated later based on traffic - } } GarnetNetwork_d::~GarnetNetwork_d() @@ -215,7 +214,8 @@ GarnetNetwork_d::makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link, void GarnetNetwork_d::checkNetworkAllocation(NodeID id, bool ordered, - int network_num) + int network_num, + string vnet_type) { assert(id < m_nodes); assert(network_num < m_virtual_networks); @@ -224,25 +224,26 @@ GarnetNetwork_d::checkNetworkAllocation(NodeID id, bool ordered, m_ordered[network_num] = true; } m_in_use[network_num] = true; + + if (vnet_type == "response") + m_vnet_type[network_num] = DATA_VNET_; // carries data (and ctrl) packets + else + m_vnet_type[network_num] = CTRL_VNET_; // carries only ctrl packets } MessageBuffer* GarnetNetwork_d::getToNetQueue(NodeID id, bool ordered, int network_num, - std::string vnet_type) + string vnet_type) { - // TODO: - //if (vnet_type == "response") - // mark vnet as data vnet and use buffers_per_data_vc - - checkNetworkAllocation(id, ordered, network_num); + checkNetworkAllocation(id, ordered, network_num, vnet_type); return m_toNetQueues[id][network_num]; } MessageBuffer* GarnetNetwork_d::getFromNetQueue(NodeID id, bool ordered, int network_num, - std::string vnet_type) + string vnet_type) { - checkNetworkAllocation(id, ordered, network_num); + checkNetworkAllocation(id, ordered, network_num, vnet_type); return m_fromNetQueues[id][network_num]; } 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 f2b3bd4ef..2030bb4f0 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh @@ -73,13 +73,6 @@ class GarnetNetwork_d : public BaseGarnetNetwork void printConfig(std::ostream& out) const; void print(std::ostream& out) const; - void - set_vnet_type(int vc, VNET_type vnet_type) - { - int vnet = vc/getVCsPerVnet(); - m_vnet_type[vnet] = vnet_type; - } - VNET_type get_vnet_type(int vc) { @@ -124,7 +117,8 @@ class GarnetNetwork_d : public BaseGarnetNetwork bool isReconfiguration); private: - void checkNetworkAllocation(NodeID id, bool ordered, int network_num); + void checkNetworkAllocation(NodeID id, bool ordered, int network_num, + std::string vnet_type); GarnetNetwork_d(const GarnetNetwork_d& obj); GarnetNetwork_d& operator=(const GarnetNetwork_d& obj); 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 558352253..4adc8d98c 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc @@ -164,12 +164,6 @@ NetworkInterface_d::flitisizeMessage(MsgPtr msg_ptr, int vnet) // flitisized and an output vc is acquired net_msg_ptr->getInternalDestination().removeNetDest(personal_dest); } - if (num_flits > 1) { // data packet - // defining ctrl vnet to be 1-flit packets - // and data vnet to be > 1 flit packets - m_net_ptr->set_vnet_type(vc, DATA_VNET_); - m_out_vc_state[vc]->set_credit_count(); - } for (int i = 0; i < num_flits; i++) { m_net_ptr->increment_injected_flits(); 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 8a2022a4f..829642bb9 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc @@ -38,10 +38,10 @@ OutVcState_d::OutVcState_d(int id, GarnetNetwork_d *network_ptr) m_vc_state = IDLE_; m_time = g_eventQueue_ptr->getTime(); - // this value is updated later for data VCs by set_credit_count() - m_credit_count = m_network_ptr->getBuffersPerCtrlVC(); + if (m_network_ptr->get_vnet_type(id) == DATA_VNET_) + m_credit_count = m_network_ptr->getBuffersPerDataVC(); + else + m_credit_count = m_network_ptr->getBuffersPerCtrlVC(); - // (num_flits > 1) is used to determine ctrl vs data vnet - // in NetworkInterface_d.cc - assert(m_credit_count == 1); + 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 5b1328fcf..237f54340 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.hh @@ -42,15 +42,6 @@ class OutVcState_d int get_inport() { return m_in_port; } int get_invc() { return m_in_vc; } int get_credit_count() { return m_credit_count; } - void - set_credit_count() - { - // only need to initialize credit count for data VCs - // constructor sets this to BuffersPerCtrlVC by default - - if (m_network_ptr->get_vnet_type(m_id) == DATA_VNET_) - m_credit_count = m_network_ptr->getBuffersPerDataVC(); - } void set_inport(int port) { m_in_port = port; } void set_invc(int vc) { m_in_vc = vc; } 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 988e5d37a..c2fba3ffd 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc @@ -102,7 +102,6 @@ void OutputUnit_d::update_vc(int vc, int in_port, int in_vc) { m_outvc_state[vc]->setState(ACTIVE_, g_eventQueue_ptr->getTime() + 1); - m_outvc_state[vc]->set_credit_count(); m_outvc_state[vc]->set_inport(in_port); m_outvc_state[vc]->set_invc(in_vc); m_router->update_incredit(in_port, in_vc,