From 0196ec27fff8ca9b58aa30c7a382fd439ace48e1 Mon Sep 17 00:00:00 2001 From: "Andrew M. B. Boktor" Date: Wed, 8 Aug 2012 21:10:05 -0800 Subject: Fixing bug #7 on gpgpu-sim.org [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 13705] --- CHANGES | 2 ++ libcuda/cuda_runtime_api.cc | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index e8e74a6..ecb323f 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,8 @@ CHANGE LOG: Version 3.1.1 versus 3.1.0 - Bug Fixes: - Fixed a compile error that happens with newer gcc/g++ versions (4.7.1) + - Fixed a bug with the association between cuobjdump output and cubin + handles (Bug #7 external) Version 3.1.1 versus 3.1.0 - Add checks to top level makefile to ensure setup_environment is run and checks to diff --git a/libcuda/cuda_runtime_api.cc b/libcuda/cuda_runtime_api.cc index e189403..35207bd 100644 --- a/libcuda/cuda_runtime_api.cc +++ b/libcuda/cuda_runtime_api.cc @@ -1350,7 +1350,7 @@ void useCuobjdump() { unsigned source_num=1; extract_code_using_cuobjdump(); //extract all the output of cuobjdump to _cuobjdump_*.* cuobjdumpSectionList = pruneSectionList(cuobjdumpSectionList, context); - unsigned total_ptx_files = cuobjdumpSectionList.size()/2; + unsigned total_ptx_files = cuobjdumpSectionList.size()/2 + 1; for ( std::list::iterator iter2 = cuobjdumpSectionList.begin(); iter2 != cuobjdumpSectionList.end(); @@ -1369,14 +1369,14 @@ void useCuobjdump() { elfsection->getELFfilename(), elfsection->getSASSfilename()); symtab=gpgpu_ptx_sim_load_ptx_from_string(ptxplus_str,source_num); - printf("Adding %s with cubin handle %u\n", iter->getPTXfilename().c_str(), source_num); - context->add_binary(symtab, source_num); + printf("Adding %s with cubin handle %u\n", iter->getPTXfilename().c_str(), total_ptx_files-source_num); + context->add_binary(symtab, total_ptx_files-source_num); gpgpu_ptxinfo_load_from_string( ptxcode,total_ptx_files-source_num); delete[] ptxplus_str; } else { symtab=gpgpu_ptx_sim_load_ptx_from_string(ptxcode, source_num); - printf("Adding %s with cubin handle %u\n", iter->getPTXfilename().c_str(), source_num); - context->add_binary(symtab,source_num); + printf("Adding %s with cubin handle %u\n", iter->getPTXfilename().c_str(), total_ptx_files-source_num); + context->add_binary(symtab,total_ptx_files-source_num); gpgpu_ptxinfo_load_from_string( ptxcode, total_ptx_files-source_num); } source_num++; -- cgit v1.3