From 59157dad1253f99b506c0e1a22c793dc96967ce1 Mon Sep 17 00:00:00 2001 From: Ahmed El-Shafiey Date: Sat, 29 Sep 2012 10:20:47 -0800 Subject: -being more conservative in locking the code of the kernel finish detection, solves the problem of underminitstic kernel finish detection [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 14206] --- src/gpgpusim_entrypoint.cc | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) (limited to 'src/gpgpusim_entrypoint.cc') diff --git a/src/gpgpusim_entrypoint.cc b/src/gpgpusim_entrypoint.cc index 6271f79..3aabb02 100644 --- a/src/gpgpusim_entrypoint.cc +++ b/src/gpgpusim_entrypoint.cc @@ -89,13 +89,12 @@ bool g_sim_done = true; void *gpgpu_sim_thread_concurrent(void*) { // concurrent kernel execution simulation thread - do { if(g_debug_execution >= 3) { printf("GPGPU-Sim: *** simulation thread starting and spinning waiting for work ***\n"); fflush(stdout); } - while( g_stream_manager->empty() && !g_sim_done ) + while( g_stream_manager->empty_protected() && !g_sim_done ) ; if(g_debug_execution >= 3) { printf("GPGPU-Sim: ** START simulation thread (detected work) **\n"); @@ -110,23 +109,14 @@ void *gpgpu_sim_thread_concurrent(void*) g_the_gpu->init(); 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); - g_the_gpu->print_stats(); - } - // 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() ) { - g_the_gpu->cycle(); - sim_cycles = true; - g_the_gpu->deadlock_check(); - } - active = g_the_gpu->active() || !g_stream_manager->empty(); + g_stream_manager->operation(&sim_cycles); + if( g_the_gpu->active() ) { + g_the_gpu->cycle(); + sim_cycles = true; + g_the_gpu->deadlock_check(); + } + active=g_the_gpu->active() || !g_stream_manager->empty_protected(); } while( active ); if(g_debug_execution >= 3) { printf("GPGPU-Sim: ** STOP simulation thread (no work) **\n"); -- cgit v1.3