From e1dc8113aa2a51885541f96943bd8d90eaccd968 Mon Sep 17 00:00:00 2001 From: Amruth Date: Thu, 5 Apr 2018 16:31:44 -0700 Subject: fixing file pointer and attributes issues --- src/cuda-sim/cuda-sim.cc | 1 + src/cuda-sim/ptx_loader.cc | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/cuda-sim/cuda-sim.cc b/src/cuda-sim/cuda-sim.cc index dce35ca..b1eaf01 100644 --- a/src/cuda-sim/cuda-sim.cc +++ b/src/cuda-sim/cuda-sim.cc @@ -2155,3 +2155,4 @@ void functionalCoreSim::warp_exit( unsigned warp_id ) } } } + diff --git a/src/cuda-sim/ptx_loader.cc b/src/cuda-sim/ptx_loader.cc index 4ddc6bf..33a4260 100644 --- a/src/cuda-sim/ptx_loader.cc +++ b/src/cuda-sim/ptx_loader.cc @@ -423,6 +423,7 @@ void gpgpu_ptxinfo_load_from_string( const char *p_for_info, unsigned source_num snprintf(commandline,1024,"$CUDA_INSTALL_PATH/bin/ptxas %s -v %s --output-file /dev/null 2> %s", extra_flags, fname2, tempfile_ptxinfo); printf("GPGPU-Sim PTX: generating ptxinfo using \"%s\"\n", commandline); + fflush(stdout); result = system(commandline); if( result != 0 ) { printf("GPGPU-Sim PTX: ERROR ** while loading PTX (b) %d\n", result); @@ -443,14 +444,12 @@ void gpgpu_ptxinfo_load_from_string( const char *p_for_info, unsigned source_num } } - ptxinfo_in = fopen(final_tempfile_ptxinfo,"r"); if(no_of_ptx>0) g_ptxinfo_filename = final_tempfile_ptxinfo; else g_ptxinfo_filename = tempfile_ptxinfo; + ptxinfo_in = fopen(g_ptxinfo_filename,"r"); - //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"); -- cgit v1.3 From c99a4ff88ecf7f69715939d96c1fa8152eee524c Mon Sep 17 00:00:00 2001 From: Amruth Date: Wed, 11 Apr 2018 11:05:12 -0700 Subject: PDOM analysis for child kernel in CDP --- src/cuda-sim/cuda_device_runtime.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src') diff --git a/src/cuda-sim/cuda_device_runtime.cc b/src/cuda-sim/cuda_device_runtime.cc index 4a8ffe5..b399133 100644 --- a/src/cuda-sim/cuda_device_runtime.cc +++ b/src/cuda-sim/cuda_device_runtime.cc @@ -177,6 +177,20 @@ void gpgpusim_cuda_launchDeviceV2(const ptx_instruction * pI, ptx_thread_info * //device_grid = op.grid; device_kernel_entry = config.entry; DEV_RUNTIME_REPORT("find device kernel " << device_kernel_entry->get_name()); + + //PDOM analysis is done for Parent kernel but not for child kernel. + if (device_kernel_entry->is_pdom_set()) { + printf("GPGPU-Sim PTX: PDOM analysis already done for %s \n", device_kernel_entry->get_name().c_str() ); + } else { + printf("GPGPU-Sim PTX: finding reconvergence points for \'%s\'...\n", device_kernel_entry->get_name().c_str() ); + /* + * 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 (device_kernel_entry->get_function_size() >0) + device_kernel_entry->do_pdom(); + device_kernel_entry->set_pdom(); + } //copy data in parameter_buffer to device kernel param memory unsigned device_kernel_arg_size = device_kernel_entry->get_args_aligned_size(); -- cgit v1.3 From f118b10cc49bf771755f2afdee04cde0359d745e Mon Sep 17 00:00:00 2001 From: Amruth Date: Wed, 11 Apr 2018 12:07:34 -0700 Subject: clean up --- libcuda/cuda_runtime_api.cc | 36 +++--------------------------------- src/cuda-sim/cuda-sim.cc | 1 - 2 files changed, 3 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/libcuda/cuda_runtime_api.cc b/libcuda/cuda_runtime_api.cc index 184325c..abdc345 100644 --- a/libcuda/cuda_runtime_api.cc +++ b/libcuda/cuda_runtime_api.cc @@ -349,15 +349,7 @@ class _cuda_device_id *GPGPUSim_Init() prop->maxGridSize[2] = 0x40000000; prop->totalConstMem = 0x40000000; prop->textureAlignment = 0; - /* - * TODO: Update the .config and xml files of all GPU config files with new value of sharedMemPerBlock. - * Previously, this was thought as sharedMemPerMultiprocessor and is being used in many places. - * Check whether all the instances of shared_mem_size(), gpgpu_shmem_size or sharedMemPerBlock are meant to use sharedMemPerBlock or sharedMemPerMultiprocessor. - */ - prop->sharedMemPerBlock = 49152; -#if (CUDART_VERSION > 5000) - prop->sharedMemPerMultiprocessor = the_gpu->shared_mem_size(); -#endif + prop->sharedMemPerBlock = the_gpu->shared_mem_size(); prop->regsPerBlock = the_gpu->num_registers_per_core(); prop->warpSize = the_gpu->wrp_size(); prop->clockRate = the_gpu->shader_clock(); @@ -848,17 +840,8 @@ __host__ cudaError_t CUDARTAPI cudaDeviceGetAttribute(int *value, enum cudaDevic if (device <= dev->num_devices() ) { prop = dev->get_prop(); switch (attr) { - case 2: - *value= prop->maxThreadsDim[0]; - break; - case 3: - *value= prop->maxThreadsDim[1]; - break; - case 4: - *value= prop->maxThreadsDim[2]; - break; case 5: - *value= prop->maxGridSize[0]; + *value= prop->maxGridSize[1]; break; case 6: *value= prop->maxGridSize[1]; @@ -866,12 +849,6 @@ __host__ cudaError_t CUDARTAPI cudaDeviceGetAttribute(int *value, enum cudaDevic case 7: *value= prop->maxGridSize[2]; break; - case 8: - *value= prop->sharedMemPerBlock; - break; - case 9: - *value= prop->totalConstMem; - break; case 10: *value= prop->warpSize; break; @@ -884,14 +861,11 @@ __host__ cudaError_t CUDARTAPI cudaDeviceGetAttribute(int *value, enum cudaDevic case 16: *value= prop->multiProcessorCount ; break; - case 34: - *value= 0; - break; case 39: *value= dev->get_gpgpu()->threads_per_core(); break; case 75: - *value= 9 ; + *value= 8 ; break; case 76: *value= 3 ; @@ -899,9 +873,6 @@ __host__ cudaError_t CUDARTAPI cudaDeviceGetAttribute(int *value, enum cudaDevic case 78: *value= 0 ; //TODO: as of now, we dont support stream priorities. break; - case 81: - *value= prop->sharedMemPerMultiprocessor; - break; default: printf("ERROR: implement the attribute numbered %d \n",attr); abort(); @@ -1911,7 +1882,6 @@ void cuobjdumpParseBinary(unsigned int handle){ if (capability > max_capability) max_capability = capability; } if (max_capability > 20) printf("WARNING: No guarantee that PTX will be parsed for SM version %u\n", max_capability); - //max_capability=context->get_device()->get_gpgpu()->get_config().get_forced_max_capability(); cuobjdumpPTXSection* ptx = NULL; const char* pre_load = getenv("CUOBJDUMP_SIM_FILE"); diff --git a/src/cuda-sim/cuda-sim.cc b/src/cuda-sim/cuda-sim.cc index b1eaf01..dce35ca 100644 --- a/src/cuda-sim/cuda-sim.cc +++ b/src/cuda-sim/cuda-sim.cc @@ -2155,4 +2155,3 @@ void functionalCoreSim::warp_exit( unsigned warp_id ) } } } - -- cgit v1.3