diff options
| author | Mahmoud <[email protected]> | 2019-10-16 15:33:11 -0400 |
|---|---|---|
| committer | Mahmoud <[email protected]> | 2019-10-16 15:33:11 -0400 |
| commit | bce4e08d51e3f5817f174f639c56f34104b6efe1 (patch) | |
| tree | 74eeedd574b8bae822f653c125e14630f206ddab /src/gpgpu-sim | |
| parent | 998bbc82176e1579c8500aa0c01bb00395da74dc (diff) | |
adding new stats, verbose, granting arbit in the local xbar
Diffstat (limited to 'src/gpgpu-sim')
| -rw-r--r-- | src/gpgpu-sim/icnt_wrapper.cc | 3 | ||||
| -rw-r--r-- | src/gpgpu-sim/local_interconnect.cc | 137 | ||||
| -rw-r--r-- | src/gpgpu-sim/local_interconnect.h | 11 |
3 files changed, 120 insertions, 31 deletions
diff --git a/src/gpgpu-sim/icnt_wrapper.cc b/src/gpgpu-sim/icnt_wrapper.cc index 67724d0..e449bf1 100644 --- a/src/gpgpu-sim/icnt_wrapper.cc +++ b/src/gpgpu-sim/icnt_wrapper.cc @@ -183,6 +183,9 @@ void icnt_reg_options( class OptionParser * opp ) option_parser_register(opp, "-inct_out_buffer_limit", OPT_UINT32, &g_inct_config.out_buffer_limit, "out_buffer_limit", "64"); option_parser_register(opp, "-inct_subnets", OPT_UINT32, &g_inct_config.subnets, "subnets", "2"); option_parser_register(opp, "-arbiter_algo", OPT_UINT32, &g_inct_config.arbiter_algo, "arbiter_algo", "1"); + option_parser_register(opp, "-inct_verbose", OPT_UINT32, &g_inct_config.verbose, "inct_verbose", "0"); + option_parser_register(opp, "-inct_grant_cycles", OPT_UINT32, &g_inct_config.grant_cycles, "grant_cycles", "1"); + } diff --git a/src/gpgpu-sim/local_interconnect.cc b/src/gpgpu-sim/local_interconnect.cc index c70477c..93a2e6e 100644 --- a/src/gpgpu-sim/local_interconnect.cc +++ b/src/gpgpu-sim/local_interconnect.cc @@ -36,19 +36,22 @@ #include "local_interconnect.h" #include "mem_fetch.h" -xbar_router::xbar_router(unsigned router_id, enum Interconnect_type m_type, unsigned n_shader, unsigned n_mem, unsigned m_in_buffer_limit, unsigned m_out_buffer_limit, enum Arbiteration_type m_arbit_type) +xbar_router::xbar_router(unsigned router_id, enum Interconnect_type m_type, unsigned n_shader, unsigned n_mem, const struct inct_config& m_localinct_config) { m_id=router_id; router_type=m_type; _n_mem = n_mem; _n_shader = n_shader; total_nodes = n_shader+n_mem; + verbose=m_localinct_config.verbose; + grant_cycles = m_localinct_config.grant_cycles; + grant_cycles_count = m_localinct_config.grant_cycles; in_buffers.resize(total_nodes); out_buffers.resize(total_nodes); next_node.resize(total_nodes,0); - in_buffer_limit = m_in_buffer_limit; - out_buffer_limit = m_out_buffer_limit; - arbit_type = m_arbit_type; + in_buffer_limit = m_localinct_config.in_buffer_limit; + out_buffer_limit = m_localinct_config.out_buffer_limit; + arbit_type = m_localinct_config.arbiter_algo; next_node_id=0; if(m_type == REQ_NET) { active_in_buffers=n_shader; @@ -66,6 +69,9 @@ xbar_router::xbar_router(unsigned router_id, enum Interconnect_type m_type, unsi out_buffer_util=0; in_buffer_util=0; packets_num=0; + conflicts_util=0; + cycles_util=0; + reqs_util=0; } @@ -123,14 +129,18 @@ void xbar_router::Advance() { } void xbar_router::RR_Advance() { - cycles++; + bool active = false; vector<bool> issued(total_nodes, false); + unsigned conflict_sub =0 ; + unsigned reqs =0 ; + for(unsigned i=0; i<total_nodes; ++i){ unsigned node_id = (i+next_node_id)%total_nodes; if(!in_buffers[node_id].empty()) { + active=true; Packet _packet = in_buffers[node_id].front(); //ensure that the outbuffer has space and not issued before in this cycle if(Has_Buffer_Out(_packet.output_deviceID, 1)){ @@ -138,45 +148,64 @@ void xbar_router::RR_Advance() { out_buffers[_packet.output_deviceID].push(_packet); in_buffers[node_id].pop(); issued[_packet.output_deviceID]=true; + reqs++; } else - conflicts++; + conflict_sub++; } else { out_buffer_full++; if(issued[_packet.output_deviceID]) - conflicts++; + conflict_sub++; } } } next_node_id = (++next_node_id % total_nodes); + conflicts += conflict_sub; + if(active){ + conflicts_util += conflict_sub; + cycles_util++; + reqs_util+=reqs; + } + + if(verbose) { + printf("%d : cycle %d : conflicts = %d\n", m_id, cycles, conflict_sub); + printf("%d : cycle %d : passing reqs = %d\n", m_id, cycles, reqs); + } + //collect some stats about buffer util for(unsigned i=0; i<total_nodes; ++i){ in_buffer_util+=in_buffers[i].size(); out_buffer_util+=out_buffers[i].size(); } + + cycles++; + } //iSLIP algorithm //McKeown, Nick. "The iSLIP scheduling algorithm for input-queued switches." IEEE/ACM transactions on networking 2 (1999): 188-201. //https://www.cs.rutgers.edu/~sn624/552-F18/papers/islip.pdf void xbar_router::iSLIP_Advance() { - cycles++; vector<unsigned> node_tmp; + bool active = false; + unsigned conflict_sub =0 ; + unsigned reqs =0 ; - //calcaulte how many conflicts are there for stats + + //calculate how many conflicts are there for stats for (unsigned i=0; i<total_nodes; ++i){ - + if(!in_buffers[i].empty()){ Packet _packet_tmp = in_buffers[i].front(); if (!node_tmp.empty()){ if (std::find(node_tmp.begin(), node_tmp.end(), _packet_tmp.output_deviceID)!=node_tmp.end()){ - conflicts++; + conflict_sub++; } else node_tmp.push_back(_packet_tmp.output_deviceID); @@ -184,9 +213,15 @@ void xbar_router::iSLIP_Advance() { else{ node_tmp.push_back(_packet_tmp.output_deviceID); } + active=true; } } + conflicts += conflict_sub; + if(active){ + conflicts_util += conflict_sub; + cycles_util++; + } //do iSLIP for(unsigned i=0; i<total_nodes; ++i){ @@ -200,7 +235,23 @@ void xbar_router::iSLIP_Advance() { if(_packet.output_deviceID==i){ out_buffers[_packet.output_deviceID].push(_packet); in_buffers[node_id].pop(); - next_node[i] = (++node_id % total_nodes); + if(verbose) + printf("%d : cycle %d : send req from %d to %d\n", m_id, cycles, node_id, i-_n_shader); + if(grant_cycles_count == 1) + next_node[i] = (++node_id % total_nodes); + if(verbose){ + for(unsigned k=j+1; k<total_nodes; ++k){ + unsigned node_id2 = (k+next_node[i])%total_nodes; + if(!in_buffers[node_id2].empty()) { + Packet _packet2 = in_buffers[node_id2].front(); + + if(_packet2.output_deviceID==i) + printf("%d : cycle %d : cannot send req from %d to %d\n", m_id, cycles, node_id2, i-_n_shader); + } + } + } + + reqs++; break; } } @@ -210,11 +261,33 @@ void xbar_router::iSLIP_Advance() { out_buffer_full++; } + if(active){ + reqs_util+=reqs; + } + + if(verbose) + printf("%d : cycle %d : grant_cycles = %d\n", m_id, cycles, grant_cycles); + + if(active && grant_cycles_count == 1) + grant_cycles_count = grant_cycles; + else if (active) + grant_cycles_count--; + + + if(verbose) { + printf("%d : cycle %d : conflicts = %d\n", m_id, cycles, conflict_sub); + printf("%d : cycle %d : passing reqs = %d\n", m_id, cycles, reqs); + } + + //collect some stats about buffer util for(unsigned i=0; i<total_nodes; ++i){ in_buffer_util+=in_buffers[i].size(); out_buffer_util+=out_buffers[i].size(); } + + cycles++; + } @@ -264,7 +337,7 @@ void LocalInterconnect::CreateInterconnect(unsigned m_n_shader, unsigned m_n_mem net.resize(n_subnets); for (unsigned i = 0; i < n_subnets; ++i) { - net[i] = new xbar_router( i, static_cast<Interconnect_type>(i), m_n_shader, m_n_mem, m_inct_config.in_buffer_limit, m_inct_config.out_buffer_limit,m_inct_config.arbiter_algo); + net[i] = new xbar_router( i, static_cast<Interconnect_type>(i), m_n_shader, m_n_mem, m_inct_config); } } @@ -341,24 +414,28 @@ bool LocalInterconnect::HasBuffer(unsigned deviceID, unsigned int size) const{ void LocalInterconnect::DisplayStats() const{ - cout<<"Req_Network_injected_packets_num = "<<net[REQ_NET]->packets_num<<endl; - cout<<"Req_Network_cycles = "<<net[REQ_NET]->cycles<<endl; - cout<<"Req_Network_injected_packets_per_cycle = "<<(float)(net[REQ_NET]->packets_num) / (net[REQ_NET]->cycles)<<endl; - cout<<"Req_Network_conflicts_per_cycle = "<<(float)(net[REQ_NET]->conflicts) / (net[REQ_NET]->cycles)<<endl; - cout<<"Req_Network_in_buffer_full_per_cycle = "<<(float)(net[REQ_NET]->in_buffer_full) / (net[REQ_NET]->cycles)<<endl; - cout<<"Req_Network_in_buffer_avg_util = "<<((float)(net[REQ_NET]->in_buffer_util) / (net[REQ_NET]->cycles) / net[REQ_NET]->active_in_buffers)<<endl; - cout<<"Req_Network_out_buffer_full_per_cycle = "<<(float)(net[REQ_NET]->out_buffer_full) / (net[REQ_NET]->cycles)<<endl; - cout<<"Req_Network_out_buffer_avg_util = "<<((float)(net[REQ_NET]->out_buffer_util) / (net[REQ_NET]->cycles) / net[REQ_NET]->active_out_buffers)<<endl; + printf("Req_Network_injected_packets_num = %lld\n", net[REQ_NET]->packets_num); + printf("Req_Network_cycles = %lld\n", net[REQ_NET]->cycles); + printf("Req_Network_injected_packets_per_cycle = %12.4f \n", (float)(net[REQ_NET]->packets_num) / (net[REQ_NET]->cycles)); + printf("Req_Network_conflicts_per_cycle = %12.4f\n", (float)(net[REQ_NET]->conflicts) / (net[REQ_NET]->cycles)); + printf("Req_Network_conflicts_per_cycle_util = %12.4f\n", (float)(net[REQ_NET]->conflicts_util) / (net[REQ_NET]->cycles_util)); + printf("Req_Bank_Level_Parallism = %12.4f\n", (float)(net[REQ_NET]->reqs_util) / (net[REQ_NET]->cycles_util)); + printf("Req_Network_in_buffer_full_per_cycle = %12.4f\n", (float)(net[REQ_NET]->in_buffer_full) / (net[REQ_NET]->cycles)); + printf("Req_Network_in_buffer_avg_util = %12.4f\n", ((float)(net[REQ_NET]->in_buffer_util) / (net[REQ_NET]->cycles) / net[REQ_NET]->active_in_buffers)); + printf("Req_Network_out_buffer_full_per_cycle = %12.4f\n", (float)(net[REQ_NET]->out_buffer_full) / (net[REQ_NET]->cycles)); + printf("Req_Network_out_buffer_avg_util = %12.4f\n", ((float)(net[REQ_NET]->out_buffer_util) / (net[REQ_NET]->cycles) / net[REQ_NET]->active_out_buffers)); - cout<<endl; - cout<<"Reply_Network_injected_packets_num = "<<net[REPLY_NET]->packets_num<<endl; - cout<<"Reply_Network_cycles = "<<net[REPLY_NET]->cycles<<endl; - cout<<"Reply_Network_injected_packets_per_cycle = "<<(float)(net[REPLY_NET]->packets_num) / (net[REPLY_NET]->cycles)<<endl; - cout<<"Reply_Network_conflicts_per_cycle = "<<(float)(net[REPLY_NET]->conflicts) / (net[REPLY_NET]->cycles)<<endl; - cout<<"Reply_Network_in_buffer_full_per_cycle = "<<(float)(net[REPLY_NET]->in_buffer_full) / (net[REPLY_NET]->cycles)<<endl; - cout<<"Reply_Network_in_buffer_avg_util = "<<((float)(net[REPLY_NET]->in_buffer_util) / (net[REPLY_NET]->cycles) / net[REPLY_NET]->active_in_buffers)<<endl; - cout<<"Reply_Network_out_buffer_full_per_cycle = "<<(float)(net[REPLY_NET]->out_buffer_full) / (net[REPLY_NET]->cycles)<<endl; - cout<<"Reply_Network_out_buffer_avg_util= "<<((float)(net[REPLY_NET]->out_buffer_util) / (net[REPLY_NET]->cycles) / net[REPLY_NET]->active_out_buffers)<<endl; + printf("\n"); + printf("Reply_Network_injected_packets_num = %lld\n", net[REPLY_NET]->packets_num); + printf("Reply_Network_cycles = %lld\n", net[REPLY_NET]->cycles); + printf("Reply_Network_injected_packets_per_cycle = %12.4f\n", (float)(net[REPLY_NET]->packets_num) / (net[REPLY_NET]->cycles)); + printf("Reply_Network_conflicts_per_cycle = %12.4f\n", (float)(net[REPLY_NET]->conflicts) / (net[REPLY_NET]->cycles)); + printf("Reply_Network_conflicts_per_cycle_util = %12.4f\n", (float)(net[REPLY_NET]->conflicts_util) / (net[REPLY_NET]->cycles_util)); + printf("Reply_Bank_Level_Parallism = %12.4f\n", (float)(net[REPLY_NET]->reqs_util) / (net[REPLY_NET]->cycles_util)); + printf("Reply_Network_in_buffer_full_per_cycle = %12.4f\n", (float)(net[REPLY_NET]->in_buffer_full) / (net[REPLY_NET]->cycles)); + printf("Reply_Network_in_buffer_avg_util = %12.4f\n", ((float)(net[REPLY_NET]->in_buffer_util) / (net[REPLY_NET]->cycles) / net[REPLY_NET]->active_in_buffers)); + printf("Reply_Network_out_buffer_full_per_cycle = %12.4f\n", (float)(net[REPLY_NET]->out_buffer_full) / (net[REPLY_NET]->cycles)); + printf("Reply_Network_out_buffer_avg_util = %12.4f\n", ((float)(net[REPLY_NET]->out_buffer_util) / (net[REPLY_NET]->cycles) / net[REPLY_NET]->active_out_buffers)); } diff --git a/src/gpgpu-sim/local_interconnect.h b/src/gpgpu-sim/local_interconnect.h index a784da8..f431013 100644 --- a/src/gpgpu-sim/local_interconnect.h +++ b/src/gpgpu-sim/local_interconnect.h @@ -52,12 +52,14 @@ struct inct_config unsigned out_buffer_limit; unsigned subnets; Arbiteration_type arbiter_algo; + unsigned verbose; + unsigned grant_cycles; }; class xbar_router { public: - xbar_router(unsigned router_id, enum Interconnect_type m_type, unsigned n_shader, unsigned n_mem, unsigned m_in_buffer_limit, unsigned m_out_buffer_limit, enum Arbiteration_type m_arbit_type); + xbar_router(unsigned router_id, enum Interconnect_type m_type, unsigned n_shader, unsigned n_mem, const struct inct_config& m_localinct_config); ~xbar_router(); void Push(unsigned input_deviceID, unsigned output_deviceID, void* data, unsigned int size); void* Pop(unsigned ouput_deviceID); @@ -71,6 +73,9 @@ public: //some stats unsigned long long cycles; unsigned long long conflicts; + unsigned long long conflicts_util; + unsigned long long cycles_util; + unsigned long long reqs_util; unsigned long long out_buffer_full; unsigned long long out_buffer_util; unsigned long long in_buffer_full; @@ -99,6 +104,10 @@ private: enum Interconnect_type router_type; unsigned active_in_buffers,active_out_buffers; Arbiteration_type arbit_type; + unsigned verbose; + + unsigned grant_cycles; + unsigned grant_cycles_count; friend class LocalInterconnect; |
