summaryrefslogtreecommitdiff
path: root/libcuda/cuda_runtime_api.cc
diff options
context:
space:
mode:
authorAmruth <[email protected]>2018-04-05 16:31:44 -0700
committerAmruth <[email protected]>2018-04-05 16:31:44 -0700
commite1dc8113aa2a51885541f96943bd8d90eaccd968 (patch)
tree846c18633b7b1e656e5986e4a544eca9652a8f89 /libcuda/cuda_runtime_api.cc
parent69c57b077d6799f46ad43b99cc0e0049b7c43775 (diff)
fixing file pointer and attributes issues
Diffstat (limited to 'libcuda/cuda_runtime_api.cc')
-rw-r--r--libcuda/cuda_runtime_api.cc34
1 files changed, 32 insertions, 2 deletions
diff --git a/libcuda/cuda_runtime_api.cc b/libcuda/cuda_runtime_api.cc
index c103244..3fd88dc 100644
--- a/libcuda/cuda_runtime_api.cc
+++ b/libcuda/cuda_runtime_api.cc
@@ -349,7 +349,15 @@ class _cuda_device_id *GPGPUSim_Init()
prop->maxGridSize[2] = 0x40000000;
prop->totalConstMem = 0x40000000;
prop->textureAlignment = 0;
- prop->sharedMemPerBlock = the_gpu->shared_mem_size();
+ /*
+ * 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->regsPerBlock = the_gpu->num_registers_per_core();
prop->warpSize = the_gpu->wrp_size();
prop->clockRate = the_gpu->shader_clock();
@@ -840,6 +848,15 @@ __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];
break;
@@ -849,6 +866,12 @@ __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;
@@ -861,11 +884,14 @@ __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= 8 ;
+ *value= 9 ;
break;
case 76:
*value= 3 ;
@@ -873,6 +899,9 @@ __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();
@@ -1882,6 +1911,7 @@ 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");