From d47f79a1171545bd0b397f7577f83a597cbde609 Mon Sep 17 00:00:00 2001 From: foreman Date: Wed, 30 Sep 2015 10:03:05 -0400 Subject: [PATCH] P4 to Git Change 1195790 by johtaylo@johtaylo-JTBUILDER03-increment on 2015/09/30 03:00:11 SWDEV-2 - Change OpenCL version number from 1898 to 1899. Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/utils/versions.hpp#1645 edit [ROCm/clr commit: af1f393ed0cafc89d150ebcac283ac548f539ca2] --- .../lib/backends/common/v0_8/if_acl.cpp | 29 +++++++++++++++---- .../clr/rocclr/compiler/lib/utils/options.cpp | 4 ++- .../clr/rocclr/runtime/utils/versions.hpp | 2 +- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/projects/clr/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp b/projects/clr/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp index ed37aaef32..95139446ef 100644 --- a/projects/clr/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp +++ b/projects/clr/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp @@ -391,14 +391,20 @@ SPIRVToModule( acl_error *error) { auto compiler = reinterpret_cast(ald); + auto cl = compiler->CL(); + auto bin = compiler->Elf(); #ifdef LEGACY_COMPLIB llvm::report_fatal_error("SPIR-V not supported on legacy compiler lib"); - appendLogToCL(compiler->CL(), "SPIR-V not supported on legacy compiler lib"); + appendLogToCL(cl, "SPIR-V not supported on legacy compiler lib"); if (error != nullptr) (*error) = ACL_SPIRV_LOAD_FAIL; return nullptr; #else std::string spvImg(image, length); - auto opt = compiler->Options(); + /// ToDo: When there are multiple binaries, compiler->Options() + /// cannot carry options specified by environment variables to here + /// but bin->options can. This seems to be related to how runtime + /// sets up aclCompiler options and BIF options. + auto opt = reinterpret_cast(bin->options); if (opt->isDumpFlagSet(amd::option::DUMP_SPIRV)) { std::ofstream ofs(opt->getDumpFileName(".spv"), std::ios::binary); ofs << spvImg; @@ -426,14 +432,20 @@ SPIRVToModule( } if (!errMsg.empty()) { - appendLogToCL(compiler->CL(), errMsg); + appendLogToCL(cl, errMsg); } if (!success || llMod == nullptr) { if (error != nullptr) (*error) = ACL_SPIRV_LOAD_FAIL; return nullptr; } - if (error != nullptr) (*error) = ACL_SUCCESS; + llvm::SmallVector array; + llvm::raw_svector_ostream outstream(array); + llvm::WriteBitcodeToFile(reinterpret_cast(llMod), outstream); + outstream.flush(); + auto errCode = cl->clAPI.insSec(cl, bin, &array[0], array.size(), aclLLVMIR); + if (error != nullptr) (*error) = errCode; + return reinterpret_cast(llMod); #endif // LEGACY_COMPLIB } @@ -1623,7 +1635,14 @@ if_aclCompile(aclCompiler *cl, CONDITIONAL_CMP_ASSIGN(cl->feAPI.fini, &AMDILFini, &OCLFini); CONDITIONAL_CMP_ASSIGN(cl->feAPI.fini, &HSAILFEFini, &OCLFini); if (from == ACL_TYPE_SPIRV_BINARY) { - cl->feAPI.toModule = &SPIRVToModule; + if (to != ACL_TYPE_LLVMIR_BINARY) + cl->feAPI.toModule = &SPIRVToModule; + else { + cl->feAPI.toISA = NULL; + cl->feAPI.toIR = &SPIRVToModule; + start = 0; + stop = 1; + } } else if (from == ACL_TYPE_RSLLVMIR_BINARY) { cl->feAPI.toModule = &RSLLVMIRToModule; } else { diff --git a/projects/clr/rocclr/compiler/lib/utils/options.cpp b/projects/clr/rocclr/compiler/lib/utils/options.cpp index f23ca1be32..131cc56eda 100644 --- a/projects/clr/rocclr/compiler/lib/utils/options.cpp +++ b/projects/clr/rocclr/compiler/lib/utils/options.cpp @@ -1255,6 +1255,7 @@ Options::Options() : oVariables(NULL), clcOptions(), llvmOptions(), + kernelArgAlign(0), basename_max(0), OptionsLog(), flagsSize (((OID_LAST + 31)/32) * 32), @@ -1264,7 +1265,8 @@ Options::Options() : dumpFileRoot(), currKernelName(NULL), encryptCode(0), - MemoryHandles() + MemoryHandles(), + libraryType_(amd::LibraryUndefined) { oVariables = new OptionVariables(); ::memset(flags, 0, sizeof(flags)); diff --git a/projects/clr/rocclr/runtime/utils/versions.hpp b/projects/clr/rocclr/runtime/utils/versions.hpp index 18a93ae319..b58f565d90 100644 --- a/projects/clr/rocclr/runtime/utils/versions.hpp +++ b/projects/clr/rocclr/runtime/utils/versions.hpp @@ -12,7 +12,7 @@ #endif // AMD_PLATFORM_NAME #ifndef AMD_PLATFORM_BUILD_NUMBER -# define AMD_PLATFORM_BUILD_NUMBER 1898 +# define AMD_PLATFORM_BUILD_NUMBER 1899 #endif // AMD_PLATFORM_BUILD_NUMBER #ifndef AMD_PLATFORM_REVISION_NUMBER