From 319d541210cf1c5c00d11f8f9bb41dee7d7d8f76 Mon Sep 17 00:00:00 2001 From: "Andrew M. B. Boktor" Date: Tue, 8 May 2012 18:19:15 -0800 Subject: A much easier way to attempt to fix the problem targeted by CL12362 is to just print the stats whenever a kernel is done. This requires decoupling updating the stats from printing them and modifying the printing code to accomodate this change. [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 12366] --- src/gpgpu-sim/gpu-sim.cc | 13 ++++++++----- src/gpgpu-sim/gpu-sim.h | 1 + src/gpgpusim_entrypoint.cc | 23 +++++++---------------- 3 files changed, 16 insertions(+), 21 deletions(-) diff --git a/src/gpgpu-sim/gpu-sim.cc b/src/gpgpu-sim/gpu-sim.cc index c96ed9e..ee8f99a 100644 --- a/src/gpgpu-sim/gpu-sim.cc +++ b/src/gpgpu-sim/gpu-sim.cc @@ -554,11 +554,14 @@ void gpgpu_sim::init() icnt_init_grid(); } -void gpgpu_sim::print_stats() -{ +void gpgpu_sim::update_stats() { m_memory_stats->memlatstat_lat_pw(); gpu_tot_sim_cycle += gpu_sim_cycle; gpu_tot_sim_insn += gpu_sim_insn; +} + +void gpgpu_sim::print_stats() +{ ptx_file_line_stats_write_file(); gpu_print_stat(); @@ -616,9 +619,9 @@ void gpgpu_sim::gpu_print_stat() const printf("gpu_sim_cycle = %lld\n", gpu_sim_cycle); printf("gpu_sim_insn = %lld\n", gpu_sim_insn); printf("gpu_ipc = %12.4f\n", (float)gpu_sim_insn / gpu_sim_cycle); - printf("gpu_tot_sim_cycle = %lld\n", gpu_tot_sim_cycle); - printf("gpu_tot_sim_insn = %lld\n", gpu_tot_sim_insn); - printf("gpu_tot_ipc = %12.4f\n", (float)gpu_tot_sim_insn / gpu_tot_sim_cycle); + printf("gpu_tot_sim_cycle = %lld\n", gpu_tot_sim_cycle+gpu_sim_cycle); + printf("gpu_tot_sim_insn = %lld\n", gpu_tot_sim_insn+gpu_sim_insn); + printf("gpu_tot_ipc = %12.4f\n", (float)(gpu_tot_sim_insn+gpu_sim_cycle) / (gpu_tot_sim_cycle+gpu_sim_cycle)); printf("gpu_tot_issued_cta = %lld\n", gpu_tot_issued_cta); // performance counter for stalls due to congestion. diff --git a/src/gpgpu-sim/gpu-sim.h b/src/gpgpu-sim/gpu-sim.h index 208cfb8..e77f859 100644 --- a/src/gpgpu-sim/gpu-sim.h +++ b/src/gpgpu-sim/gpu-sim.h @@ -237,6 +237,7 @@ public: void cycle(); bool active(); void print_stats(); + void update_stats(); void deadlock_check(); void get_pdom_stack_top_info( unsigned sid, unsigned tid, unsigned *pc, unsigned *rpc ); diff --git a/src/gpgpusim_entrypoint.cc b/src/gpgpusim_entrypoint.cc index 74a644a..5c20056 100644 --- a/src/gpgpusim_entrypoint.cc +++ b/src/gpgpusim_entrypoint.cc @@ -107,27 +107,17 @@ void *gpgpu_sim_thread_concurrent(void*) bool active = false; bool sim_cycles = false; g_the_gpu->init(); - bool finished_kernel=false; do { // check if a kernel has completed unsigned grid_uid = g_the_gpu->finished_kernel(); if( grid_uid ){ g_stream_manager->register_finished_kernel(grid_uid); - finished_kernel=true; + g_the_gpu->print_stats(); } - - if(finished_kernel){ - if(!g_the_gpu->active()) break; //delay the break until all instructions drain - } - else{ - /* Only insert new operations if no kernels have finished since the start of this - loop - */ - // launch operation on device if one is pending and can be run - stream_operation op = g_stream_manager->front(); - op.do_operation(g_the_gpu); - } + // launch operation on device if one is pending and can be run + stream_operation op = g_stream_manager->front(); + op.do_operation(g_the_gpu); // simulate a clock cycle on the GPU if( g_the_gpu->active() ) { @@ -141,8 +131,9 @@ void *gpgpu_sim_thread_concurrent(void*) printf("GPGPU-Sim: ** STOP simulation thread (no work) **\n"); fflush(stdout); } - if( sim_cycles ) - g_the_gpu->print_stats(); + if(sim_cycles) { + g_the_gpu->update_stats(); + } pthread_mutex_lock(&g_sim_lock); g_sim_active = false; pthread_mutex_unlock(&g_sim_lock); -- cgit v1.3