From d68ce71f32ae8d12629b4ecce75bfc055f6932f4 Mon Sep 17 00:00:00 2001 From: foreman Date: Mon, 9 Feb 2015 07:02:35 -0500 Subject: [PATCH] P4 to Git Change 1120039 by emankov@em-hsa-amd on 2015/02/09 06:57:34 EPR #414091 - Compiler Lib/HSAIL: Fix for -fno-bin-cg on multiple kernels [Problem] If CL or BRIG contains multiple kernels, compilation with option -fno-bin-cg leads to finalizer error. [Solution] Check that all kernels are finalized before deleting BRIG from BIF. Actual deletion occurs after finalizing the last kernel. [Misc] + fix erroneous successful exit from finalizing BRIG -> ISA function when BRIG is not extracted successfully + string constants for symbol prefixes replaced on using findBIF30SymStruct + obsolete __AMP_ is removed from code + cosmetic changes in hsail_be + test for the fix is added: ursa.pl -t complib -M-fno-bin-cg-g_multiple_kernels [Tests] pre check-in, make smoke, ursa complib, bingen test (from Benjamin Coquelle) [Reviewers] Brian Sumner, Artem Tamazov, Matthew Arsenault Affected files ... ... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/v0_8/if_acl.cpp#60 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/hsail_be.cpp#37 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/hsail_be.hpp#13 edit ... //depot/stg/opencl/drivers/opencl/tests/hsa/src/complib/options/-fbin-cg-g/HelloWorld_Kernel_cl.cl#2 edit ... //depot/stg/opencl/drivers/opencl/tests/hsa/src/complib/options/-fbin-cg/HelloWorld_Kernel_cl.cl#2 edit ... //depot/stg/opencl/drivers/opencl/tests/hsa/src/complib/options/-fno-bin-cg-g/HelloWorld_Kernel_cl.cl#2 edit ... //depot/stg/opencl/drivers/opencl/tests/hsa/src/complib/options/-fno-bin-cg-g_multiple_kernels/MM_Kernels.cl#1 add ... //depot/stg/opencl/drivers/opencl/tests/hsa/src/complib/options/-fno-bin-cg/HelloWorld_Kernel_cl.cl#2 edit ... //depot/stg/opencl/drivers/opencl/tests/hsa/tlst/complib.tlst#6 edit --- rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp b/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp index 792582fd06..2dafa13384 100644 --- a/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp +++ b/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp @@ -1224,22 +1224,15 @@ aclCompileInternal( } } - // Convert the input string into the device ISA binary. if (useISA) { ald = cl->beAPI.init(cl, bin, compile_callback, &error_code); + // AMDIL: Convert the input string into the device ISA binary. + // HSAIL: Converting BRIG in bin into the device ISA binary; input string isn't used. error_code = cl->beAPI.finalize(ald, dataStr.data(), dataStr.length()); #ifdef WITH_TARGET_HSAIL if (isHSAILTarget(bin->target) && error_code == ACL_SUCCESS) { amdcl::HSAIL *acl = reinterpret_cast(cl->cgAPI.init(cl, bin, compile_callback, &error_code)); - if ((!checkFlag(aclutGetCaps(bin), capSaveCG) || !acl->Options()->oVariables->BinCG) && !acl->IsGlobalVarInBRIG()) { - oclBIFSymbolID brigSectionSymbolId[] = {symBRIGStrtab, symHSABinary, symBRIGOperands, symDebugInfo}; - int symCount = sizeof(brigSectionSymbolId) / sizeof(brigSectionSymbolId[PRE]); - for(int i=0; iclAPI.remSym(cl, bin, sym->sections[PRE], sym->str[PRE]); - } - } + acl->deleteBRIG(); } #endif cl->beAPI.fini(ald);