mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-10 12:53:42 +08:00
Fixing rebuildFromIr regression
Change-Id: I80107f715e98b2ba1046cb60895699e8c2d8309c
This commit is contained in:
@ -76,7 +76,7 @@ cl_int Program::build(
|
||||
}
|
||||
|
||||
TranslationInput inputArgs = {IGC::CodeType::oclC, IGC::CodeType::oclGenBin};
|
||||
if ((createdFrom == CreatedFrom::IL) || (this->programBinaryType == CL_PROGRAM_BINARY_TYPE_INTERMEDIATE)) {
|
||||
if (createdFrom != CreatedFrom::SOURCE) {
|
||||
inputArgs.srcType = isSpirV ? IGC::CodeType::spirV : IGC::CodeType::llvmBc;
|
||||
inputArgs.src = ArrayRef<const char>(irBinary.get(), irBinarySize);
|
||||
} else {
|
||||
|
@ -97,6 +97,7 @@ T *Program::create(
|
||||
if (retVal == CL_SUCCESS) {
|
||||
program = new T(*device.getExecutionEnvironment());
|
||||
program->sourceCode = nullTerminatedString;
|
||||
program->createdFrom = CreatedFrom::SOURCE;
|
||||
program->context = context;
|
||||
program->isBuiltIn = isBuiltIn;
|
||||
if (program->context && !program->isBuiltIn) {
|
||||
|
@ -140,6 +140,7 @@ cl_int Program::createProgramFromBinary(
|
||||
this->unpackedDeviceBinarySize = 0U;
|
||||
this->packedDeviceBinary.reset();
|
||||
this->packedDeviceBinarySize = 0U;
|
||||
this->createdFrom = CreatedFrom::BINARY;
|
||||
|
||||
ArrayRef<const uint8_t> archive(reinterpret_cast<const uint8_t *>(pBinary), binarySize);
|
||||
bool isSpirV = NEO::isSpirVBitcode(archive);
|
||||
|
@ -38,6 +38,7 @@ class MockProgram : public Program {
|
||||
using Program::blockKernelManager;
|
||||
using Program::constantSurface;
|
||||
using Program::context;
|
||||
using Program::createdFrom;
|
||||
using Program::debugData;
|
||||
using Program::debugDataSize;
|
||||
using Program::exportedFunctionsSurface;
|
||||
@ -142,7 +143,6 @@ class MockProgram : public Program {
|
||||
cl_int rebuildProgramFromIr() {
|
||||
this->isCreatedFromBinary = false;
|
||||
this->buildStatus = CL_BUILD_NONE;
|
||||
this->programBinaryType = CL_PROGRAM_BINARY_TYPE_INTERMEDIATE;
|
||||
std::unordered_map<std::string, BuiltinDispatchInfoBuilder *> builtins;
|
||||
auto &device = this->pDevice->getDevice();
|
||||
return this->build(&device, this->options.c_str(), false, builtins);
|
||||
|
@ -740,6 +740,7 @@ TEST_P(ProgramFromSourceTest, CreateWithSource_Build) {
|
||||
EXPECT_NE(0u, sourceSize);
|
||||
EXPECT_NE(nullptr, pSourceBuffer);
|
||||
p3->sourceCode = pSourceBuffer.get();
|
||||
p3->createdFrom = Program::CreatedFrom::SOURCE;
|
||||
retVal = p3->build(0, nullptr, nullptr, nullptr, nullptr, false);
|
||||
EXPECT_EQ(CL_INVALID_BINARY, retVal);
|
||||
p3.reset(nullptr);
|
||||
@ -790,6 +791,7 @@ TEST_P(ProgramFromSourceTest, CreateWithSource_Build) {
|
||||
|
||||
// fail build - code to be build does not exist
|
||||
pMockProgram->sourceCode = ""; // set source code as non-existent (invalid)
|
||||
pMockProgram->createdFrom = Program::CreatedFrom::SOURCE;
|
||||
pMockProgram->SetBuildStatus(CL_BUILD_NONE);
|
||||
pMockProgram->SetCreatedFromBinary(false);
|
||||
retVal = pProgram->build(0, nullptr, nullptr, nullptr, nullptr, false);
|
||||
@ -1929,6 +1931,7 @@ TEST_F(ProgramTests, BuildProgramWithReraFlag) {
|
||||
ClDevice *pDevice = castToObject<ClDevice>(deviceId);
|
||||
program->setDevice(pDevice);
|
||||
program->sourceCode = "__kernel mock() {}";
|
||||
program->createdFrom = Program::CreatedFrom::SOURCE;
|
||||
|
||||
// Ask to build created program without NEO::CompilerOptions::gtpinRera flag.
|
||||
cl_int retVal = program->build(0, nullptr, CompilerOptions::fastRelaxedMath, nullptr, nullptr, false);
|
||||
|
Reference in New Issue
Block a user