summaryrefslogtreecommitdiff
path: root/libcuda
diff options
context:
space:
mode:
authorTor Aamodt <[email protected]>2010-07-16 11:59:09 -0800
committerTor Aamodt <[email protected]>2010-07-16 11:59:09 -0800
commit93a64be21eb3746de0b96a2f2a365f59cd8f1bbc (patch)
tree15a83e210cebc1a90a6afc55d8ce6576689c3494 /libcuda
parent043791634414119a1708390b442ae201fe0d930c (diff)
- template runs/passes with CUDA 3.1, but requires that CUDA 2.3
is installed for math intrinsics used in instructions.cc (since CUDA 3.1 does not seem to define __uint2float). - currently cuda-math.h has hardcoded paths to my own install of CUDA 2.3 (need to determine whether we can build simulator with CUDA 2.3 and run CUDA 3.1 / compute_2x PTX, or need to make current setup more portable) - modified ptxinfo.l to print out meaningful error message if error occurs on first line - modified ptxinfo.l,y to understand "for 'compute_NN'" syntax - updated template to 3.1 SDK version - updated cuda_runtime_api.cc to select highest compute capability version when multiple versions are present. - updated template/BlackScholes Makefiles to generate a "DLL build" instead of static linked build (still confusing... requires one to copy config files... probably need to modify config scripts) [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 6837]
Diffstat (limited to 'libcuda')
-rw-r--r--libcuda/cuda_runtime_api.cc22
1 files changed, 19 insertions, 3 deletions
diff --git a/libcuda/cuda_runtime_api.cc b/libcuda/cuda_runtime_api.cc
index d17383d..6e562fe 100644
--- a/libcuda/cuda_runtime_api.cc
+++ b/libcuda/cuda_runtime_api.cc
@@ -188,7 +188,7 @@ extern struct cudaArray* gpgpu_ptx_sim_accessArrayofTexture(struct textureRefere
extern void gpgpu_ptx_sim_bindNameToTexture(const char* name, const struct textureReference* texref);
extern struct textureReference* gpgpu_ptx_sim_accessTextureofName(char* name);
extern char* gpgpu_ptx_sim_findNamefromTexture(const struct textureReference* texref);
-extern void gpgpu_ptx_sim_add_ptxstring( const char * );
+extern void gpgpu_ptx_sim_add_ptxstring( const char *ptx, const char *source_fname );
extern int g_ptx_sim_mode;
@@ -1038,8 +1038,24 @@ void** CUDARTAPI __cudaRegisterFatBinary( void *fatCubin )
{
#if (CUDART_VERSION >= 2010)
__cudaFatCudaBinary *info = (__cudaFatCudaBinary *)fatCubin;
- if (info->ptx->ptx)
- gpgpu_ptx_sim_add_ptxstring( info->ptx->ptx );
+ assert( info->version == 4 );
+ unsigned num_ptx_versions=0;
+ unsigned max_capability=0;
+ unsigned selected_capability_offset=(unsigned)-1;
+ while( info->ptx[num_ptx_versions].gpuProfileName != NULL ) {
+ unsigned capability=0;
+ sscanf(info->ptx[num_ptx_versions].gpuProfileName,"compute_%u",&capability);
+ if( capability > max_capability ) {
+ max_capability = capability;
+ selected_capability_offset=num_ptx_versions;
+ }
+ num_ptx_versions++;
+ }
+ if ( selected_capability_offset != (unsigned)-1 ) {
+ printf("GPGPU-Sim PTX: __cudaRegisterFatBinary found %u PTX versions for '%s', ", num_ptx_versions, info->ident);
+ printf("selected = %s\n", info->ptx[selected_capability_offset].gpuProfileName );
+ gpgpu_ptx_sim_add_ptxstring( info->ptx[selected_capability_offset].ptx, info->ident );
+ }
#endif
return 0;
}