P4 to Git Change 1068366 by emankov@em-hsa-amd on 2014/08/20 07:59:20

ECR #333753 - Compiler Lib & RT: Fix for Compiler's build log printing on RT.

	+ RT now asks correctly Compiler's build log by aclGetCompilerLog().
	+ BuildLog is added for HSAILKernel by moving it from NullKernel class to Kernel class.
	+ Compiler's Lib appendLogToCL() is fixed.
	+ Usage of API's aclExtractSection/aclExtractSymbol/aclInsertSection/aclInsertSymbol in Compiler Lib itself replaced by it's inner realizations extSec/extSym/insSec/insSym due to unneded build log clearing in first case.
	+ Phase info is added to build log even if CallBack function is not presented for aclCompiler.

	How to verify:
	set AMD_OCL_BUILD_OPTIONS_APPEND="-print-compile-phases -buildlog=stdout"
	test_integer_ops integer_ctz
	test_integer_ops integer_ctz cpu

	Testing: make smoke_clang, selective OCL conf. tests, pre check-in

	Reviewer: Brian Sumner, German Andryeyev
	Review board:	http://ocltc.amd.com/reviews/r/5582/

Affected files ...

... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/v0_8/if_acl.cpp#46 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/brig_loader.cpp#13 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/hsail_be.cpp#31 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/v0_8/libUtils.cpp#4 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#228 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.cpp#262 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.hpp#100 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuprogram.cpp#174 edit
This commit is contained in:
foreman
2014-08-20 08:05:49 -04:00
parent 7035548e92
commit 96c74ba5fd
5 changed files with 16 additions and 11 deletions
+9 -6
View File
@@ -459,20 +459,23 @@ appendLogToCL(aclCompiler *cl, const std::string &logStr)
if (logStr.empty()) {
return;
}
unsigned size = logStr.size() + cl->logSize;
std::string log = logStr;
if ('\n' != log[log.size()-1]) {
log.append("\n");
}
unsigned size = cl->logSize + log.size();
if (!size) {
return;
}
char *tmpBuildLog = reinterpret_cast<char*>(aclutAlloc(cl)(size + 2));
memset(tmpBuildLog, 0, size + 2);
if (cl->logSize) {
std::copy(cl->buildLog,cl->buildLog + cl->logSize, tmpBuildLog);
std::copy(logStr.begin(), logStr.end(), tmpBuildLog + cl->logSize + 1);
tmpBuildLog[cl->logSize] = '\n';
std::copy(cl->buildLog, cl->buildLog + cl->logSize, tmpBuildLog);
std::copy(log.begin(), log.end(), tmpBuildLog + cl->logSize);
} else {
std::copy(logStr.begin(), logStr.end(), tmpBuildLog);
std::copy(log.begin(), log.end(), tmpBuildLog);
}
cl->logSize += (unsigned int)logStr.size();
cl->logSize += (unsigned int)log.size();
if (cl->buildLog) {
aclutFree(cl)(cl->buildLog);
}