Allow for zebin rebuild when IR is present

Signed-off-by: Krystian Chmielewski <krystian.chmielewski@intel.com>
This commit is contained in:
Krystian Chmielewski
2022-03-31 16:30:16 +00:00
committed by Compute-Runtime-Automation
parent f804eb7b2b
commit 2ae3f3e521
3 changed files with 49 additions and 10 deletions

View File

@@ -358,3 +358,26 @@ TEST(UnpackSingleDeviceBinaryZebin, WhenMachineIsIntelGTAndIntelGTNoteSectionIsV
EXPECT_TRUE(unpackWarnings.empty());
EXPECT_TRUE(unpackErrors.empty());
}
TEST(UnpackSingleDeviceBinaryZebin, WhenZebinIsNotValidForTargetAndHasSPIRVThenSetIRAndBuildOptions) {
ZebinTestData::ValidEmptyProgram zebin;
const uint8_t spirvData[30] = {0xd};
zebin.appendSection(NEO::Elf::SHT_ZEBIN_SPIRV, NEO::Elf::SectionsNamesZebin::spv, spirvData);
zebin.elfHeader->type = NEO::Elf::ET_ZEBIN_EXE;
zebin.elfHeader->machine = IGFX_UNKNOWN;
NEO::TargetDevice targetDevice;
targetDevice.productFamily = IGFX_SKYLAKE;
targetDevice.maxPointerSizeInBytes = 8;
std::string unpackErrors;
std::string unpackWarnings;
auto unpackResult = NEO::unpackSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(zebin.storage, "", targetDevice, unpackErrors, unpackWarnings);
EXPECT_EQ(NEO::DeviceBinaryFormat::Zebin, unpackResult.format);
EXPECT_TRUE(unpackResult.deviceBinary.empty());
EXPECT_FALSE(unpackResult.intermediateRepresentation.empty());
EXPECT_EQ(0, memcmp(spirvData, unpackResult.intermediateRepresentation.begin(), sizeof(spirvData)));
EXPECT_STREQ(NEO::CompilerOptions::allowZebin.begin(), unpackResult.buildOptions.begin());
}