Skip to content

Commit

Permalink
Fix for spirv regression - preserve IR type
Browse files Browse the repository at this point in the history
Preserve IR type during Program::compile when program
is created from IR

Change-Id: I9ee12b27e52fa72a1abbfa070895caf0ac3e32fb
  • Loading branch information
jchodor authored and Compute-Runtime-Automation committed Jul 20, 2018
1 parent 2561ff6 commit 44589b7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion runtime/compiler_interface/compiler_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}

Expand Down
20 changes: 20 additions & 0 deletions unit_tests/compiler_interface/compiler_interface_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 44589b7

Please sign in to comment.