Fix for spirv regression - preserve IR type

Preserve IR type during Program::compile when program
is created from IR

Change-Id: I9ee12b27e52fa72a1abbfa070895caf0ac3e32fb
This commit is contained in:
Chodor, Jaroslaw
2018-07-20 15:34:01 +02:00
committed by sys_ocldev
parent 2561ff6cb4
commit 44589b79b4
2 changed files with 21 additions and 1 deletions

View File

@@ -222,7 +222,7 @@ cl_int CompilerInterface::compile(
char *pOutput;
uint32_t OutputSize;
program.getSource(pOutput, OutputSize);
program.storeIrBinary(pOutput, OutputSize, outType == IGC::CodeType::spirV);
program.storeIrBinary(pOutput, OutputSize, program.getIsSpirV());
}
}

View File

@@ -288,6 +288,26 @@ TEST_F(CompilerInterfaceTest, CompileClToIr) {
gEnvironment->fclPopDebugVars();
}
TEST_F(CompilerInterfaceTest, GivenProgramCreatedFromIrWhenCompileIsCalledThenIrFormatIsPreserved) {
struct MockProgram : Program {
using Program::isSpirV;
using Program::pDevice;
using Program::programBinaryType;
};
MockProgram prog;
prog.programBinaryType = CL_PROGRAM_BINARY_TYPE_INTERMEDIATE;
prog.pDevice = pContext->getDevice(0);
prog.isSpirV = true;
retVal = pCompilerInterface->compile(prog, inputArgs);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_TRUE(prog.isSpirV);
prog.isSpirV = false;
retVal = pCompilerInterface->compile(prog, inputArgs);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_FALSE(prog.isSpirV);
}
TEST_F(CompilerInterfaceTest, WhenCompileIsInvokedThenFclReceivesListOfExtensionsInInternalOptions) {
std::string receivedInternalOptions;