From 32bf941a97c14325ae8b0f8a786fa9ed2c7ce782 Mon Sep 17 00:00:00 2001 From: foreman Date: Wed, 26 Aug 2015 16:06:42 -0400 Subject: [PATCH] P4 to Git Change 1184826 by rayxiao@alit_opencl_rayxiao on 2015/08/26 15:42:10 ECR #340775 - OCL12Adapter: adapter pass to translate CL1.2 kernel builtin calls to 2.0 calls. Set AMD_OCL_BUILD_OPTIONS_APPEND=-cl-std=CL1.2 and GPU_HSAIL_ENABLE=1 to run 1.2 kernels on non-legacy path. Some HSAProfileAPITests are temporarily disabled, kernels need to be updated to receive 6 hidden arguments. Affected files ... ... //depot/stg/opencl/drivers/opencl/compiler/lib/linker/lib/AMDFixupKernelModule.cpp#4 edit ... //depot/stg/opencl/drivers/opencl/compiler/llvm/include/llvm/InitializePasses.h#84 edit ... //depot/stg/opencl/drivers/opencl/compiler/llvm/include/llvm/Transforms/Scalar.h#89 edit ... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Transforms/Scalar/AMDInsertOpenCLKernenv.cpp#8 edit ... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Transforms/Scalar/AMDOCL12Adapter.cpp#3 add ... //depot/stg/opencl/drivers/opencl/compiler/llvm/lib/Transforms/Scalar/AMDPrintfRuntimeBinding.cpp#13 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuprogram.cpp#203 edit ... //depot/stg/opencl/drivers/opencl/tests/ocltst/module/compiler/GlobalConstPtr/simpleCopy.cpp#5 edit ... //depot/stg/opencl/drivers/opencl/tests/ocltst/module/compiler/OCLBinaryOperations.cpp#8 edit ... //depot/stg/opencl/drivers/opencl/tests/ocltst/module/compiler/OCLSeparateCompile.cpp#13 edit ... //depot/stg/opencl/drivers/opencl/tests/ocltst/module/compiler/oclcompiler.exclude.hsail12#3 add ... //depot/stg/opencl/drivers/opencl/tests/ocltst/module/runtime/oclruntime.exclude.hsail12#3 add --- rocclr/runtime/device/gpu/gpuprogram.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/rocclr/runtime/device/gpu/gpuprogram.cpp b/rocclr/runtime/device/gpu/gpuprogram.cpp index c8a737ae70..888bd0afcb 100644 --- a/rocclr/runtime/device/gpu/gpuprogram.cpp +++ b/rocclr/runtime/device/gpu/gpuprogram.cpp @@ -1817,6 +1817,11 @@ HSAILProgram::linkImpl( errorCode = aclLink(dev().hsaCompiler(), binaries_to_link[0], binaries_to_link.size() - 1, &binaries_to_link[1], ACL_TYPE_LLVMIR_BINARY, "-create-library", NULL); + if (errorCode != ACL_SUCCESS) { + buildLog_ +="Error while linking : \ + aclLink failed" ; + return false; + } } // Store the newly linked aclBinary for this program. binaryElf_ = binaries_to_link[0]; @@ -1824,7 +1829,17 @@ HSAILProgram::linkImpl( for (size_t i = 1; i < binaries_to_link.size(); i++) { aclBinaryFini(binaries_to_link[i]); } - + if (createLibrary || options->oVariables->EnableDebug) { + // Save the binary in the interface class + size_t size = 0; + void *mem = NULL; + aclWriteToMem(binaryElf_, &mem, &size); + setBinary(static_cast(mem), size); + if (createLibrary) + setType(TYPE_LIBRARY); + buildLog_ += aclGetCompilerLog(dev().hsaCompiler()); + return true; + } // Now call linkImpl with the new options return linkImpl(options); }