diff options
10 files changed, 56 insertions, 5 deletions
diff --git a/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc b/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc index 7290a70d9..3e5e1cbe8 100644 --- a/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc +++ b/src/mem/ruby/network/garnet/BaseGarnetNetwork.cc @@ -36,7 +36,8 @@ BaseGarnetNetwork::BaseGarnetNetwork(const Params *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_buffers_per_data_vc = p->buffers_per_data_vc; + m_buffers_per_ctrl_vc = p->buffers_per_ctrl_vc; m_using_network_testing = p->using_network_testing; } diff --git a/src/mem/ruby/network/garnet/BaseGarnetNetwork.hh b/src/mem/ruby/network/garnet/BaseGarnetNetwork.hh index 51d84c6e0..4a1856e43 100644 --- a/src/mem/ruby/network/garnet/BaseGarnetNetwork.hh +++ b/src/mem/ruby/network/garnet/BaseGarnetNetwork.hh @@ -51,13 +51,15 @@ class BaseGarnetNetwork : public Network 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; } + int getBuffersPerDataVC() {return m_buffers_per_data_vc; } + int getBuffersPerCtrlVC() {return m_buffers_per_ctrl_vc; } protected: int m_flit_size; int m_number_of_pipe_stages; int m_vcs_per_class; - int m_buffer_size; + int m_buffers_per_data_vc; + int m_buffers_per_ctrl_vc; bool m_using_network_testing; }; diff --git a/src/mem/ruby/network/garnet/BaseGarnetNetwork.py b/src/mem/ruby/network/garnet/BaseGarnetNetwork.py index e35cb631a..44b6bd149 100644 --- a/src/mem/ruby/network/garnet/BaseGarnetNetwork.py +++ b/src/mem/ruby/network/garnet/BaseGarnetNetwork.py @@ -37,5 +37,6 @@ class BaseGarnetNetwork(RubyNetwork): 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"); + buffers_per_data_vc = Param.Int(4, "buffers per data virtual channel"); + buffers_per_ctrl_vc = Param.Int(1, "buffers per ctrl virtual channel"); 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 63900ad66..6917a91d1 100644 --- a/src/mem/ruby/network/garnet/NetworkHeader.hh +++ b/src/mem/ruby/network/garnet/NetworkHeader.hh @@ -36,6 +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 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 216234bcb..d11054abf 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc @@ -107,6 +107,12 @@ GarnetNetwork_d::init() for (int i = 0; i < m_router_ptr_vector.size(); i++) { m_router_ptr_vector[i]->init(); } + + 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() 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 d3fb9f39b..1fe65f18d 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh @@ -68,6 +68,21 @@ 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/getVCsPerClass(); + m_vnet_type[vnet] = vnet_type; + } + + VNET_type + get_vnet_type(int vc) + { + int vnet = vc/getVCsPerClass(); + return m_vnet_type[vnet]; + } + + inline void increment_injected_flits() { m_flits_injected++; } inline void increment_received_flits() { m_flits_received++; } @@ -106,6 +121,7 @@ class GarnetNetwork_d : public BaseGarnetNetwork GarnetNetwork_d(const GarnetNetwork_d& obj); GarnetNetwork_d& operator=(const GarnetNetwork_d& obj); + std::vector<VNET_type > m_vnet_type; // int m_virtual_networks; // int m_nodes; int m_flits_received, m_flits_injected; 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 45270ad7a..8299a294f 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc @@ -163,6 +163,13 @@ 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(); flit_d *fl = new flit_d(i, vc, vnet, num_flits, new_msg_ptr); 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 202a4537e..ee89ec004 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.cc @@ -37,5 +37,11 @@ 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->getBufferSize(); + + // this value is updated later for data VCs by set_credit_count() + 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); } 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 f3fb4384a..39b2cb5fe 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/OutVcState_d.hh @@ -42,6 +42,16 @@ 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; } inline bool 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 c2fba3ffd..988e5d37a 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc @@ -102,6 +102,7 @@ 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, |