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
Этот коммит содержится в:
@@ -604,7 +604,7 @@ Program::Program(amd::Device& device)
|
||||
, type_(TYPE_NONE)
|
||||
, clBinary_(NULL)
|
||||
, llvmBinary_()
|
||||
, llvmBinaryIsSpir_(false)
|
||||
, elfSectionType_(amd::OclElf::LLVMIR)
|
||||
, compileOptions_()
|
||||
, linkOptions_()
|
||||
, lastBuildOptionsArg_()
|
||||
@@ -1143,7 +1143,7 @@ Program::setBinary(char* binaryIn, size_t size)
|
||||
}
|
||||
case ET_REL:
|
||||
{
|
||||
if (clBinary()->isSPIR()) {
|
||||
if (clBinary()->isSPIR() || clBinary()->isSPIRV()) {
|
||||
setType(TYPE_INTERMEDIATE);
|
||||
} else {
|
||||
setType(TYPE_COMPILED);
|
||||
@@ -1552,19 +1552,20 @@ void ClBinary::resetElfOut()
|
||||
}
|
||||
|
||||
bool
|
||||
ClBinary::loadLlvmBinary(std::string& llvmBinary, bool& llvmBinaryIsSpir) const
|
||||
ClBinary::loadLlvmBinary(std::string& llvmBinary, amd::OclElf::oclElfSections& elfSectionType) const
|
||||
{
|
||||
// Check if current binary already has LLVMIR
|
||||
char *section = NULL;
|
||||
size_t sz = 0;
|
||||
if (elfIn_->getSection(amd::OclElf::LLVMIR, §ion, &sz) && section && sz > 0) {
|
||||
llvmBinary.append(section, sz);
|
||||
llvmBinaryIsSpir = false;
|
||||
return true;
|
||||
} else if (elfIn_->getSection(amd::OclElf::SPIR, §ion, &sz) && section && sz > 0) {
|
||||
llvmBinary.append(section, sz);
|
||||
llvmBinaryIsSpir = true;
|
||||
return true;
|
||||
const amd::OclElf::oclElfSections SectionTypes[] =
|
||||
{amd::OclElf::LLVMIR, amd::OclElf::SPIR, amd::OclElf::SPIRV};
|
||||
|
||||
for (int i = 0; i < 3; ++i){
|
||||
if (elfIn_->getSection(SectionTypes[i], §ion, &sz) && section && sz > 0) {
|
||||
llvmBinary.append(section, sz);
|
||||
elfSectionType = SectionTypes[i];
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -1628,6 +1629,18 @@ ClBinary::isSPIR() const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
ClBinary::isSPIRV() const
|
||||
{
|
||||
char *section = NULL;
|
||||
size_t sz = 0;
|
||||
|
||||
if (elfIn_->getSection(amd::OclElf::SPIRV, §ion, &sz) && section && sz > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
cl_device_partition_property
|
||||
PartitionType::toCL() const
|
||||
{
|
||||
|
||||
Ссылка в новой задаче
Block a user