From 2ed168dc151a4638fbbd00694adfe226daa818a5 Mon Sep 17 00:00:00 2001 From: Krystian Chmielewski Date: Mon, 23 Jan 2023 12:11:56 +0000 Subject: [PATCH] refactor(zebin): prioritize AOT config when validating When validating zebin for target device. If AOT config (device identification number) is present then use it for device validation, and skip old checks (Core Family, Product Family). Signed-off-by: Krystian Chmielewski --- shared/source/device_binary_format/zebin_decoder.cpp | 12 ++++++------ .../device_binary_format/zebin_decoder_tests.cpp | 5 ++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/shared/source/device_binary_format/zebin_decoder.cpp b/shared/source/device_binary_format/zebin_decoder.cpp index b23341b9ec..1509795724 100644 --- a/shared/source/device_binary_format/zebin_decoder.cpp +++ b/shared/source/device_binary_format/zebin_decoder.cpp @@ -48,14 +48,14 @@ bool validateTargetDevice(const TargetDevice &targetDevice, Elf::ELF_IDENTIFIER_ return false; } - if (gfxCore == IGFX_UNKNOWN_CORE && productFamily == IGFX_UNKNOWN && productConfig == AOT::UNKNOWN_ISA) { + if (productConfig != AOT::UNKNOWN_ISA) { + return targetDevice.aotConfig.value == productConfig; + } + + if (gfxCore == IGFX_UNKNOWN_CORE && productFamily == IGFX_UNKNOWN) { return false; } - if (productConfig != AOT::UNKNOWN_ISA) { - if (targetDevice.aotConfig.value != productConfig) { - return false; - } - } + if (gfxCore != IGFX_UNKNOWN_CORE) { if (targetDevice.coreFamily != gfxCore) { return false; diff --git a/shared/test/unit_test/device_binary_format/zebin_decoder_tests.cpp b/shared/test/unit_test/device_binary_format/zebin_decoder_tests.cpp index fb2faaf86d..738f2ac622 100644 --- a/shared/test/unit_test/device_binary_format/zebin_decoder_tests.cpp +++ b/shared/test/unit_test/device_binary_format/zebin_decoder_tests.cpp @@ -5570,15 +5570,14 @@ TEST(ValidateTargetDeviceTests, givenMismatchedGfxCoreWhenValidatingTargetDevice TEST(ValidateTargetDeviceTests, givenSteppingBiggerThanMaxHwRevisionWhenValidatingTargetDeviceThenReturnFalse) { TargetDevice targetDevice; targetDevice.maxPointerSizeInBytes = 8u; - auto aotConfigValue = 0x00001234u; - targetDevice.aotConfig.value = aotConfigValue; + targetDevice.coreFamily = renderCoreFamily; targetDevice.stepping = 2u; Elf::ZebinTargetFlags targetMetadata; targetMetadata.validateRevisionId = true; targetMetadata.maxHwRevisionId = 1u; - auto res = validateTargetDevice(targetDevice, Elf::EI_CLASS_64, IGFX_UNKNOWN, IGFX_UNKNOWN_CORE, static_cast(aotConfigValue), targetMetadata); + auto res = validateTargetDevice(targetDevice, Elf::EI_CLASS_64, IGFX_UNKNOWN, renderCoreFamily, AOT::UNKNOWN_ISA, targetMetadata); EXPECT_FALSE(res); }