summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAmruth <[email protected]>2018-04-05 01:09:57 +0000
committerTor Aamodt <[email protected]>2018-04-05 01:09:57 +0000
commita17c466a9578f983c48704495566df5a373ff6ba (patch)
tree9856a74f2124d669bbd35daac4a346eacc526cd2 /src
parentdeee9038d3d67e60f106776be3dd0a846dd11df9 (diff)
parent69c57b077d6799f46ad43b99cc0e0049b7c43775 (diff)
Merged in amruth_s/apr2_gpgpusim (pull request #1)
Support for CDP
Diffstat (limited to 'src')
-rw-r--r--src/cuda-sim/instructions.cc7
-rw-r--r--src/cuda-sim/ptx_loader.cc30
2 files changed, 26 insertions, 11 deletions
diff --git a/src/cuda-sim/instructions.cc b/src/cuda-sim/instructions.cc
index 5d97287..0025c52 100644
--- a/src/cuda-sim/instructions.cc
+++ b/src/cuda-sim/instructions.cc
@@ -1471,7 +1471,12 @@ void call_impl( const ptx_instruction *pI, ptx_thread_info *thread )
printf("GPGPU-Sim PTX: PDOM analysis already done for %s \n", target_func->get_name().c_str() );
} else {
printf("GPGPU-Sim PTX: finding reconvergence points for \'%s\'...\n", target_func->get_name().c_str() );
- target_func->do_pdom();
+ /*
+ * Some of the instructions like printf() gives the gpgpusim the wrong impression that it is a function call.
+ * As printf() doesnt have a body like functions do, doing pdom analysis for printf() causes a crash.
+ */
+ if (target_func->get_function_size() >0)
+ target_func->do_pdom();
target_func->set_pdom();
}
diff --git a/src/cuda-sim/ptx_loader.cc b/src/cuda-sim/ptx_loader.cc
index 34870c4..4ddc6bf 100644
--- a/src/cuda-sim/ptx_loader.cc
+++ b/src/cuda-sim/ptx_loader.cc
@@ -353,11 +353,7 @@ void gpgpu_ptxinfo_load_from_string( const char *p_for_info, unsigned source_num
#if CUDART_VERSION >= 3000
if (sm_version == 0) sm_version = 20;
- extern bool g_cdp_enabled;
- if(!g_cdp_enabled)
- snprintf(extra_flags,1024,"--gpu-name=sm_%u",sm_version);
- else
- snprintf(extra_flags,1024,"--compile-only --gpu-name=sm_%u",sm_version);
+ snprintf(extra_flags,1024,"--gpu-name=sm_%u",sm_version);
#endif
snprintf(commandline,1024,"$CUDA_INSTALL_PATH/bin/ptxas %s -v %s --output-file /dev/null 2> %s",
@@ -414,9 +410,15 @@ void gpgpu_ptxinfo_load_from_string( const char *p_for_info, unsigned source_num
snprintf(tempfile_ptxinfo,1024,"%sinfo",fname);
char extra_flags[1024];
extra_flags[0]=0;
-#if CUDART_VERSION >= 3000
- snprintf(extra_flags,1024,"--gpu-name=sm_%u",sm_version);
-#endif
+
+ #if CUDART_VERSION >= 3000
+ if (sm_version == 0) sm_version = 20;
+ extern bool g_cdp_enabled;
+ if(!g_cdp_enabled)
+ snprintf(extra_flags,1024,"--gpu-name=sm_%u",sm_version);
+ else
+ snprintf(extra_flags,1024,"--compile-only --gpu-name=sm_%u",sm_version);
+ #endif
snprintf(commandline,1024,"$CUDA_INSTALL_PATH/bin/ptxas %s -v %s --output-file /dev/null 2> %s",
extra_flags, fname2, tempfile_ptxinfo);
@@ -446,13 +448,21 @@ void gpgpu_ptxinfo_load_from_string( const char *p_for_info, unsigned source_num
g_ptxinfo_filename = final_tempfile_ptxinfo;
else
g_ptxinfo_filename = tempfile_ptxinfo;
+
+ //The program might get stuck because the parser didnt receive a EOF.
+ printf("NOTE: If the program is stuck, please press ctrl+d for Ubuntu/Mac and ctrl+z for Windows users \n");
ptxinfo_parse();
+ snprintf(commandline,1024,"rm -f *info");
+ if( system(commandline) != 0 ) {
+ printf("GPGPU-Sim PTX: ERROR ** while removing temporary info files\n");
+ exit(1);
+ }
if( ! g_save_embedded_ptx ) {
if(no_of_ptx>0)
- snprintf(commandline,1024,"rm -f %s %s %s *info", fname, fname2, final_tempfile_ptxinfo);
+ snprintf(commandline,1024,"rm -f %s %s %s", fname, fname2, final_tempfile_ptxinfo);
else
- snprintf(commandline,1024,"rm -f %s %s %s *info", fname, fname2, tempfile_ptxinfo);
+ snprintf(commandline,1024,"rm -f %s %s %s", fname, fname2, tempfile_ptxinfo);
printf("GPGPU-Sim PTX: removing ptxinfo using \"%s\"\n", commandline);
if( system(commandline) != 0 ) {
printf("GPGPU-Sim PTX: ERROR ** while removing temporary files\n");