summaryrefslogtreecommitdiff
path: root/src/gpgpusim_entrypoint.cc
diff options
context:
space:
mode:
authorTor Aamodt <[email protected]>2018-03-28 15:53:59 -0700
committerTor Aamodt <[email protected]>2018-03-28 15:53:59 -0700
commitd0ee86a0d39f9dfa1eba13ea6cca1b1d0e86523b (patch)
treeb64f6bc12df0785271f73ddc805c1e2b05db0f1c /src/gpgpusim_entrypoint.cc
parent7758943c96d22cd65f3de30b36c71b27370de5ce (diff)
parent635366fe3e9b596318647b9c5bcdd546c522d52a (diff)
Merge remote-tracking branch 'upstream/dev' into dev
Diffstat (limited to 'src/gpgpusim_entrypoint.cc')
-rw-r--r--src/gpgpusim_entrypoint.cc24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/gpgpusim_entrypoint.cc b/src/gpgpusim_entrypoint.cc
index 6ba38eb..ad4587a 100644
--- a/src/gpgpusim_entrypoint.cc
+++ b/src/gpgpusim_entrypoint.cc
@@ -91,6 +91,7 @@ void *gpgpu_sim_thread_sequential(void*)
pthread_mutex_t g_sim_lock = PTHREAD_MUTEX_INITIALIZER;
bool g_sim_active = false;
bool g_sim_done = true;
+bool break_limit = false;
void *gpgpu_sim_thread_concurrent(void*)
{
@@ -100,7 +101,7 @@ void *gpgpu_sim_thread_concurrent(void*)
printf("GPGPU-Sim: *** simulation thread starting and spinning waiting for work ***\n");
fflush(stdout);
}
- while( g_stream_manager->empty_protected() && !g_sim_done )
+ while( g_stream_manager->empty() && !g_sim_done )
;
if(g_debug_execution >= 3) {
printf("GPGPU-Sim: ** START simulation thread (detected work) **\n");
@@ -127,6 +128,15 @@ void *gpgpu_sim_thread_concurrent(void*)
if(g_stream_manager->operation(&sim_cycles) && !g_the_gpu->active())
break;
+ //functional simulation
+ if( g_the_gpu->is_functional_sim()) {
+ kernel_info_t * kernel = g_the_gpu->get_functional_kernel();
+ assert(kernel);
+ gpgpu_cuda_ptx_sim_main_func(*kernel);
+ g_the_gpu->finish_functional_sim(kernel);
+ }
+
+ //performance simulation
if( g_the_gpu->active() ) {
g_the_gpu->cycle();
sim_cycles = true;
@@ -135,15 +145,18 @@ void *gpgpu_sim_thread_concurrent(void*)
if(g_the_gpu->cycle_insn_cta_max_hit()){
g_stream_manager->stop_all_running_kernels();
g_sim_done = true;
+ break_limit = true;
}
}
active=g_the_gpu->active() || !g_stream_manager->empty_protected();
- } while( active );
+
+ } while( active && !g_sim_done);
if(g_debug_execution >= 3) {
printf("GPGPU-Sim: ** STOP simulation thread (no work) **\n");
fflush(stdout);
}
+ g_the_gpu->print_stats();
if(sim_cycles) {
g_the_gpu->update_stats();
print_simulation_time();
@@ -156,6 +169,11 @@ void *gpgpu_sim_thread_concurrent(void*)
printf("GPGPU-Sim: *** simulation thread exiting ***\n");
fflush(stdout);
}
+ if(break_limit) {
+ printf("GPGPU-Sim: ** break due to reaching the maximum cycles (or instructions) **\n");
+ exit(1);
+ }
+
sem_post(&g_sim_signal_exit);
return NULL;
}
@@ -169,7 +187,7 @@ void synchronize()
bool done = false;
do {
pthread_mutex_lock(&g_sim_lock);
- done = g_stream_manager->empty() && !g_sim_active;
+ done = ( g_stream_manager->empty() && !g_sim_active ) || g_sim_done;
pthread_mutex_unlock(&g_sim_lock);
} while (!done);
printf("GPGPU-Sim: detected inactive GPU simulation thread\n");