diff options
| author | J <[email protected]> | 2018-07-20 11:40:44 -0700 |
|---|---|---|
| committer | J <[email protected]> | 2018-07-20 11:40:44 -0700 |
| commit | e22b3179ccdee8bfbd1e74f86d93e0d7fc9ae6dc (patch) | |
| tree | 6e1b4a40c9e21809d1d547441feffcfedcd25232 /src | |
| parent | 3a09960577b9c9cbcce8fedeef8874ccc533f378 (diff) | |
load param offsets with refactored code and look in middle of malloc'd area for pointer
Diffstat (limited to 'src')
| -rw-r--r-- | src/cuda-sim/cuda-sim.cc | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/cuda-sim/cuda-sim.cc b/src/cuda-sim/cuda-sim.cc index a499ce9..e0cd3f9 100644 --- a/src/cuda-sim/cuda-sim.cc +++ b/src/cuda-sim/cuda-sim.cc @@ -1238,11 +1238,6 @@ void function_info::ptx_jit_config(std::map<unsigned long long, size_t> mallocPt char * wys_exec_path = getenv("WYS_EXEC_PATH"); assert(wys_exec_path!=NULL); std::string command = std::string("mkdir ") + gpgpusim_path + "/debug_tools/WatchYourStep/data"; - if(system(command.c_str())!=0){ - printf("WARNING: Failed to execute mkdir \n"); - printf("Problematic call: %s", command.c_str()); - abort(); - } std::string filename(std::string(gpgpusim_path) + "/debug_tools/WatchYourStep/data/params.config" + std::to_string(counter)); //initialize paramList @@ -1295,11 +1290,21 @@ void function_info::ptx_jit_config(std::map<unsigned long long, size_t> mallocPt if (paramIsPointer[i->first]){ //is pointer - assert(param_value.size==8); - assert(param_value.size==sizeof(void*) && mallocPtr_Size.find(*(unsigned long long*)param_value.pdata)!=mallocPtr_Size.end()); - //TODO: check in middle of malloc'd memory for pointer + assert(param_value.size==sizeof(void*)&&"MisID'd this param as pointer"); + size_t array_size = 0; + unsigned long long param_pointer = *(unsigned long long*)param_value.pdata; + if(mallocPtr_Size.find(param_pointer)!=mallocPtr_Size.end()){ + array_size = mallocPtr_Size[param_pointer]; + }else{ + for( std::map<unsigned long long, size_t>::iterator j=mallocPtr_Size.begin(); j!=mallocPtr_Size.end(); j++ ) { + if(param_pointer>j->first&¶m_pointer<j->first + j->second){ + array_size = j->first + j->second - param_pointer; + break; + } + } + assert(array_size>0&&"pointer was not previously malloc'd"); + } - size_t array_size = mallocPtr_Size[*(unsigned long long*)param_value.pdata]; unsigned char* val = (unsigned char*) malloc(param_value.size); param_mem->read(param_addr,param_value.size,(void*)val); unsigned char* array_val = (unsigned char*) malloc(array_size); |
