From 07b1e93f19bef20a9e35fcfc48b091fa36d56d1b Mon Sep 17 00:00:00 2001 From: Tayler Hetherington Date: Fri, 5 Jun 2015 14:49:14 -0700 Subject: Fixing bug with max cycle/instruction/cta + bug with C++ name de-mangling with spaces (e.g., using templates) --- src/cuda-sim/ptx_ir.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/cuda-sim') diff --git a/src/cuda-sim/ptx_ir.cc b/src/cuda-sim/ptx_ir.cc index 6943b48..fa37cc4 100644 --- a/src/cuda-sim/ptx_ir.cc +++ b/src/cuda-sim/ptx_ir.cc @@ -1256,10 +1256,12 @@ unsigned function_info::print_insn( unsigned pc, FILE * fp ) const unsigned index = pc - m_start_PC; char command[1024]; char buffer[1024]; - snprintf(command,1024,"c++filt -p %s",m_name.c_str()); + memset(command, 0, 1024); + memset(buffer, 0, 1024); + snprintf(command,1024,"c++filt -p %s\n",m_name.c_str()); FILE *p = popen(command,"r"); buffer[0]=0; - fscanf(p,"%1023s",buffer); + fgets(buffer, 1023, p); fprintf(fp,"%s",buffer); if ( index >= m_instr_mem_size ) { fprintf(fp, "", m_start_PC + m_instr_mem_size - 1 ); -- cgit v1.3 From d3a28ecd166dbbb46804b1c73de139a0512b0d64 Mon Sep 17 00:00:00 2001 From: Tayler Hetherington Date: Fri, 5 Jun 2015 15:46:35 -0700 Subject: Fixing bug with local stats not being reset on call to update_stats. Added code to remove the trailing newline character from the C++ name de-mangling fix. Also, fixed small bug with previous commit --- src/cuda-sim/ptx_ir.cc | 5 ++++- src/gpgpu-sim/gpu-sim.cc | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'src/cuda-sim') diff --git a/src/cuda-sim/ptx_ir.cc b/src/cuda-sim/ptx_ir.cc index fa37cc4..751b3f4 100644 --- a/src/cuda-sim/ptx_ir.cc +++ b/src/cuda-sim/ptx_ir.cc @@ -1258,10 +1258,13 @@ unsigned function_info::print_insn( unsigned pc, FILE * fp ) const char buffer[1024]; memset(command, 0, 1024); memset(buffer, 0, 1024); - snprintf(command,1024,"c++filt -p %s\n",m_name.c_str()); + snprintf(command,1024,"c++filt -p %s",m_name.c_str()); FILE *p = popen(command,"r"); buffer[0]=0; fgets(buffer, 1023, p); + // Remove trailing "\n" in buffer + char *c; + if ((c=strchr(buffer, '\n')) != NULL) *c = '\0'; fprintf(fp,"%s",buffer); if ( index >= m_instr_mem_size ) { fprintf(fp, "", m_start_PC + m_instr_mem_size - 1 ); diff --git a/src/gpgpu-sim/gpu-sim.cc b/src/gpgpu-sim/gpu-sim.cc index 32de005..eafb909 100644 --- a/src/gpgpu-sim/gpu-sim.cc +++ b/src/gpgpu-sim/gpu-sim.cc @@ -520,7 +520,7 @@ kernel_info_t *gpgpu_sim::select_kernel() { for(unsigned n=0; n < m_running_kernels.size(); n++ ) { unsigned idx = (n+m_last_issued_kernel+1)%m_config.max_concurrent_kernel; - if( kernel_more_cta_left(m_running_kernels[idx] ){ + if( kernel_more_cta_left(m_running_kernels[idx]) ){ m_last_issued_kernel=idx; // record this kernel for stat print if it is the first time this kernel is selected for execution unsigned launch_uid = m_running_kernels[idx]->get_uid(); @@ -749,6 +749,10 @@ void gpgpu_sim::update_stats() { gpu_tot_sim_cycle += gpu_sim_cycle; gpu_tot_sim_insn += gpu_sim_insn; gpu_tot_issued_cta += m_total_cta_launched; + + gpu_sim_cycle = 0; + gpu_sim_insn = 0; + m_total_cta_launched = 0; } void gpgpu_sim::print_stats() -- cgit v1.3