From 65075e72f1eba941c7c47864b635bba40da09954 Mon Sep 17 00:00:00 2001 From: Tao Sang Date: Fri, 4 Sep 2020 09:42:14 -0400 Subject: [PATCH] Fix compiling issue exposed by opencl TC build 1.Some files are not built in rocclr so the issues are not found in rocclr build. But the issues are exposed in TC build. 2.Clear unused codes in test cmake file. Change-Id: I1ad4decdf4df5237b93e1ea2547eb39a19f7dc4a --- rocclr/device/gpu/gpubinary.cpp | 8 ++++---- rocclr/device/gpu/gpucompiler.cpp | 3 +-- rocclr/device/gpu/gpuprogram.cpp | 8 +++----- rocclr/elf/test/CMakeLists.txt | 3 --- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/rocclr/device/gpu/gpubinary.cpp b/rocclr/device/gpu/gpubinary.cpp index 4aac6fb864..3e232bf15a 100644 --- a/rocclr/device/gpu/gpubinary.cpp +++ b/rocclr/device/gpu/gpubinary.cpp @@ -110,9 +110,9 @@ bool ClBinary::loadKernels(NullProgram& program, bool* hasRecompiled) { bool usedebugil = program.getCompilerOptions()->oVariables->UseDebugIL; int num = elfIn()->getSymbolNum(); - for (int index = 0; index < num; index++) { + for (int ndx = 0; ndx < num; ndx++) { amd::Elf::SymbolInfo symInfo; - if (!elfIn()->getSymbolInfo(index, &symInfo)) { + if (!elfIn()->getSymbolInfo(ndx, &symInfo)) { LogError("LoadKernelFromElf: getSymbolInfo() fails"); return false; } @@ -457,9 +457,9 @@ bool ClBinary::loadGlobalData(Program& program) { const char _global[] = "_global"; int num = elfIn()->getSymbolNum(); - for (int index = 0; index < num; index++) { + for (int ndx = 0; ndx < num; ndx++) { amd::Elf::SymbolInfo symInfo; - if (!elfIn()->getSymbolInfo(index, &symInfo)) { + if (!elfIn()->getSymbolInfo(ndx, &symInfo)) { LogError("LoadGlobalDataFromElf: getSymbolInfo() fails"); return false; } diff --git a/rocclr/device/gpu/gpucompiler.cpp b/rocclr/device/gpu/gpucompiler.cpp index bdef2318c1..596095a9bd 100644 --- a/rocclr/device/gpu/gpucompiler.cpp +++ b/rocclr/device/gpu/gpucompiler.cpp @@ -244,8 +244,7 @@ bool NullProgram::compileImpl(const std::string& src, clBinary()->elfOut()->addSection(amd::Elf::SOURCE, sourceCode.data(), sourceCode.size()); } if (clBinary()->saveLLVMIR()) { - clBinary()->elfOut()->addSection(amd::Elf::LLVMIR, llvmBinary_.data(), llvmBinary_.size(), - false); + clBinary()->elfOut()->addSection(amd::Elf::LLVMIR, llvmBinary_.data(), llvmBinary_.size()); // store the original compile options clBinary()->storeCompileOptions(compileOptions_); } diff --git a/rocclr/device/gpu/gpuprogram.cpp b/rocclr/device/gpu/gpuprogram.cpp index 4874cf1052..f42553ff57 100644 --- a/rocclr/device/gpu/gpuprogram.cpp +++ b/rocclr/device/gpu/gpuprogram.cpp @@ -176,7 +176,7 @@ bool NullProgram::linkImpl(amd::option::Options* options) { if (clBinary()->loadLlvmBinary(llvmBinary_, elfSectionType_) && (!llvmBinary_.empty())) { clBinary()->elfOut()->addSection(elfSectionType_, llvmBinary_.data(), - llvmBinary_.size(), false); + llvmBinary_.size()); } } @@ -209,8 +209,7 @@ bool NullProgram::linkImpl(amd::option::Options* options) { clBinary()->elfOut()->addSection(amd::Elf::SOURCE, section, sz); } if (clBinary()->saveLLVMIR()) { - clBinary()->elfOut()->addSection(elfSectionType_, llvmBinary_.data(), llvmBinary_.size(), - false); + clBinary()->elfOut()->addSection(elfSectionType_, llvmBinary_.data(), llvmBinary_.size()); } } else { buildLog_ += "Internal error: Input OpenCL binary is not for the target!\n"; @@ -567,8 +566,7 @@ bool NullProgram::linkImpl(const std::vector& inputPrograms, } if (clBinary()->saveLLVMIR()) { - clBinary()->elfOut()->addSection(amd::Elf::LLVMIR, llvmBinary_.data(), llvmBinary_.size(), - false); + clBinary()->elfOut()->addSection(amd::Elf::LLVMIR, llvmBinary_.data(), llvmBinary_.size()); // store the original link options clBinary()->storeLinkOptions(linkOptions_); diff --git a/rocclr/elf/test/CMakeLists.txt b/rocclr/elf/test/CMakeLists.txt index 6ff3f26d05..2fede50563 100644 --- a/rocclr/elf/test/CMakeLists.txt +++ b/rocclr/elf/test/CMakeLists.txt @@ -38,9 +38,6 @@ target_include_directories(elf_test add_definitions(-DUSE_COMGR_LIBRARY -DCOMGR_DYN_DLL -DWITH_LIGHTNING_COMPILER -DDEBUG) -#target_link_libraries(elf_test PUBLIC pthread) -#target_link_libraries(elf_test PRIVATE amdrocclr_static pthread hsa-runtime64::hsa-runtime64) target_link_libraries(elf_test PRIVATE amdrocclr_static) -#install(TARGETS elf_test RUNTIME DESTINATION bin) #-------------------------------------elf_test--------------------------------------# \ No newline at end of file