diff options
| author | Andrew M. B. Boktor <[email protected]> | 2012-05-17 15:29:18 -0800 |
|---|---|---|
| committer | Andrew Boktor <[email protected]> | 2014-08-14 13:47:31 -0700 |
| commit | d554e186473cc7e02796680652bd4f81bfc6cc4e (patch) | |
| tree | 0bdf578c3847911fedb5b9ff835e0c2425f6367c /src/cuda-sim/cuda_device_printf.cc | |
| parent | ecb34ef80da3880fcfb3e1d66b40bab1cde5e0cc (diff) | |
fixing cuda printf
[git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 12635]
Diffstat (limited to 'src/cuda-sim/cuda_device_printf.cc')
| -rw-r--r-- | src/cuda-sim/cuda_device_printf.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/cuda-sim/cuda_device_printf.cc b/src/cuda-sim/cuda_device_printf.cc index c499c81..9ac0727 100644 --- a/src/cuda-sim/cuda_device_printf.cc +++ b/src/cuda-sim/cuda_device_printf.cc @@ -54,11 +54,12 @@ void my_cuda_printf(const char *fmtstr,const char *arg_list) } buf[j] = c; buf[j+1] = 0; - unsigned long long value = ((unsigned long long*)arg_list)[arg_offset]; + void* ptr = (void*)&arg_list[arg_offset]; + //unsigned long long value = ((unsigned long long*)arg_list)[arg_offset]; if( c == 'u' || c == 'd' ) { - fprintf(fp,buf,value); + fprintf(fp,buf,*((unsigned long long*)ptr)); } else if( c == 'f' ) { - double tmp = *(double*)(void*)&value; + double tmp = *((double*)ptr); fprintf(fp,buf,tmp); } arg_offset++; @@ -81,10 +82,10 @@ void gpgpusim_cuda_vprintf(const ptx_instruction * pI, ptx_thread_info * thread, assert( formal_param->is_param_local() ); assert( actual_param_op.is_param_local() ); addr_t from_addr = actual_param_op.get_symbol()->get_address(); - char buffer[1024]; - assert(size<1024); + unsigned long long buffer[1024]; + assert(size<1024*sizeof(unsigned long long)); thread->m_local_mem->read(from_addr,size,buffer); - addr_t addr = (addr_t)*(unsigned long long*)((void*)buffer); // should be pointer to generic memory location + addr_t addr = (addr_t)buffer[0]; // should be pointer to generic memory location memory_space *mem=NULL; memory_space_t space = generic_space; decode_space(space,thread,actual_param_op,mem,addr); // figure out which space |
