P4 to Git Change 1066332 by emankov@em-hsa-amd on 2014/08/14 11:51:05

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
Cette révision appartient à :
foreman
2014-08-14 12:04:47 -04:00
Parent a7b6276d0d
révision fcfc94d0b5
+7 -1
Voir le fichier
@@ -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" ;