From d79fab8098036dcad4628c21d61258195721e2a2 Mon Sep 17 00:00:00 2001 From: Tayler Hetherington Date: Mon, 17 Jun 2013 15:05:14 -0800 Subject: Review: 46001. Fixing a source of non-determinism in GPGPU-Sim (Bug 174). Not sure if this is the only issue, but this was definitely a source of non-determinism (checked with many of the -FT benchmarks). In gpgpu_sim_thread_concurrent() (gpgpusim_entrypoint.cc), the inner do{...}while(active); only breaks when the gpu is not active. As a result, the gpu is only initialized when the gpu becomes momentarily inactive. If one kernel completes while another kernel is currently pending in the stream's queue, the next kernel will start running immediately causing the GPU to not be reinitialized (which includes resetting per-kernel stats). The fix simply recognizes that a kernel has completed and breaks from the loop prior to starting the next operation. [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 16463] --- src/stream_manager.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/stream_manager.cc') diff --git a/src/stream_manager.cc b/src/stream_manager.cc index 3b8f57f..07cd44a 100644 --- a/src/stream_manager.cc +++ b/src/stream_manager.cc @@ -197,17 +197,17 @@ stream_manager::stream_manager( gpgpu_sim *gpu, bool cuda_launch_blocking ) pthread_mutex_init(&m_lock,NULL); } -void stream_manager::operation( bool * sim) +bool stream_manager::operation( bool * sim) { - pthread_mutex_lock(&m_lock); - bool check=check_finished_kernel(); - if(check) m_gpu->print_stats(); - stream_operation op =front(); - op.do_operation( m_gpu ); - pthread_mutex_unlock(&m_lock); - //pthread_mutex_lock(&m_lock); + pthread_mutex_lock(&m_lock); + bool check=check_finished_kernel(); + if(check)m_gpu->print_stats(); + stream_operation op =front(); + op.do_operation( m_gpu ); + pthread_mutex_unlock(&m_lock); + //pthread_mutex_lock(&m_lock); // simulate a clock cycle on the GPU - + return check; } bool stream_manager::check_finished_kernel() -- cgit v1.3