summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJin Wang <[email protected]>2014-11-02 19:24:37 -0500
committerJin Wang <[email protected]>2016-07-05 09:16:53 -0400
commitcf507ddb207337bc7a67ded7c4438f0cb0bed26f (patch)
treed543a1ee86d9717a516abff3e30f0b72ec83bf62
parentf372a4c641b9e6d38470ead6ae25743d26c5fed1 (diff)
BUG: PTX section id. ADD: cudaDeviceSetLimit. BUG: parameter addresses for child kernels in CDP. BUG: .weak .entry and .weak .global directives in ptx file. BUG: empty_protected() for stream manager causes deadlock, change to empty()
-rw-r--r--libcuda/cuda_runtime_api.cc5
-rw-r--r--src/cuda-sim/cuda-sim.cc9
-rw-r--r--src/cuda-sim/cuda_device_runtime.cc9
-rw-r--r--src/cuda-sim/ptx.y2
-rw-r--r--src/gpgpusim_entrypoint.cc2
5 files changed, 16 insertions, 11 deletions
diff --git a/libcuda/cuda_runtime_api.cc b/libcuda/cuda_runtime_api.cc
index 5310a52..30bf823 100644
--- a/libcuda/cuda_runtime_api.cc
+++ b/libcuda/cuda_runtime_api.cc
@@ -2018,6 +2018,11 @@ __host__ cudaError_t CUDARTAPI cudaFuncSetCacheConfig(const char *func, enum cud
context->get_device()->get_gpgpu()->set_cache_config(context->get_kernel(func)->get_name(), (FuncCache)cacheConfig);
return g_last_cudaError = cudaSuccess;
}
+
+//Jin: hack for cdp
+__host__ cudaError_t CUDARTAPI cudaDeviceSetLimit(enum cudaLimit limit, size_t value) {
+ return g_last_cudaError = cudaSuccess;
+}
#endif
#endif
diff --git a/src/cuda-sim/cuda-sim.cc b/src/cuda-sim/cuda-sim.cc
index 8dd1078..980afc8 100644
--- a/src/cuda-sim/cuda-sim.cc
+++ b/src/cuda-sim/cuda-sim.cc
@@ -1074,15 +1074,14 @@ unsigned function_info::get_args_aligned_size() {
std::string name = p.get_name();
symbol *param = m_symtab->lookup(name.c_str());
- size_t arg_size = p.get_size(); // size of param in bytes
+ size_t arg_size = p.get_size() / 8; // size of param in bytes
total_size = (total_size + arg_size - 1) / arg_size * arg_size; //aligned
p.add_offset(total_size);
- param_address += total_size;
- param->set_address(param_address);
+ param->set_address(param_address + total_size);
total_size += arg_size;
}
- return (total_size + 3) / 4; //final size aligned to word
+ return (total_size + 3) / 4 * 4; //final size aligned to word
}
@@ -1219,8 +1218,6 @@ void ptx_thread_info::ptx_exec_inst( warp_inst_t &inst, unsigned lane_id)
bool skip = false;
int op_classification = 0;
addr_t pc = next_instr();
- if(pc == 440)
- pc = 440;
assert( pc == inst.pc ); // make sure timing model and functional model are in sync
const ptx_instruction *pI = m_func_info->get_instruction(pc);
set_npc( pc + pI->inst_size() );
diff --git a/src/cuda-sim/cuda_device_runtime.cc b/src/cuda-sim/cuda_device_runtime.cc
index c53ea04..2a90cba 100644
--- a/src/cuda-sim/cuda_device_runtime.cc
+++ b/src/cuda-sim/cuda_device_runtime.cc
@@ -139,10 +139,11 @@ void gpgpusim_cuda_launchDeviceV2(const ptx_instruction * pI, ptx_thread_info *
DEV_RUNTIME_REPORT("child_kernel_arg_size " << child_kernel_arg_size);
memory_space *child_kernel_param_mem = child_grid->get_param_memory();
size_t param_start_address = 0;
- for(unsigned n = 0; n < child_kernel_arg_size; n++) {
- unsigned char one_byte;
- thread->get_gpu()->get_global_memory()->read((size_t)parameter_buffer + n, 1, &one_byte);
- child_kernel_param_mem->write(param_start_address + n, 1, &one_byte, NULL, NULL);
+ //copy in word
+ for(unsigned n = 0; n < child_kernel_arg_size; n += 4) {
+ unsigned int oneword;
+ thread->get_gpu()->get_global_memory()->read((size_t)parameter_buffer + n, 4, &oneword);
+ child_kernel_param_mem->write(param_start_address + n, 4, &oneword, NULL, NULL);
}
}
else if(arg == 1) { //cudaStream for the child kernel
diff --git a/src/cuda-sim/ptx.y b/src/cuda-sim/ptx.y
index c8208ea..e29b973 100644
--- a/src/cuda-sim/ptx.y
+++ b/src/cuda-sim/ptx.y
@@ -241,6 +241,7 @@ function_ident_param: IDENTIFIER { add_function_name($1); } LEFT_PAREN {func_hea
function_decl_header: ENTRY_DIRECTIVE { $$ = 1; g_func_decl=1; func_header(".entry"); }
| VISIBLE_DIRECTIVE ENTRY_DIRECTIVE { $$ = 1; g_func_decl=1; func_header(".entry"); }
+ | WEAK_DIRECTIVE ENTRY_DIRECTIVE { $$ = 1; g_func_decl=1; func_header(".entry"); }
| FUNC_DIRECTIVE { $$ = 0; g_func_decl=1; func_header(".func"); }
| VISIBLE_DIRECTIVE FUNC_DIRECTIVE { $$ = 0; g_func_decl=1; func_header(".func"); }
| EXTERN_DIRECTIVE FUNC_DIRECTIVE { $$ = 2; g_func_decl=1; func_header(".func"); }
@@ -323,6 +324,7 @@ var_spec: space_spec
| type_spec
| align_spec
| EXTERN_DIRECTIVE { add_extern_spec(); }
+ | WEAK_DIRECTIVE
;
align_spec: ALIGN_DIRECTIVE INT_OPERAND { add_alignment_spec($2); }
diff --git a/src/gpgpusim_entrypoint.cc b/src/gpgpusim_entrypoint.cc
index 31f3a41..fb17eed 100644
--- a/src/gpgpusim_entrypoint.cc
+++ b/src/gpgpusim_entrypoint.cc
@@ -100,7 +100,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");