summaryrefslogtreecommitdiff
path: root/src/gpgpusim_entrypoint.cc
diff options
context:
space:
mode:
authorAhmed El-Shafiey <[email protected]>2012-09-29 10:20:47 -0800
committerAndrew Boktor <[email protected]>2014-08-14 13:49:21 -0700
commit59157dad1253f99b506c0e1a22c793dc96967ce1 (patch)
treebdc587a9e003cea0efcbeddbf65e5248b4276b8e /src/gpgpusim_entrypoint.cc
parent6f8637f120670157230074d3b3f847f00d3e3e2c (diff)
-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]
Diffstat (limited to 'src/gpgpusim_entrypoint.cc')
-rw-r--r--src/gpgpusim_entrypoint.cc26
1 files changed, 8 insertions, 18 deletions
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");