From 69d31fcda599d82e9bcf5970bdecbc181388e5ef Mon Sep 17 00:00:00 2001 From: Dongdong Li Date: Thu, 22 Aug 2013 20:28:46 -0800 Subject: Refactoring: 1. Decouple the constructor of interconnect interface 2. Some type changed to unsigned from int Fixed Bug: wrong variable in InterconnectInterface::Busy() Review: 83001 [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 16877] --- src/gpgpu-sim/gpu-sim.cc | 3 ++- src/gpgpu-sim/icnt_wrapper.cc | 30 +++++++++++++++++++----------- src/gpgpu-sim/icnt_wrapper.h | 5 +++-- 3 files changed, 24 insertions(+), 14 deletions(-) (limited to 'src/gpgpu-sim') diff --git a/src/gpgpu-sim/gpu-sim.cc b/src/gpgpu-sim/gpu-sim.cc index 36e72e8..987942a 100644 --- a/src/gpgpu-sim/gpu-sim.cc +++ b/src/gpgpu-sim/gpu-sim.cc @@ -578,7 +578,8 @@ gpgpu_sim::gpgpu_sim( const gpgpu_sim_config &config ) } } - icnt_wrapper_init(m_shader_config->n_simt_clusters,m_memory_config->m_n_mem_sub_partition); + icnt_wrapper_init(); + icnt_create(m_shader_config->n_simt_clusters,m_memory_config->m_n_mem_sub_partition); time_vector_create(NUM_MEM_REQ_STAT); fprintf(stdout, "GPGPU-Sim uArch: performance model initialization complete.\n"); diff --git a/src/gpgpu-sim/icnt_wrapper.cc b/src/gpgpu-sim/icnt_wrapper.cc index c005dd9..ee58ece 100644 --- a/src/gpgpu-sim/icnt_wrapper.cc +++ b/src/gpgpu-sim/icnt_wrapper.cc @@ -30,16 +30,17 @@ #include "../intersim2/globals.hpp" #include "../intersim2/interconnect_interface.hpp" -icnt_init_p icnt_init; -icnt_has_buffer_p icnt_has_buffer; -icnt_push_p icnt_push; -icnt_pop_p icnt_pop; -icnt_transfer_p icnt_transfer; -icnt_busy_p icnt_busy; -icnt_display_stats_p icnt_display_stats; +icnt_create_p icnt_create; +icnt_init_p icnt_init; +icnt_has_buffer_p icnt_has_buffer; +icnt_push_p icnt_push; +icnt_pop_p icnt_pop; +icnt_transfer_p icnt_transfer; +icnt_busy_p icnt_busy; +icnt_display_stats_p icnt_display_stats; icnt_display_overall_stats_p icnt_display_overall_stats; -icnt_display_state_p icnt_display_state; -icnt_get_flit_size_p icnt_get_flit_size; +icnt_display_state_p icnt_display_state; +icnt_get_flit_size_p icnt_get_flit_size; int g_network_mode; char* g_network_config_filename; @@ -48,6 +49,12 @@ char* g_network_config_filename; // Wrapper to intersim2 to accompany old icnt_wrapper // TODO: use delegate/boost/c++11 instead + +static void intersim2_create(unsigned int n_shader, unsigned int n_mem) +{ + g_icnt_interface->CreateInterconnect(n_shader, n_mem); +} + static void intersim2_init() { g_icnt_interface->Init(); @@ -104,12 +111,13 @@ void icnt_reg_options( class OptionParser * opp ) option_parser_register(opp, "-inter_config_file", OPT_CSTR, &g_network_config_filename, "Interconnection network config file", "mesh"); } -void icnt_wrapper_init( unsigned int n_shader, unsigned int n_mem ) +void icnt_wrapper_init() { switch (g_network_mode) { case INTERSIM: //FIXME: delete the object: may add icnt_done wrapper - g_icnt_interface = new InterconnectInterface(g_network_config_filename, n_shader, n_mem ); + g_icnt_interface = InterconnectInterface::New(g_network_config_filename); + icnt_create = intersim2_create; icnt_init = intersim2_init; icnt_has_buffer = intersim2_has_buffer; icnt_push = intersim2_push; diff --git a/src/gpgpu-sim/icnt_wrapper.h b/src/gpgpu-sim/icnt_wrapper.h index 2cbe0df..a4d123e 100644 --- a/src/gpgpu-sim/icnt_wrapper.h +++ b/src/gpgpu-sim/icnt_wrapper.h @@ -32,6 +32,7 @@ // functional interface to the interconnect +typedef void (*icnt_create_p)(unsigned n_shader, unsigned n_mem); typedef void (*icnt_init_p)( ); typedef bool (*icnt_has_buffer_p)(unsigned input, unsigned int size); typedef void (*icnt_push_p)(unsigned input, unsigned output, void* data, unsigned int size); @@ -44,7 +45,7 @@ typedef void (*icnt_display_overall_stats_p)( ); typedef void (*icnt_display_state_p)(FILE* fp); typedef unsigned (*icnt_get_flit_size_p)(); - +extern icnt_create_p icnt_create; extern icnt_init_p icnt_init; extern icnt_has_buffer_p icnt_has_buffer; extern icnt_push_p icnt_push; @@ -63,7 +64,7 @@ enum network_mode { N_NETWORK_MODE }; -void icnt_wrapper_init( unsigned int n_shader, unsigned int n_mem ); +void icnt_wrapper_init(); void icnt_reg_options( class OptionParser * opp ); #endif -- cgit v1.3