From 098284de7e51fbcbd61d1ffd61a9d21199bc0b92 Mon Sep 17 00:00:00 2001 From: foreman Date: Sat, 11 Apr 2015 08:10:38 -0400 Subject: [PATCH] P4 to Git Change 1139843 by yaxunl@yaxunl_stg_win50 on 2015/04/10 21:13:05 ECR #304775 - Fix bug for loading SPIR 2.0 binary. Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/device.cpp#176 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuprogram.cpp#191 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuprogram.hpp#58 edit --- rocclr/runtime/device/device.cpp | 3 ++- rocclr/runtime/device/gpu/gpuprogram.cpp | 15 +++++++++++++++ rocclr/runtime/device/gpu/gpuprogram.hpp | 4 +--- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/rocclr/runtime/device/device.cpp b/rocclr/runtime/device/device.cpp index ade4bb3358..9fc3b37191 100644 --- a/rocclr/runtime/device/device.cpp +++ b/rocclr/runtime/device/device.cpp @@ -1052,7 +1052,8 @@ Program::initClBinary(char* binaryIn, size_t size) aclBinaryOptions binOpts = {0}; binOpts.struct_size = sizeof(binOpts); binOpts.elfclass - = (info().arch_id == aclX64 || info().arch_id == aclAMDIL64) + = (info().arch_id == aclX64 || info().arch_id == aclAMDIL64 || + info().arch_id == aclHSAIL64) ? ELFCLASS64 : ELFCLASS32; binOpts.bitness = ELFDATA2LSB; binOpts.alloc = &::malloc; diff --git a/rocclr/runtime/device/gpu/gpuprogram.cpp b/rocclr/runtime/device/gpu/gpuprogram.cpp index c477183204..b788cb76a4 100644 --- a/rocclr/runtime/device/gpu/gpuprogram.cpp +++ b/rocclr/runtime/device/gpu/gpuprogram.cpp @@ -2298,5 +2298,20 @@ HSAILProgram::fillResListWithKernels( } } +const aclTargetInfo & +HSAILProgram::info(const char * str) { + acl_error err; + std::string arch = GPU_TARGET_INFO_ARCH; + if (dev().settings().use64BitPtr_) { + arch += "64"; + } + info_ = aclGetTargetInfo(arch.c_str(), ( str && str[0] == '\0' ? + dev().hwInfo()->targetName_ : str ), &err); + if (err != ACL_SUCCESS) { + LogWarning("aclGetTargetInfo failed"); + } + return info_; +} + } // namespace gpu diff --git a/rocclr/runtime/device/gpu/gpuprogram.hpp b/rocclr/runtime/device/gpu/gpuprogram.hpp index 2cc57f7ea3..8945c5383f 100644 --- a/rocclr/runtime/device/gpu/gpuprogram.hpp +++ b/rocclr/runtime/device/gpu/gpuprogram.hpp @@ -460,9 +460,7 @@ protected: //! Release the Binary virtual void releaseClBinary(); - virtual const aclTargetInfo & info(const char * str = "") { - return info_; - } + virtual const aclTargetInfo & info(const char * str = ""); virtual bool isElf(const char* bin) const { return amd::isElfMagic(bin);