From d8c39c7de2957efb10797e24b835306e295df7f2 Mon Sep 17 00:00:00 2001 From: Tayler Hetherington Date: Tue, 5 Mar 2013 15:24:42 -0800 Subject: GPUWattch bug fix: Performance counters not being correctly reset at kernel completion. [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 15413] --- src/gpgpu-sim/gpu-sim.cc | 3 +++ src/gpgpu-sim/power_interface.cc | 3 +++ src/gpgpu-sim/power_interface.h | 2 +- src/gpuwattch/gpgpu_sim_wrapper.cc | 18 ++++++++++++++---- src/gpuwattch/gpgpu_sim_wrapper.h | 1 + 5 files changed, 22 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gpgpu-sim/gpu-sim.cc b/src/gpgpu-sim/gpu-sim.cc index 3a8cdea..a6a365c 100644 --- a/src/gpgpu-sim/gpu-sim.cc +++ b/src/gpgpu-sim/gpu-sim.cc @@ -507,6 +507,9 @@ void gpgpu_sim::set_kernel_done( kernel_info_t *kernel ) break; } } +#ifdef GPGPUSIM_POWER_MODEL + mcpat_reset_perf_count(m_gpgpusim_wrapper, true); +#endif assert( k != m_running_kernels.end() ); } diff --git a/src/gpgpu-sim/power_interface.cc b/src/gpgpu-sim/power_interface.cc index 4f8daca..4ff6cf2 100644 --- a/src/gpgpu-sim/power_interface.cc +++ b/src/gpgpu-sim/power_interface.cc @@ -123,3 +123,6 @@ void mcpat_cycle(const gpgpu_sim_config &config, const struct shader_core_config //wrapper->close_files(); } +void mcpat_reset_perf_count(class gpgpu_sim_wrapper *wrapper, bool do_print){ + wrapper->reset_perf_counters(do_print); +} diff --git a/src/gpgpu-sim/power_interface.h b/src/gpgpu-sim/power_interface.h index 9bce430..3d04b7e 100644 --- a/src/gpgpu-sim/power_interface.h +++ b/src/gpgpu-sim/power_interface.h @@ -38,6 +38,6 @@ void init_mcpat(const gpgpu_sim_config &config, class gpgpu_sim_wrapper *wrapper, unsigned stat_sample_freq, unsigned tot_inst, unsigned inst); void mcpat_cycle(const gpgpu_sim_config &config, const struct shader_core_config *shdr_config, class gpgpu_sim_wrapper *wrapper, class power_stat_t *power_stats, unsigned stat_sample_freq, unsigned tot_cycle, unsigned cycle, unsigned tot_inst, unsigned inst); - +void mcpat_reset_perf_count(class gpgpu_sim_wrapper *wrapper, bool do_print); #endif /* POWER_INTERFACE_H_ */ diff --git a/src/gpuwattch/gpgpu_sim_wrapper.cc b/src/gpuwattch/gpgpu_sim_wrapper.cc index 1316e55..bedaae1 100644 --- a/src/gpuwattch/gpgpu_sim_wrapper.cc +++ b/src/gpuwattch/gpgpu_sim_wrapper.cc @@ -151,7 +151,6 @@ void gpgpu_sim_wrapper::init_mcpat(char* xmlfile, char* powerfilename, char* pow s++; } - if(mcpat_init){ g_power_filename = powerfilename; g_power_trace_filename =power_trace_filename; @@ -174,9 +173,10 @@ void gpgpu_sim_wrapper::init_mcpat(char* xmlfile, char* powerfilename, char* pow metric_trace_file = NULL; steady_state_tacking_file = NULL; + if (g_power_trace_enabled ){ - power_trace_file = gzopen(g_power_trace_filename, (mcpat_init)? "w" : "a"); - metric_trace_file = gzopen(g_metric_trace_filename, (mcpat_init)? "w" : "a"); + power_trace_file = gzopen(g_power_trace_filename, "w"); + metric_trace_file = gzopen(g_metric_trace_filename, "w"); if ((power_trace_file == NULL) || (metric_trace_file == NULL)) { printf("error - could not open trace files \n"); exit(1); @@ -199,7 +199,7 @@ void gpgpu_sim_wrapper::init_mcpat(char* xmlfile, char* powerfilename, char* pow gzclose(metric_trace_file); } if(g_steady_power_levels_enabled){ - steady_state_tacking_file = gzopen(g_steady_state_tracking_filename, (mcpat_init)? "w" : "a"); + steady_state_tacking_file = gzopen(g_steady_state_tracking_filename, "w"); if ((steady_state_tacking_file == NULL)) { printf("error - could not open trace files \n"); exit(1); @@ -224,6 +224,16 @@ void gpgpu_sim_wrapper::init_mcpat(char* xmlfile, char* powerfilename, char* pow } +void gpgpu_sim_wrapper::reset_perf_counters(bool do_print){ + if(do_print) + print_trace_files(); + + for(unsigned i=0; isys.core[0].gpgpu_clock_gated_lanes = clk_gated_lanes; diff --git a/src/gpuwattch/gpgpu_sim_wrapper.h b/src/gpuwattch/gpgpu_sim_wrapper.h index eed308f..115db43 100644 --- a/src/gpuwattch/gpgpu_sim_wrapper.h +++ b/src/gpuwattch/gpgpu_sim_wrapper.h @@ -61,6 +61,7 @@ public: void print_trace_files(); void update_components_power(); void update_coefficients(); + void reset_perf_counters(bool do_print); void print_power_kernel_stats(double gpu_sim_cycle, double gpu_tot_sim_cycle, double init_value, const std::string & kernel_info_string); void power_metrics_calculations(); void set_inst_power(bool clk_gated_lanes, double tot_cycles, double busy_cycles, double tot_inst, double int_inst, double fp_inst, double load_inst, double store_inst, double committed_inst); -- cgit v1.3