diff options
| author | Andrew M. B. Boktor <[email protected]> | 2012-05-08 14:22:10 -0800 |
|---|---|---|
| committer | Andrew Boktor <[email protected]> | 2014-08-14 13:19:38 -0700 |
| commit | ac470a84b497769d6a16744e582c81e56f78d343 (patch) | |
| tree | ed2ad464e2ce14e28b902e1ba6a05274974f4e33 /src | |
| parent | f24ae8dd11dc5f49d96bbecab9aecc3e431eb8ff (diff) | |
When a kernel is done, it doesn't mean it finished executing. Instructions could have a few cycles left (e.g. memory).
To prevent the problem with the race condition, no stream operations are allowed to launch until the kernel that has finished finished executing. The loop will exit, the kernel prints its stats, then in the next iteration the next operation is allowed to launch.
[git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 12362]
Diffstat (limited to 'src')
| -rw-r--r-- | src/gpgpusim_entrypoint.cc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/gpgpusim_entrypoint.cc b/src/gpgpusim_entrypoint.cc index 7a39e5d..74a644a 100644 --- a/src/gpgpusim_entrypoint.cc +++ b/src/gpgpusim_entrypoint.cc @@ -107,17 +107,27 @@ 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); - break; //force stats print and update + finished_kernel=true; } - // 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); + + 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); + } // simulate a clock cycle on the GPU if( g_the_gpu->active() ) { |
