P4 to Git Change 1221147 by ashi1@ashi1_win50 on 2015/12/15 15:58:09
SWDEV-83467 - [SPIRV] Add support of SPIRV to CPU Modifying runtime and compile time to allow SPIRV binaries to run on CPU since it only runs on HSAIL GPU Added changes to allow conversion of CPU's llvmBinaryIsSpir boolean into compiler library's oclElfSections enum Cpuprogram.cpp's llvmBinaryIsSpir flag renamed to elfSectionType will now support LLVMIR, SPIR, and SPIRV Added SPIRV to compiler lib's elf as new oclElfSections enum cpuprogram.cpp changes also made to gpuprogram.cpp's NullProgram to allow compilation Affected files ... ... //depot/stg/opencl/drivers/opencl/compiler/lib/loaders/elf/elf.cpp#33 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/loaders/elf/elf.hpp#22 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpuprogram.cpp#69 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/device.cpp#191 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#266 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpucompiler.cpp#152 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuprogram.cpp#217 edit
Tento commit je obsažen v:
@@ -213,7 +213,7 @@ NullProgram::compileImpl(const std::string& src,
|
||||
}
|
||||
|
||||
llvmBinary_.assign(reinterpret_cast<const char*>(ir), len);
|
||||
llvmBinaryIsSpir_ = false;
|
||||
elfSectionType_ = amd::OclElf::LLVMIR;
|
||||
aclBinaryFini(bin);
|
||||
|
||||
for (size_t i = 0; i < headerFileNames.size(); ++i) {
|
||||
@@ -260,11 +260,23 @@ NullProgram::compileBinaryToIL(amd::option::Options* options)
|
||||
LogWarning("aclBinaryInit failed");
|
||||
return CL_BUILD_PROGRAM_FAILURE;
|
||||
}
|
||||
bool spirFlag = std::string::npos != options->clcOptions.find("--spir")
|
||||
|| llvmBinaryIsSpir_;
|
||||
aclSections_0_8 spirFlag;
|
||||
_acl_type_enum_0_8 aclTypeBinaryUsed;
|
||||
if (std::string::npos != options->clcOptions.find("--spirv")
|
||||
|| elfSectionType_ == amd::OclElf::SPIRV) {
|
||||
spirFlag = aclSPIRV;
|
||||
aclTypeBinaryUsed = ACL_TYPE_SPIRV_BINARY;
|
||||
} else if (std::string::npos != options->clcOptions.find("--spir")
|
||||
|| elfSectionType_ == amd::OclElf::SPIR) {
|
||||
spirFlag = aclSPIR;
|
||||
aclTypeBinaryUsed = ACL_TYPE_SPIR_BINARY;
|
||||
} else {
|
||||
spirFlag = aclLLVMIR;
|
||||
aclTypeBinaryUsed = ACL_TYPE_LLVMIR_BINARY;
|
||||
}
|
||||
|
||||
if (ACL_SUCCESS != aclInsertSection(dev().compiler(), bin,
|
||||
llvmBinary_.data(), llvmBinary_.size(),
|
||||
spirFlag ? aclSPIR : aclLLVMIR)) {
|
||||
llvmBinary_.data(), llvmBinary_.size(), spirFlag)) {
|
||||
LogWarning("aclInsertSection failed");
|
||||
aclBinaryFini(bin);
|
||||
return CL_BUILD_PROGRAM_FAILURE;
|
||||
@@ -289,10 +301,9 @@ NullProgram::compileBinaryToIL(amd::option::Options* options)
|
||||
if (options->oVariables->BinBIF30) {
|
||||
type = ACL_TYPE_ISA;
|
||||
}
|
||||
err = aclCompile(dev().compiler(), bin, optionStr.c_str(),
|
||||
spirFlag ? ACL_TYPE_SPIR_BINARY : ACL_TYPE_LLVMIR_BINARY,
|
||||
type, NULL);
|
||||
|
||||
err = aclCompile(dev().compiler(), bin, optionStr.c_str(),
|
||||
aclTypeBinaryUsed, type, NULL);
|
||||
buildLog_ += aclGetCompilerLog(dev().compiler());
|
||||
|
||||
if (err != ACL_SUCCESS) {
|
||||
|
||||
Odkázat v novém úkolu
Zablokovat Uživatele