From eca7138cd10a84607ccae40a1f64ddc3d95575e1 Mon Sep 17 00:00:00 2001 From: foreman Date: Wed, 11 Mar 2015 16:12:47 -0400 Subject: [PATCH] P4 to Git Change 1129742 by yaxunl@yaxunl_stg_win50 on 2015/03/11 15:37:02 EPR #415603 - [CQE OCL][QR][CPU] 29 of 34 SPIR tests failed in all CPUs due to CL#1127589. Two changes: 1. OCL builtin needs to be demangled. 2. setupLoaderObject() needs to be moved into dll and called through comp lib interface since it needs to reset function pointers of several comp lib interface. Otherwise it will use function pointers of the static comp lib and causes strange errors. Affected files ... ... //depot/stg/opencl/drivers/opencl/compiler/lib/api/v0_8/acl.cpp#26 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/api/v0_8/aclLoaders.cpp#11 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/v0_8/if_acl.cpp#62 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/v0_8/if_acl.h#2 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/include/v0_8/aclFunctors.h#4 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/include/v0_8/aclStructs.h#15 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/include/v0_8/aclTypes.h#5 edit ... //depot/stg/opencl/drivers/opencl/compiler/llvm32/lib/Linker/AMDFixupKernelModule.cpp#3 edit ... //depot/stg/opencl/drivers/opencl/tests/ocltst/module/complib/CLAssumptionCheck.cpp#40 edit --- .../lib/backends/common/v0_8/if_acl.cpp | 38 +++++++++++++++++++ .../lib/backends/common/v0_8/if_acl.h | 3 ++ .../compiler/lib/include/v0_8/aclFunctors.h | 3 ++ rocclr/compiler/lib/include/v0_8/aclStructs.h | 1 + rocclr/compiler/lib/include/v0_8/aclTypes.h | 1 + 5 files changed, 46 insertions(+) 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 537eac66f4..e7329678a6 100644 --- a/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp +++ b/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp @@ -2899,6 +2899,43 @@ void myLogFunc(const char * msg, size_t size) printf("%s\n", msg); } +#define CONDITIONAL_ASSIGN(A, B) A = (A) ? (A) : (B) +acl_error ACL_API_ENTRY +if_aclSetupLoaderObject(aclCompiler *cl) { + /* setup the loader objects here now that we have parsed the + * options and know the target. */ + CONDITIONAL_ASSIGN(cl->cgAPI.init, &CodegenInit); + CONDITIONAL_ASSIGN(cl->cgAPI.fini, &CodegenFini); + CONDITIONAL_ASSIGN(cl->cgAPI.codegen, &CodegenPhase); + CONDITIONAL_ASSIGN(cl->linkAPI.init, &LinkInit); + CONDITIONAL_ASSIGN(cl->linkAPI.fini, &LinkFini); + CONDITIONAL_ASSIGN(cl->linkAPI.link, &OCLLinkPhase); + CONDITIONAL_ASSIGN(cl->linkAPI.toLLVMIR, &OCLLinkToLLVMIR); + CONDITIONAL_ASSIGN(cl->linkAPI.toSPIR, &OCLLinkToSPIR); + + CONDITIONAL_ASSIGN(cl->feAPI.init, &OCLInit); + CONDITIONAL_ASSIGN(cl->feAPI.fini, &OCLFini); +#if !defined(LEGACY_COMPLIB) + CONDITIONAL_ASSIGN(cl->feAPI.toIR, &OCLFEToSPIR); +#else + CONDITIONAL_ASSIGN(cl->feAPI.toIR, &OCLFEToLLVMIR); +#endif + + CONDITIONAL_ASSIGN(cl->feAPI.toModule, &OCLFEToModule); + CONDITIONAL_ASSIGN(cl->feAPI.toISA, &OCLFEToISA); + CONDITIONAL_ASSIGN(cl->optAPI.init, &OptInit); + CONDITIONAL_ASSIGN(cl->optAPI.fini, &OptFini); + CONDITIONAL_ASSIGN(cl->optAPI.optimize, &OptOptimize); + CONDITIONAL_ASSIGN(cl->beAPI.init, &BEInit); + CONDITIONAL_ASSIGN(cl->beAPI.fini, &BEFini); + CONDITIONAL_ASSIGN(cl->beAPI.finalize, &BEAsmPhase); + CONDITIONAL_ASSIGN(cl->beAPI.assemble, &BEAssemble); + CONDITIONAL_ASSIGN(cl->beAPI.disassemble, &BEDisassemble); + return ACL_SUCCESS; +} + +#undef CONDITIONAL_ASSIGN + extern "C" { bool aclRenderscriptCompile( char * srcFile, @@ -2972,4 +3009,5 @@ bool aclRenderscriptCompile( *outBuf = buffer; return true; } + } diff --git a/rocclr/compiler/lib/backends/common/v0_8/if_acl.h b/rocclr/compiler/lib/backends/common/v0_8/if_acl.h index 135e3c1e73..7250f550d8 100644 --- a/rocclr/compiler/lib/backends/common/v0_8/if_acl.h +++ b/rocclr/compiler/lib/backends/common/v0_8/if_acl.h @@ -126,4 +126,7 @@ if_aclDbgRemoveArgument(aclCompiler *cl, const char* kernel, const char* name) ACL_API_0_8; +acl_error ACL_API_ENTRY +if_aclSetupLoaderObject(aclCompiler *cl) ACL_API_0_8; + #endif // _IF_ACL_0_8_H_ diff --git a/rocclr/compiler/lib/include/v0_8/aclFunctors.h b/rocclr/compiler/lib/include/v0_8/aclFunctors.h index 43a19a91a5..2aeba9dc63 100644 --- a/rocclr/compiler/lib/include/v0_8/aclFunctors.h +++ b/rocclr/compiler/lib/include/v0_8/aclFunctors.h @@ -173,6 +173,9 @@ typedef acl_error const void *isa_code, size_t isa_size) ACL_API_0_8; +typedef acl_error +(ACL_API_ENTRY *SetupLoaderObject_0_8)(aclCompiler *cl) ACL_API_0_8; + typedef void* (*AllocFunc_0_8)(size_t size) ACL_API_0_8; diff --git a/rocclr/compiler/lib/include/v0_8/aclStructs.h b/rocclr/compiler/lib/include/v0_8/aclStructs.h index eea1797f30..db2da24753 100644 --- a/rocclr/compiler/lib/include/v0_8/aclStructs.h +++ b/rocclr/compiler/lib/include/v0_8/aclStructs.h @@ -209,6 +209,7 @@ typedef struct _acl_cl_loader_rec_0_8 { QueryInfo getInfo; AddDbgArg addDbg; RemoveDbgArg removeDbg; + SetupLoaderObject setupLoaderObject; } aclCLLoader_0_8; //! Structure that holds the required functions diff --git a/rocclr/compiler/lib/include/v0_8/aclTypes.h b/rocclr/compiler/lib/include/v0_8/aclTypes.h index cba640591b..0a0061e9ff 100644 --- a/rocclr/compiler/lib/include/v0_8/aclTypes.h +++ b/rocclr/compiler/lib/include/v0_8/aclTypes.h @@ -66,6 +66,7 @@ typedef Compile_0_8 Compile; typedef Link_0_8 Link; typedef AddDbgArg_0_8 AddDbgArg; typedef RemoveDbgArg_0_8 RemoveDbgArg; +typedef SetupLoaderObject_0_8 SetupLoaderObject; typedef CompLog_0_8 CompLog; typedef RetrieveType_0_8 RetrieveType; typedef SetType_0_8 SetType;