summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilson Fung <[email protected]>2012-08-13 04:19:58 -0800
committerAndrew Boktor <[email protected]>2014-08-14 13:48:53 -0700
commit8f2b4a6f61ef30d86b9bae7c92ed62f223550a76 (patch)
treea1cbb71be63ae88e4fd6ef1b27fd9231e0f97c19
parent5009c035ab4b201e46af58feb4a231483a0c948e (diff)
Extended andrew's fatbin hack to support CUDA 4.1 and 4.2 as well.
[git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 13744]
-rw-r--r--libcuda/cuda_runtime_api.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/libcuda/cuda_runtime_api.cc b/libcuda/cuda_runtime_api.cc
index c08bb0a..6bbd2f2 100644
--- a/libcuda/cuda_runtime_api.cc
+++ b/libcuda/cuda_runtime_api.cc
@@ -1492,7 +1492,16 @@ void** CUDARTAPI __cudaRegisterFatBinary( void *fatCubin )
static unsigned next_fat_bin_handle = 1;
if(context->get_device()->get_gpgpu()->get_config().use_cuobjdump()) {
char * s1 = *((char**)((char*)fatCubin+8));
+#if (CUDART_VERSION < 4010)
char * filename = (s1+72);
+#else
+ // for CUDA 4.1 and 4.2, the source file name can be found at offset 80,
+ // or offset 96 if the source file has been compiled with a ptxas option
+ char * filename = (s1+80);
+ if (strncmp(filename, "-dlcm=", 6) == 0) {
+ filename += 16;
+ }
+#endif
unsigned fat_cubin_handle = next_fat_bin_handle;
next_fat_bin_handle++;
printf("GPGPU-Sim PTX: __cudaRegisterFatBinary, fat_cubin_handle = %u, filename=%s\n", fat_cubin_handle, filename);