From fcfc94d0b5dd9f9dc4d9fb6f7837c2739ddc6530 Mon Sep 17 00:00:00 2001 From: foreman Date: Thu, 14 Aug 2014 12:04:47 -0400 Subject: [PATCH] P4 to Git Change 1066332 by emankov@em-hsa-amd on 2014/08/14 11:51:05 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ECR #333753 - RT: Bug 10185 fix [Bug] "Failure in 1.2 conformance sub-test 'program_binary_type' of 'compiler' and sub-test 'binary_create' of 'api' when forced to run in HSAIL path". P.S. Failure also occurs in 2.0 conformance above-stated tests. [Problem] HSAIL text is inserted by Compiler Lib into the BIF as a symbol of .cg section, but RT extracts it as a whole section. As a result in the extracted bits another .cg section’s symbol __Loader_Map is also presented in the beginning and with trailing zeroes. This leads to cropping the whole HSAIL text while casting to string; then RT silently doesn't perform kernels' finalization cause unable to find any kernel name in the extracted “hsail”. Finally the binary produced based on clCreateProgramWithBinary has the different sections/symbols order from the binary produced based on clCreateProgramWithSource. [Solution] Extract Symbol __HSAIL_main_text instead of the section aclCODEGEN contains it. [Testing] smoke_clang, pre check-in [Reviewers] German Andryeyev, Brian Sumner Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuprogram.cpp#172 edit --- rocclr/runtime/device/gpu/gpuprogram.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rocclr/runtime/device/gpu/gpuprogram.cpp b/rocclr/runtime/device/gpu/gpuprogram.cpp index e4c35ea048..4995236b64 100644 --- a/rocclr/runtime/device/gpu/gpuprogram.cpp +++ b/rocclr/runtime/device/gpu/gpuprogram.cpp @@ -4,6 +4,8 @@ #include "os/os.hpp" #include "utils/flags.hpp" +#include "include/aclTypes.h" +#include "utils/bif_section_labels.hpp" #include "device/gpu/gpuprogram.hpp" #include "device/gpu/gpublit.hpp" #include "macrodata.h" @@ -2059,10 +2061,14 @@ HSAILProgram::linkImpl(amd::option::Options* options) } size_t fsailSize; - const void *hsailText = aclExtractSection(dev().hsaCompiler(), + const oclBIFSymbolStruct* symbol = findBIF30SymStruct(symHSAILText); + assert(symbol && "symbol not found"); + std::string symName = symbol->str[PRE] + std::string("main") + symbol->str[POST]; + const void *hsailText = aclExtractSymbol(dev().hsaCompiler(), binaryElf_, &fsailSize, aclCODEGEN, + symName.c_str(), &errorCode); if (errorCode != ACL_SUCCESS) { buildLog_ += "Error while reading out the HSAIL from the ELF" ;