From: Nilay Vaish Date: Thu, 7 Mar 2013 03:53:16 +0000 (-0600) Subject: ruby: garnet: fixed: implement functional access X-Git-Tag: stable_2013_06_16~67 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e8802fa127f5a446e708eb9f7ce8509e850bf699;p=gem5.git ruby: garnet: fixed: implement functional access --- diff --git a/configs/ruby/Ruby.py b/configs/ruby/Ruby.py index 40ee63195..88a0acd49 100644 --- a/configs/ruby/Ruby.py +++ b/configs/ruby/Ruby.py @@ -53,8 +53,8 @@ def define_options(parser): help="check src/mem/ruby/network/topologies for complete set") 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'") + parser.add_option("--garnet-network", type="choice", + choices=['fixed', 'flexible'], help="'fixed'|'flexible'") parser.add_option("--network-fault-model", action="store_true", default=False, help="enable network fault model: see src/mem/ruby/network/fault_model/") 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 6404eb6ff..f6fcc2514 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc @@ -346,3 +346,23 @@ GarnetNetwork_dParams::create() { return new GarnetNetwork_d(this); } + +uint32_t +GarnetNetwork_d::functionalWrite(Packet *pkt) +{ + uint32_t num_functional_writes = 0; + + for (unsigned int i = 0; i < m_router_ptr_vector.size(); i++) { + num_functional_writes += m_router_ptr_vector[i]->functionalWrite(pkt); + } + + for (unsigned int i = 0; i < m_ni_ptr_vector.size(); ++i) { + num_functional_writes += m_ni_ptr_vector[i]->functionalWrite(pkt); + } + + for (unsigned int i = 0; i < m_link_ptr_vector.size(); ++i) { + num_functional_writes += m_link_ptr_vector[i]->functionalWrite(pkt); + } + + return num_functional_writes; +} 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 c8a3ea0f6..912bbb955 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh @@ -90,6 +90,10 @@ class GarnetNetwork_d : public BaseGarnetNetwork const NetDest& routing_table_entry, bool isReconfiguration); + //! Function for performing a functional write. The return value + //! indicates the number of messages that were written. + uint32_t functionalWrite(Packet *pkt); + private: void checkNetworkAllocation(NodeID id, bool ordered, int network_num, std::string vnet_type); diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc index 2671d781f..7db9db56b 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.cc @@ -94,3 +94,14 @@ InputUnit_d::wakeup() m_num_buffer_reads[vnet]++; } } + +uint32_t +InputUnit_d::functionalWrite(Packet *pkt) +{ + uint32_t num_functional_writes = 0; + for (int i=0; i < m_num_vcs; i++) { + num_functional_writes += m_vcs[i]->functionalWrite(pkt); + } + + return num_functional_writes; +} diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh index de2e3d67f..c188b12d6 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh @@ -173,6 +173,8 @@ class InputUnit_d : public Consumer return m_num_buffer_writes[vnet]; } + uint32_t functionalWrite(Packet *pkt); + private: int m_id; int m_num_vcs; 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 ca4d6aabe..bdae26fd0 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc @@ -372,3 +372,15 @@ NetworkInterface_d::print(std::ostream& out) const { out << "[Network Interface]"; } + +uint32_t +NetworkInterface_d::functionalWrite(Packet *pkt) +{ + uint32_t num_functional_writes = 0; + for (unsigned int i = 0; i < m_num_vcs; ++i) { + num_functional_writes += m_ni_buffers[i]->functionalWrite(pkt); + } + + num_functional_writes += outSrcQueue->functionalWrite(pkt); + return num_functional_writes; +} diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.hh index c65496900..e064b8650 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.hh @@ -63,6 +63,8 @@ class NetworkInterface_d : public Consumer void print(std::ostream& out) const; int get_vnet(int vc); + uint32_t functionalWrite(Packet *); + private: GarnetNetwork_d *m_net_ptr; int m_virtual_networks, m_num_vcs, m_vc_per_vnet; 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 80a050207..afa9d63d3 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.cc @@ -99,3 +99,9 @@ CreditLink_dParams::create() { return new CreditLink_d(this); } + +uint32_t +NetworkLink_d::functionalWrite(Packet *pkt) +{ + return linkBuffer->functionalWrite(pkt); +} 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 de54de921..9e149392e 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh @@ -64,12 +64,12 @@ class NetworkLink_d : public ClockedObject, public Consumer inline bool isReady(Cycles curTime) { return linkBuffer->isReady(curTime); } + inline flit_d* peekLink() { return linkBuffer->peekTopFlit(); } inline flit_d* consumeLink() { return linkBuffer->getTopFlit(); } - void init_net_ptr(GarnetNetwork_d* net_ptr) - { - m_net_ptr = net_ptr; - } + + void init_net_ptr(GarnetNetwork_d* net_ptr) { m_net_ptr = net_ptr; } + uint32_t functionalWrite(Packet *); protected: int m_id; 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 684973863..f090e2a63 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.cc @@ -108,3 +108,9 @@ OutputUnit_d::update_vc(int vc, int in_port, int in_vc) m_router->update_incredit(in_port, in_vc, m_outvc_state[vc]->get_credit_count()); } + +uint32_t +OutputUnit_d::functionalWrite(Packet *pkt) +{ + return m_out_buffer->functionalWrite(pkt); +} diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh index 3610e4a19..50497303c 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/OutputUnit_d.hh @@ -87,6 +87,8 @@ class OutputUnit_d : public Consumer m_out_link->scheduleEvent(Cycles(1)); } + uint32_t functionalWrite(Packet *pkt); + private: int m_id; int m_num_vcs; 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 eaa147c41..44ca81802 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.cc @@ -204,6 +204,23 @@ Router_d::printAggregateFaultProbability(std::ostream& out) out << aggregate_fault_prob << endl; } +uint32_t +Router_d::functionalWrite(Packet *pkt) +{ + uint32_t num_functional_writes = 0; + num_functional_writes += m_switch->functionalWrite(pkt); + + for (uint32_t i = 0; i < m_input_unit.size(); i++) { + num_functional_writes += m_input_unit[i]->functionalWrite(pkt); + } + + for (uint32_t i = 0; i < m_output_unit.size(); i++) { + num_functional_writes += m_output_unit[i]->functionalWrite(pkt); + } + + return num_functional_writes; +} + Router_d * GarnetRouter_dParams::create() { 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 93ee46f47..4aa437c9c 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/Router_d.hh @@ -105,6 +105,8 @@ class Router_d : public BasicRouter aggregate_fault_prob); } + uint32_t functionalWrite(Packet *); + private: int m_virtual_networks, m_num_vcs, m_vc_per_vnet; GarnetNetwork_d *m_network_ptr; diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc index 357dbc0f1..f41dc884d 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc @@ -95,3 +95,15 @@ Switch_d::check_for_wakeup() } } } + +uint32_t +Switch_d::functionalWrite(Packet *pkt) +{ + uint32_t num_functional_writes = 0; + + for (uint32_t i = 0; i < m_switch_buffer.size(); ++i) { + num_functional_writes += m_switch_buffer[i]->functionalWrite(pkt); + } + + return num_functional_writes; +} diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.hh index 7ffaf423e..24fe6083d 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.hh @@ -51,17 +51,12 @@ class Switch_d : public Consumer void check_for_wakeup(); void print(std::ostream& out) const {}; - inline void - update_sw_winner(int inport, flit_d *t_flit) - { - m_switch_buffer[inport]->insert(t_flit); - } + inline void update_sw_winner(int inport, flit_d *t_flit) + { m_switch_buffer[inport]->insert(t_flit); } - inline double - get_crossbar_count() - { - return m_crossbar_activity; - } + inline double get_crossbar_count() { return m_crossbar_activity; } + + uint32_t functionalWrite(Packet *pkt); private: int m_num_vcs; diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc index 50437ef9f..bfeecbc25 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc @@ -85,3 +85,9 @@ VirtualChannel_d::need_stage_nextcycle(VC_state_type state, flit_stage stage, } return false; } + +uint32_t +VirtualChannel_d::functionalWrite(Packet *pkt) +{ + return m_input_buffer->functionalWrite(pkt); +} diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh index 9d90d9f44..9e8b95d9d 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh @@ -87,6 +87,8 @@ class VirtualChannel_d return m_input_buffer->getTopFlit(); } + uint32_t functionalWrite(Packet *pkt); + private: int m_id; flitBuffer_d *m_input_buffer; diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc index 5b03a5d21..6a7d4be87 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc @@ -85,3 +85,17 @@ flitBuffer_d::setMaxSize(int maximum) { max_size = maximum; } + +uint32_t +flitBuffer_d::functionalWrite(Packet *pkt) +{ + uint32_t num_functional_writes = 0; + + for (unsigned int i = 0; i < m_buffer.size(); ++i) { + if (m_buffer[i]->functionalWrite(pkt)) { + num_functional_writes++; + } + } + + return num_functional_writes; +} diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh index 4c1cae842..2fe6e982b 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh @@ -73,6 +73,8 @@ class flitBuffer_d std::push_heap(m_buffer.begin(), m_buffer.end(), flit_d::greater); } + uint32_t functionalWrite(Packet *pkt); + private: std::vector m_buffer; int max_size; diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.cc index fd502f984..bb0d3eda5 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.cc @@ -74,3 +74,10 @@ flit_d::print(std::ostream& out) const out << "Enqueue Time=" << m_enqueue_time << " "; out << "]"; } + +bool +flit_d::functionalWrite(Packet *pkt) +{ + Message *msg = m_msg_ptr.get(); + return msg->functionalWrite(pkt); +} diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh index 1fda303fa..87ea1152f 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh @@ -79,11 +79,7 @@ class flit_d m_stage.second = curTime + Cycles(1); } - std::pair - get_stage() - { - return m_stage; - } + std::pair get_stage() { return m_stage; } void set_delay(Cycles delay) { src_delay = delay; } Cycles get_delay() { return src_delay; } @@ -99,6 +95,8 @@ class flit_d } } + bool functionalWrite(Packet *pkt); + private: int m_id; int m_vnet;