summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES2
-rw-r--r--libcuda/cuda_runtime_api.cc10
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<cuobjdumpSection*>::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++;