From 7c67c73a642794e2f95cb9b7f5b8377363adc0f2 Mon Sep 17 00:00:00 2001 From: Ahmed El-Shafiey Date: Wed, 19 Dec 2012 06:52:31 -0800 Subject: fixig more valgrind errors in CACTI due to uinitialized variables + fixing a bug in the interconect stats (initializing the n_mem_to_simt metric to zero) [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 14843] --- src/gpgpu-sim/gpu-sim.cc | 2 +- src/gpgpu-sim/l2cache.cc | 2 +- src/gpuwattch/cacti/basic_circuit.cc | 2 +- src/gpuwattch/cacti/wire.cc | 14 ++++++-- src/gpuwattch/cacti/wire.h | 2 +- src/gpuwattch/gpgpu_sim_wrapper.cc | 63 +++++++++++++++++++++--------------- src/gpuwattch/gpgpu_sim_wrapper.h | 2 +- src/gpuwattch/interconnect.h | 4 +-- src/gpuwattch/processor.cc | 4 ++- 9 files changed, 58 insertions(+), 37 deletions(-) diff --git a/src/gpgpu-sim/gpu-sim.cc b/src/gpgpu-sim/gpu-sim.cc index bea0ad9..5b946d3 100644 --- a/src/gpgpu-sim/gpu-sim.cc +++ b/src/gpgpu-sim/gpu-sim.cc @@ -487,7 +487,7 @@ gpgpu_sim::gpgpu_sim( const gpgpu_sim_config &config ) ptx_file_line_stats_create_exposed_latency_tracker(m_config.num_shader()); #ifdef GPGPUSIM_POWER_MODEL - m_gpgpusim_wrapper = new gpgpu_sim_wrapper(); + m_gpgpusim_wrapper = new gpgpu_sim_wrapper(config.g_power_config_name); #endif m_shader_stats = new shader_core_stats(m_shader_config); diff --git a/src/gpgpu-sim/l2cache.cc b/src/gpgpu-sim/l2cache.cc index 281da7f..56b145c 100644 --- a/src/gpgpu-sim/l2cache.cc +++ b/src/gpgpu-sim/l2cache.cc @@ -76,11 +76,11 @@ memory_partition_unit::memory_partition_unit( unsigned partition_id, if(!m_config->m_L2_config.disabled()) m_L2cache = new l2_cache(L2c_name,m_config->m_L2_config,-1,-1,m_L2interface,m_mf_allocator,IN_PARTITION_L2_MISS_QUEUE); + n_mem_to_simt=0; unsigned int icnt_L2; unsigned int L2_dram; unsigned int dram_L2; unsigned int L2_icnt; - sscanf(m_config->gpgpu_L2_queue_config,"%u:%u:%u:%u", &icnt_L2,&L2_dram,&dram_L2,&L2_icnt ); m_icnt_L2_queue = new fifo_pipeline("icnt-to-L2",0,icnt_L2); m_L2_dram_queue = new fifo_pipeline("L2-to-dram",0,L2_dram); diff --git a/src/gpuwattch/cacti/basic_circuit.cc b/src/gpuwattch/cacti/basic_circuit.cc index 788b663..9aeb4e7 100644 --- a/src/gpuwattch/cacti/basic_circuit.cc +++ b/src/gpuwattch/cacti/basic_circuit.cc @@ -170,7 +170,7 @@ double drain_C_( bool _is_cell, bool _is_wl_tr) { - double w_folded_tr; + double w_folded_tr=0; const TechnologyParameter::DeviceType * dt; if ((_is_dram) && (_is_cell)) diff --git a/src/gpuwattch/cacti/wire.cc b/src/gpuwattch/cacti/wire.cc index 765d49f..9b0f19c 100644 --- a/src/gpuwattch/cacti/wire.cc +++ b/src/gpuwattch/cacti/wire.cc @@ -39,11 +39,19 @@ Wire::Wire( double w_s, double s_s, enum Wire_placement wp, - double resistivity, + double _resistivity, TechnologyParameter::DeviceType *dt - ):wt(wire_model), wire_length(wl*1e-6), nsense(n), w_scale(w_s), s_scale(s_s), - resistivity(resistivity), deviceType(dt) + ) { + + wt= wire_model; + wire_length=1e-6; + nsense=n; + w_scale=w_s; + s_scale=s_s; + resistivity=_resistivity; + deviceType=dt; + wire_placement = wp; min_w_pmos = deviceType->n_to_p_eff_curr_drv_ratio*g_tp.min_w_nmos_; in_rise_time = 0; diff --git a/src/gpuwattch/cacti/wire.h b/src/gpuwattch/cacti/wire.h index 36e2ece..fb82c5f 100644 --- a/src/gpuwattch/cacti/wire.h +++ b/src/gpuwattch/cacti/wire.h @@ -45,7 +45,7 @@ class Wire : public Component { public: - Wire(enum Wire_type wire_model, double len /* in u*/, + Wire(enum Wire_type wire_model, double len = 0 /* in u*/, int nsense = 1/* no. of sense amps connected to the low-swing wire */, double width_scaling = 1, double spacing_scaling = 1, diff --git a/src/gpuwattch/gpgpu_sim_wrapper.cc b/src/gpuwattch/gpgpu_sim_wrapper.cc index 1b06e26..cf658cd 100644 --- a/src/gpuwattch/gpgpu_sim_wrapper.cc +++ b/src/gpuwattch/gpgpu_sim_wrapper.cc @@ -94,7 +94,7 @@ enum pwr_cmp_t { }; -gpgpu_sim_wrapper::gpgpu_sim_wrapper() { +gpgpu_sim_wrapper::gpgpu_sim_wrapper( char* xmlfile) { count=0; gcount=0; @@ -120,13 +120,44 @@ gpgpu_sim_wrapper::gpgpu_sim_wrapper() { const_dynamic_power=0; gpu_min_power=0; gpu_tot_min_power=0; - + proc_power=0; + + g_power_filename = NULL; + g_power_trace_filename = NULL; + g_metric_trace_filename = NULL; + g_steady_state_tracking_filename = NULL; + xml_filename= xmlfile; + g_power_simulation_enabled= false; + g_power_trace_enabled= false; + g_steady_power_levels_enabled= false; + g_power_trace_zlevel= 0; + g_power_per_cycle_dump= false; + gpu_steady_power_deviation= 0; + gpu_steady_min_period= 0; + + gpu_stat_sample_freq=0; + p=new ParseXML(); + p->parse(xml_filename); + proc = new Processor(p); + power_trace_file = NULL; + metric_trace_file = NULL; + steady_state_tacking_file = NULL; + has_written_avg=false; + init_inst_val=false; } gpgpu_sim_wrapper::~gpgpu_sim_wrapper() { } +bool gpgpu_sim_wrapper::sanity_check(double a, double b) +{ + if (b == 0) + return (abs(a-b)<0.00001); + else + return (abs(a-b)/abs(b)<0.00001); + return false; +} void gpgpu_sim_wrapper::init_mcpat(char* xmlfile, char* powerfilename, char* power_trace_filename,char* metric_trace_filename, char * steady_state_filename, bool power_sim_enabled,bool trace_enabled, bool steady_state_enabled,bool power_per_cycle_dump,double steady_power_deviation, @@ -138,12 +169,6 @@ void gpgpu_sim_wrapper::init_mcpat(char* xmlfile, char* powerfilename, char* pow gpu_max_power=0; pavg=0; - pwr_cmp_avg=(double *)calloc(100,sizeof(double)); - pwr_cmp_min=(double *)calloc(100,sizeof(double)); - pwr_cmp_max=(double *)calloc(100,sizeof(double)); - perf_count_avg=(double *)calloc(100,sizeof(double)); - perf_count_min=(double *)calloc(100,sizeof(double)); - perf_count_max=(double *)calloc(100,sizeof(double)); gpu_min_power=0; static bool mcpat_init=true; @@ -176,10 +201,6 @@ void gpgpu_sim_wrapper::init_mcpat(char* xmlfile, char* powerfilename, char* pow gpu_stat_sample_freq=stat_sample_freq; - - p=new ParseXML(); - p->parse(xml_filename); - proc = new Processor(p); //p->sys.total_cycles=gpu_stat_sample_freq*4; p->sys.total_cycles=gpu_stat_sample_freq; power_trace_file = NULL; @@ -382,21 +403,8 @@ void gpgpu_sim_wrapper::set_NoC_power(double noc_tot_reads,double noc_tot_writes { p->sys.NoC[0].total_accesses = noc_tot_reads * p->sys.scaling_coefficients[NOC_A] + noc_tot_writes * p->sys.scaling_coefficients[NOC_A]; perf_count[NOC_A]=noc_tot_reads+noc_tot_writes; - - } -bool gpgpu_sim_wrapper::sanity_check(double a, double b) -{ - if (b == 0) - return (abs(a-b)<0.00001); - else if(abs(a-b)/abs(b)<0.00001) { - return true; - } - - printf("a = %f, b = %f a-b = %f\n", a,b,a-b); - return false; -} void gpgpu_sim_wrapper::power_metrics_calculations() { @@ -591,6 +599,7 @@ void gpgpu_sim_wrapper::update_components_power() pwr_cmp[IDLE_COREP]=proc->cores[0]->IdleCoreEnergy/(proc->cores[0]->executionTime); //this constant dynamic part is estimated via regression model + pwr_cmp[CONST_DYNAMICP]=0; pwr_cmp[CONST_DYNAMICP]=p->sys.scaling_coefficients[CONST_DYNAMICN]-proc->get_const_dynamic_power()/(proc->cores[0]->executionTime); pwr_cmp[CONST_DYNAMICP]= (pwr_cmp[CONST_DYNAMICP]>0)? pwr_cmp[CONST_DYNAMICP]:0; @@ -600,7 +609,9 @@ void gpgpu_sim_wrapper::update_components_power() for(unsigned i=0; i