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


[ROCm/clr commit: 65075e72f1]
Этот коммит содержится в:
Tao Sang
2020-09-04 09:42:14 -04:00
коммит произвёл Tao Sang
родитель eaf65e59ae
Коммит c6a000f618
4 изменённых файлов: 8 добавлений и 14 удалений
+4 -4
Просмотреть файл
@@ -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;
}
+1 -2
Просмотреть файл
@@ -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_);
}
+3 -5
Просмотреть файл
@@ -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<device::Program*>& 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_);
-3
Просмотреть файл
@@ -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--------------------------------------#