summaryrefslogtreecommitdiff
path: root/libcuda
diff options
context:
space:
mode:
Diffstat (limited to 'libcuda')
-rw-r--r--libcuda/cuda_runtime_api.cc49
1 files changed, 45 insertions, 4 deletions
diff --git a/libcuda/cuda_runtime_api.cc b/libcuda/cuda_runtime_api.cc
index c103244..d6ce4e0 100644
--- a/libcuda/cuda_runtime_api.cc
+++ b/libcuda/cuda_runtime_api.cc
@@ -349,7 +349,24 @@ 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 = the_gpu->shared_mem_per_block();
+
+ #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,7 +857,16 @@ __host__ cudaError_t CUDARTAPI cudaDeviceGetAttribute(int *value, enum cudaDevic
if (device <= dev->num_devices() ) {
prop = dev->get_prop();
switch (attr) {
- case 5:
+ 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;
case 6:
@@ -849,6 +875,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 +893,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,8 +908,14 @@ __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;
+ case 82:
+ *value= prop->regsPerBlock;
+ break;
default:
- printf("ERROR: implement the attribute numbered %d \n",attr);
+ printf("ERROR: Attribute number %d unimplemented \n",attr);
abort();
}
return g_last_cudaError = cudaSuccess;