diff --git a/runtime/gen10/linux/hw_info_config_cnl.inl b/runtime/gen10/linux/hw_info_config_cnl.inl index bcc7ab1434..13e99a45b7 100644 --- a/runtime/gen10/linux/hw_info_config_cnl.inl +++ b/runtime/gen10/linux/hw_info_config_cnl.inl @@ -12,6 +12,10 @@ namespace NEO { template <> int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) { + if (nullptr == osIface) { + return 0; + } + FeatureTable *pSkuTable = const_cast(hwInfo->pSkuTable); GT_SYSTEM_INFO *pSysInfo = const_cast(hwInfo->pSysInfo); WorkaroundTable *pWaTable = const_cast(hwInfo->pWaTable); diff --git a/runtime/gen11/linux/hw_info_config_icllp.inl b/runtime/gen11/linux/hw_info_config_icllp.inl index e948fde6c6..599e1c45b9 100644 --- a/runtime/gen11/linux/hw_info_config_icllp.inl +++ b/runtime/gen11/linux/hw_info_config_icllp.inl @@ -12,6 +12,10 @@ namespace NEO { template <> int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) { + if (nullptr == osIface) { + return 0; + } + FeatureTable *pSkuTable = const_cast(hwInfo->pSkuTable); GT_SYSTEM_INFO *pSysInfo = const_cast(hwInfo->pSysInfo); WorkaroundTable *pWaTable = const_cast(hwInfo->pWaTable); diff --git a/runtime/gen11/linux/hw_info_config_lkf.inl b/runtime/gen11/linux/hw_info_config_lkf.inl index 9ee1f8be1a..c1a0508f4e 100644 --- a/runtime/gen11/linux/hw_info_config_lkf.inl +++ b/runtime/gen11/linux/hw_info_config_lkf.inl @@ -12,6 +12,10 @@ namespace NEO { template <> int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) { + if (nullptr == osIface) { + return 0; + } + FeatureTable *pSkuTable = const_cast(hwInfo->pSkuTable); GT_SYSTEM_INFO *pSysInfo = const_cast(hwInfo->pSysInfo); WorkaroundTable *pWaTable = const_cast(hwInfo->pWaTable); diff --git a/runtime/gen8/linux/hw_info_config_bdw.inl b/runtime/gen8/linux/hw_info_config_bdw.inl index ffae79e3f3..25b081d3b1 100644 --- a/runtime/gen8/linux/hw_info_config_bdw.inl +++ b/runtime/gen8/linux/hw_info_config_bdw.inl @@ -12,6 +12,10 @@ namespace NEO { template <> int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) { + if (nullptr == osIface) { + return 0; + } + FeatureTable *pSkuTable = const_cast(hwInfo->pSkuTable); GT_SYSTEM_INFO *pSysInfo = const_cast(hwInfo->pSysInfo); WorkaroundTable *pWaTable = const_cast(hwInfo->pWaTable); diff --git a/runtime/gen9/linux/hw_info_config_bxt.inl b/runtime/gen9/linux/hw_info_config_bxt.inl index 7650649c4a..73f27ed6c8 100644 --- a/runtime/gen9/linux/hw_info_config_bxt.inl +++ b/runtime/gen9/linux/hw_info_config_bxt.inl @@ -14,6 +14,10 @@ namespace NEO { template <> int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) { + if (nullptr == osIface) { + return 0; + } + Drm *drm = osIface->get()->getDrm(); PLATFORM *pPlatform = const_cast(hwInfo->pPlatform); FeatureTable *pSkuTable = const_cast(hwInfo->pSkuTable); diff --git a/runtime/gen9/linux/hw_info_config_cfl.inl b/runtime/gen9/linux/hw_info_config_cfl.inl index 11aee26c5b..e513da1dca 100644 --- a/runtime/gen9/linux/hw_info_config_cfl.inl +++ b/runtime/gen9/linux/hw_info_config_cfl.inl @@ -12,6 +12,10 @@ namespace NEO { template <> int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) { + if (nullptr == osIface) { + return 0; + } + FeatureTable *pSkuTable = const_cast(hwInfo->pSkuTable); GT_SYSTEM_INFO *pSysInfo = const_cast(hwInfo->pSysInfo); WorkaroundTable *pWaTable = const_cast(hwInfo->pWaTable); diff --git a/runtime/gen9/linux/hw_info_config_glk.inl b/runtime/gen9/linux/hw_info_config_glk.inl index 0c5050b882..8d5160a532 100644 --- a/runtime/gen9/linux/hw_info_config_glk.inl +++ b/runtime/gen9/linux/hw_info_config_glk.inl @@ -14,6 +14,10 @@ namespace NEO { template <> int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) { + if (nullptr == osIface) { + return 0; + } + Drm *drm = osIface->get()->getDrm(); FeatureTable *pSkuTable = const_cast(hwInfo->pSkuTable); GT_SYSTEM_INFO *pSysInfo = const_cast(hwInfo->pSysInfo); diff --git a/runtime/gen9/linux/hw_info_config_kbl.inl b/runtime/gen9/linux/hw_info_config_kbl.inl index 6605a07c4f..48a4d2d1b4 100644 --- a/runtime/gen9/linux/hw_info_config_kbl.inl +++ b/runtime/gen9/linux/hw_info_config_kbl.inl @@ -12,6 +12,10 @@ namespace NEO { template <> int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) { + if (nullptr == osIface) { + return 0; + } + PLATFORM *pPlatform = const_cast(hwInfo->pPlatform); FeatureTable *pSkuTable = const_cast(hwInfo->pSkuTable); GT_SYSTEM_INFO *pSysInfo = const_cast(hwInfo->pSysInfo); diff --git a/runtime/gen9/linux/hw_info_config_skl.inl b/runtime/gen9/linux/hw_info_config_skl.inl index ccb21e59f0..ea0a408423 100644 --- a/runtime/gen9/linux/hw_info_config_skl.inl +++ b/runtime/gen9/linux/hw_info_config_skl.inl @@ -13,6 +13,10 @@ namespace NEO { template <> int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) { + if (nullptr == osIface) { + return 0; + } + FeatureTable *pSkuTable = const_cast(hwInfo->pSkuTable); GT_SYSTEM_INFO *pSysInfo = const_cast(hwInfo->pSysInfo); WorkaroundTable *pWaTable = const_cast(hwInfo->pWaTable); diff --git a/runtime/os_interface/device_factory.cpp b/runtime/os_interface/device_factory.cpp index 46949cf82c..93bcc9c28c 100644 --- a/runtime/os_interface/device_factory.cpp +++ b/runtime/os_interface/device_factory.cpp @@ -8,6 +8,7 @@ #include "runtime/device/device.h" #include "runtime/helpers/options.h" #include "runtime/os_interface/debug_settings_manager.h" +#include "runtime/os_interface/hw_info_config.h" namespace NEO { @@ -33,6 +34,9 @@ bool DeviceFactory::getDevicesForProductFamilyOverride(HardwareInfo **pHWInfos, const_cast(hardwareInfo->pSkuTable), true, hwInfoConfig); + HwInfoConfig *hwConfig = HwInfoConfig::get(hardwareInfo->pPlatform->eProductFamily); + hwConfig->configureHardwareCustom(hardwareInfo.get(), nullptr); + *pHWInfos = hardwareInfo.release(); executionEnvironment.setHwInfo(*pHWInfos); numDevices = totalDeviceCount; diff --git a/unit_tests/command_stream/get_devices_tests.cpp b/unit_tests/command_stream/get_devices_tests.cpp index 738f5e18ef..0dc7abc9b0 100644 --- a/unit_tests/command_stream/get_devices_tests.cpp +++ b/unit_tests/command_stream/get_devices_tests.cpp @@ -10,6 +10,7 @@ #include "runtime/helpers/options.h" #include "runtime/memory_manager/os_agnostic_memory_manager.h" #include "runtime/os_interface/device_factory.h" +#include "runtime/os_interface/hw_info_config.h" #include "runtime/platform/platform.h" #include "test.h" #include "unit_tests/helpers/debug_manager_state_restore.h" @@ -37,6 +38,8 @@ struct GetDevicesTest : ::testing::Test { int i = 0; size_t numDevices = 0; HardwareInfo *hwInfo = nullptr; + FeatureTable featureTable = {}; + GT_SYSTEM_INFO sysInfo = {}; DebugManagerStateRestore stateRestorer; }; @@ -75,7 +78,7 @@ HWTEST_F(GetDevicesTest, givenGetDevicesWhenCsrIsSetToVariousTypesThenTheFunctio break; case CSR_AUB: case CSR_TBX: - case CSR_TBX_WITH_AUB: + case CSR_TBX_WITH_AUB: { EXPECT_TRUE(ret); EXPECT_NE(nullptr, hwInfo); EXPECT_EQ(expectedDevices, numDevices); @@ -88,12 +91,21 @@ HWTEST_F(GetDevicesTest, givenGetDevicesWhenCsrIsSetToVariousTypesThenTheFunctio } EXPECT_TRUE(i < IGFX_MAX_PRODUCT); ASSERT_NE(nullptr, hardwarePrefix[i]); - EXPECT_EQ(0, memcmp(hardwareInfoTable[i]->pPlatform, hwInfo->pPlatform, sizeof(PLATFORM))); - EXPECT_EQ(0, memcmp(&hardwareInfoTable[i]->capabilityTable, &hwInfo->capabilityTable, sizeof(RuntimeCapabilityTable))); - EXPECT_EQ(0, memcmp(hardwareInfoTable[i]->pWaTable, hwInfo->pWaTable, sizeof(WorkaroundTable))); + HardwareInfo hwInfoFromTable = *hardwareInfoTable[i]; + hwInfoFromTable.pSkuTable = &featureTable; + hwInfoFromTable.pSysInfo = &sysInfo; + hardwareInfoSetup[hwInfoFromTable.pPlatform->eProductFamily](const_cast(hwInfoFromTable.pSysInfo), + const_cast(hwInfoFromTable.pSkuTable), + true, "default"); + HwInfoConfig *hwConfig = HwInfoConfig::get(hwInfoFromTable.pPlatform->eProductFamily); + hwConfig->configureHardwareCustom(&hwInfoFromTable, nullptr); + EXPECT_EQ(0, memcmp(hwInfoFromTable.pPlatform, hwInfo->pPlatform, sizeof(PLATFORM))); + EXPECT_EQ(0, memcmp(&hwInfoFromTable.capabilityTable, &hwInfo->capabilityTable, sizeof(RuntimeCapabilityTable))); + EXPECT_EQ(0, memcmp(hwInfoFromTable.pWaTable, hwInfo->pWaTable, sizeof(WorkaroundTable))); EXPECT_STREQ(hardwarePrefix[i], productFamily.c_str()); DeviceFactory::releaseDevices(); break; + } default: break; } @@ -137,10 +149,17 @@ HWTEST_F(GetDevicesTest, givenGetDevicesAndUnknownProductFamilyWhenCsrIsSetToVal } EXPECT_TRUE(i < IGFX_MAX_PRODUCT); ASSERT_NE(nullptr, hardwarePrefix[i]); - auto defaultHwInfo = *platformDevices; - EXPECT_EQ(0, memcmp(defaultHwInfo->pPlatform, hwInfo->pPlatform, sizeof(PLATFORM))); - EXPECT_EQ(0, memcmp(&defaultHwInfo->capabilityTable, &hwInfo->capabilityTable, sizeof(RuntimeCapabilityTable))); - EXPECT_EQ(0, memcmp(defaultHwInfo->pWaTable, hwInfo->pWaTable, sizeof(WorkaroundTable))); + HardwareInfo defaultHwInfo = **platformDevices; + defaultHwInfo.pSkuTable = &featureTable; + defaultHwInfo.pSysInfo = &sysInfo; + hardwareInfoSetup[defaultHwInfo.pPlatform->eProductFamily](const_cast(defaultHwInfo.pSysInfo), + const_cast(defaultHwInfo.pSkuTable), + true, "default"); + HwInfoConfig *hwConfig = HwInfoConfig::get(defaultHwInfo.pPlatform->eProductFamily); + hwConfig->configureHardwareCustom(&defaultHwInfo, nullptr); + EXPECT_EQ(0, memcmp(defaultHwInfo.pPlatform, hwInfo->pPlatform, sizeof(PLATFORM))); + EXPECT_EQ(0, memcmp(&defaultHwInfo.capabilityTable, &hwInfo->capabilityTable, sizeof(RuntimeCapabilityTable))); + EXPECT_EQ(0, memcmp(defaultHwInfo.pWaTable, hwInfo->pWaTable, sizeof(WorkaroundTable))); DeviceFactory::releaseDevices(); break; }