From 8f2b4a6f61ef30d86b9bae7c92ed62f223550a76 Mon Sep 17 00:00:00 2001 From: Wilson Fung Date: Mon, 13 Aug 2012 04:19:58 -0800 Subject: 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] --- libcuda/cuda_runtime_api.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'libcuda/cuda_runtime_api.cc') 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); -- cgit v1.3