diff --git a/shared/test/unit_test/xe_hpg_core/mtl/CMakeLists.txt b/shared/test/unit_test/xe_hpg_core/mtl/CMakeLists.txt index 3b2185b21d..480a4d6eac 100644 --- a/shared/test/unit_test/xe_hpg_core/mtl/CMakeLists.txt +++ b/shared/test/unit_test/xe_hpg_core/mtl/CMakeLists.txt @@ -15,7 +15,6 @@ if(TESTS_MTL) ${CMAKE_CURRENT_SOURCE_DIR}/hw_aot_config_tests_mtl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/gfx_core_helper_tests_mtl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/product_helper_tests_mtl.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/hw_info_tests_mtl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/product_config_helper_tests_mtl.cpp ) diff --git a/shared/test/unit_test/xe_hpg_core/mtl/hw_info_tests_mtl.cpp b/shared/test/unit_test/xe_hpg_core/mtl/hw_info_tests_mtl.cpp deleted file mode 100644 index 6bacc6f572..0000000000 --- a/shared/test/unit_test/xe_hpg_core/mtl/hw_info_tests_mtl.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (C) 2022-2023 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -#include "shared/source/helpers/compiler_product_helper.h" -#include "shared/source/helpers/hw_info.h" -#include "shared/test/common/helpers/debug_manager_state_restore.h" -#include "shared/test/common/helpers/default_hw_info.h" -#include "shared/test/common/helpers/gtest_helpers.h" -#include "shared/test/common/test_macros/hw_test.h" - -using namespace NEO; - -using MtlHwInfoTests = ::testing::Test; - -MTLTEST_F(MtlHwInfoTests, WhenSetupHardwareInfoWithSetupFeatureTableFlagTrueOrFalseIsCalledThenFeatureTableHasCorrectValues) { - HardwareInfo hwInfo = *defaultHwInfo; - auto compilerProductHelper = CompilerProductHelper::create(hwInfo.platform.eProductFamily); - FeatureTable &featureTable = hwInfo.featureTable; - WorkaroundTable &workaroundTable = hwInfo.workaroundTable; - - EXPECT_FALSE(featureTable.flags.ftrLocalMemory); - EXPECT_FALSE(featureTable.flags.ftrFlatPhysCCS); - EXPECT_FALSE(featureTable.flags.ftrLinearCCS); - EXPECT_FALSE(featureTable.flags.ftrE2ECompression); - EXPECT_FALSE(featureTable.flags.ftrCCSNode); - EXPECT_FALSE(featureTable.flags.ftrCCSRing); - EXPECT_FALSE(featureTable.flags.ftrMultiTileArch); - EXPECT_FALSE(workaroundTable.flags.wa4kAlignUVOffsetNV12LinearSurface); - EXPECT_FALSE(workaroundTable.flags.waUntypedBufferCompression); - - MtlHwConfig::setupHardwareInfo(&hwInfo, false, *compilerProductHelper); - EXPECT_FALSE(featureTable.flags.ftrLocalMemory); - EXPECT_FALSE(featureTable.flags.ftrFlatPhysCCS); - EXPECT_FALSE(featureTable.flags.ftrLinearCCS); - EXPECT_FALSE(featureTable.flags.ftrE2ECompression); - EXPECT_FALSE(featureTable.flags.ftrCCSNode); - EXPECT_FALSE(featureTable.flags.ftrCCSRing); - EXPECT_FALSE(featureTable.flags.ftrMultiTileArch); - EXPECT_FALSE(workaroundTable.flags.wa4kAlignUVOffsetNV12LinearSurface); - EXPECT_FALSE(workaroundTable.flags.waUntypedBufferCompression); - - MtlHwConfig::setupHardwareInfo(&hwInfo, true, *compilerProductHelper); - EXPECT_FALSE(featureTable.flags.ftrLocalMemory); - EXPECT_FALSE(featureTable.flags.ftrFlatPhysCCS); - EXPECT_TRUE(featureTable.flags.ftrLinearCCS); - EXPECT_FALSE(featureTable.flags.ftrE2ECompression); - EXPECT_TRUE(featureTable.flags.ftrCCSNode); - EXPECT_TRUE(featureTable.flags.ftrCCSRing); - EXPECT_FALSE(featureTable.flags.ftrMultiTileArch); - EXPECT_TRUE(workaroundTable.flags.wa4kAlignUVOffsetNV12LinearSurface); - EXPECT_TRUE(workaroundTable.flags.waUntypedBufferCompression); -} - -MTLTEST_F(MtlHwInfoTests, givenMtlCapabilityTableWhenCheckDirectSubmissionEnginesThenProperValuesAreSetToTrue) { - HardwareInfo hwInfo = *defaultHwInfo; - const auto &directSubmissionEngines = hwInfo.capabilityTable.directSubmissionEngines; - - for (uint32_t i = 0; i < aub_stream::NUM_ENGINES; i++) { - switch (i) { - case aub_stream::ENGINE_CCS: - EXPECT_TRUE(directSubmissionEngines.data[i].engineSupported); - EXPECT_FALSE(directSubmissionEngines.data[i].submitOnInit); - EXPECT_FALSE(directSubmissionEngines.data[i].useNonDefault); - EXPECT_TRUE(directSubmissionEngines.data[i].useRootDevice); - EXPECT_FALSE(directSubmissionEngines.data[i].useInternal); - EXPECT_FALSE(directSubmissionEngines.data[i].useLowPriority); - break; - default: - EXPECT_FALSE(directSubmissionEngines.data[i].engineSupported); - EXPECT_FALSE(directSubmissionEngines.data[i].submitOnInit); - EXPECT_FALSE(directSubmissionEngines.data[i].useNonDefault); - EXPECT_FALSE(directSubmissionEngines.data[i].useRootDevice); - EXPECT_FALSE(directSubmissionEngines.data[i].useInternal); - EXPECT_FALSE(directSubmissionEngines.data[i].useLowPriority); - } - } -} - -MTLTEST_F(MtlHwInfoTests, WhenSetupHardwareInfoThenCorrectValuesOfCCSAndMultiTileInfoAreSet) { - HardwareInfo hwInfo = *defaultHwInfo; - auto compilerProductHelper = CompilerProductHelper::create(hwInfo.platform.eProductFamily); - GT_SYSTEM_INFO >SystemInfo = hwInfo.gtSystemInfo; - - MtlHwConfig::setupHardwareInfo(&hwInfo, false, *compilerProductHelper); - - EXPECT_FALSE(gtSystemInfo.MultiTileArchInfo.IsValid); - - EXPECT_TRUE(gtSystemInfo.CCSInfo.IsValid); - EXPECT_TRUE(1u == gtSystemInfo.CCSInfo.NumberOfCCSEnabled); - EXPECT_TRUE(0b1u == gtSystemInfo.CCSInfo.Instances.CCSEnableMask); -} - -MTLTEST_F(MtlHwInfoTests, GivenEmptyHwInfoForUnitTestsWhenSetupHardwareInfoIsCalledThenNonZeroValuesAreSet) { - HardwareInfo hwInfoToSet = *defaultHwInfo; - auto compilerProductHelper = CompilerProductHelper::create(hwInfoToSet.platform.eProductFamily); - GT_SYSTEM_INFO >SystemInfo = hwInfoToSet.gtSystemInfo; - gtSystemInfo = {}; - - MtlHwConfig::setupHardwareInfo(&hwInfoToSet, false, *compilerProductHelper); - - EXPECT_GT_VAL(gtSystemInfo.SliceCount, 0u); - EXPECT_GT_VAL(gtSystemInfo.SubSliceCount, 0u); - EXPECT_GT_VAL(gtSystemInfo.DualSubSliceCount, 0u); - EXPECT_GT_VAL(gtSystemInfo.EUCount, 0u); - EXPECT_GT_VAL(gtSystemInfo.MaxEuPerSubSlice, 0u); - EXPECT_GT_VAL(gtSystemInfo.MaxSlicesSupported, 0u); - EXPECT_GT_VAL(gtSystemInfo.MaxSubSlicesSupported, 0u); - - EXPECT_GT_VAL(gtSystemInfo.L3BankCount, 0u); - - EXPECT_TRUE(gtSystemInfo.CCSInfo.IsValid); - EXPECT_GT_VAL(gtSystemInfo.CCSInfo.NumberOfCCSEnabled, 0u); - - EXPECT_NE_VAL(hwInfoToSet.featureTable.ftrBcsInfo, 0u); - EXPECT_TRUE(gtSystemInfo.IsDynamicallyPopulated); - - for (uint32_t i = 0; i < gtSystemInfo.SliceCount; i++) { - EXPECT_TRUE(gtSystemInfo.SliceInfo[i].Enabled); - } -} - -MTLTEST_F(MtlHwInfoTests, givenMtlConfigWhenSetupHardwareInfoBaseThenGtSystemInfoIsCorrect) { - HardwareInfo hwInfo = *defaultHwInfo; - auto compilerProductHelper = CompilerProductHelper::create(hwInfo.platform.eProductFamily); - GT_SYSTEM_INFO >SystemInfo = hwInfo.gtSystemInfo; - MtlHwConfig::setupHardwareInfoBase(&hwInfo, false, *compilerProductHelper); - - EXPECT_EQ(336u, gtSystemInfo.TotalVsThreads); - EXPECT_EQ(336u, gtSystemInfo.TotalHsThreads); - EXPECT_EQ(336u, gtSystemInfo.TotalDsThreads); - EXPECT_EQ(336u, gtSystemInfo.TotalGsThreads); - EXPECT_EQ(64u, gtSystemInfo.TotalPsThreadsWindowerRange); - EXPECT_EQ(8u, gtSystemInfo.CsrSizeInMb); - EXPECT_FALSE(gtSystemInfo.IsL3HashModeEnabled); - EXPECT_FALSE(gtSystemInfo.IsDynamicallyPopulated); -} diff --git a/shared/test/unit_test/xe_hpg_core/os_agnostic_product_helper_xe_lpg_tests.cpp b/shared/test/unit_test/xe_hpg_core/os_agnostic_product_helper_xe_lpg_tests.cpp index 3945e72283..a1624454e4 100644 --- a/shared/test/unit_test/xe_hpg_core/os_agnostic_product_helper_xe_lpg_tests.cpp +++ b/shared/test/unit_test/xe_hpg_core/os_agnostic_product_helper_xe_lpg_tests.cpp @@ -5,11 +5,13 @@ * */ +#include "shared/source/helpers/compiler_product_helper.h" #include "shared/source/memory_manager/allocation_type.h" #include "shared/source/os_interface/product_helper.h" #include "shared/source/release_helper/release_helper.h" #include "shared/test/common/fixtures/device_fixture.h" #include "shared/test/common/helpers/default_hw_info.h" +#include "shared/test/common/helpers/gtest_helpers.h" #include "shared/test/common/mocks/mock_device.h" #include "shared/test/common/test_macros/hw_test.h" @@ -26,6 +28,145 @@ struct XeLpgProductHelperTests : public ::Test { ProductHelper const *productHelper = nullptr; }; +using XeLpgHwInfoTests = ::testing::Test; +HWTEST2_F(XeLpgHwInfoTests, whenSetupHardwareInfoBaseThenGtSystemInfoIsCorrect, IsXeLpg) { + HardwareInfo hwInfo = *defaultHwInfo; + auto compilerProductHelper = CompilerProductHelper::create(hwInfo.platform.eProductFamily); + GT_SYSTEM_INFO >SystemInfo = hwInfo.gtSystemInfo; + hardwareInfoSetup[hwInfo.platform.eProductFamily](&hwInfo, compilerProductHelper->getHwInfoConfig(hwInfo), false, *compilerProductHelper); + + EXPECT_EQ(336u, gtSystemInfo.TotalVsThreads); + EXPECT_EQ(336u, gtSystemInfo.TotalHsThreads); + EXPECT_EQ(336u, gtSystemInfo.TotalDsThreads); + EXPECT_EQ(336u, gtSystemInfo.TotalGsThreads); + EXPECT_EQ(64u, gtSystemInfo.TotalPsThreadsWindowerRange); + EXPECT_EQ(8u, gtSystemInfo.CsrSizeInMb); + EXPECT_FALSE(gtSystemInfo.IsL3HashModeEnabled); + EXPECT_FALSE(gtSystemInfo.IsDynamicallyPopulated); +} + +HWTEST2_F(XeLpgHwInfoTests, whenCheckDirectSubmissionEnginesThenProperValuesAreSetToTrue, IsXeLpg) { + HardwareInfo hwInfo = *defaultHwInfo; + const auto &directSubmissionEngines = hwInfo.capabilityTable.directSubmissionEngines; + + for (uint32_t i = 0; i < aub_stream::NUM_ENGINES; i++) { + switch (i) { + case aub_stream::ENGINE_CCS: + EXPECT_TRUE(directSubmissionEngines.data[i].engineSupported); + EXPECT_FALSE(directSubmissionEngines.data[i].submitOnInit); + EXPECT_FALSE(directSubmissionEngines.data[i].useNonDefault); + EXPECT_TRUE(directSubmissionEngines.data[i].useRootDevice); + EXPECT_FALSE(directSubmissionEngines.data[i].useInternal); + EXPECT_FALSE(directSubmissionEngines.data[i].useLowPriority); + break; + default: + EXPECT_FALSE(directSubmissionEngines.data[i].engineSupported); + EXPECT_FALSE(directSubmissionEngines.data[i].submitOnInit); + EXPECT_FALSE(directSubmissionEngines.data[i].useNonDefault); + EXPECT_FALSE(directSubmissionEngines.data[i].useRootDevice); + EXPECT_FALSE(directSubmissionEngines.data[i].useInternal); + EXPECT_FALSE(directSubmissionEngines.data[i].useLowPriority); + } + } +} + +HWTEST2_F(XeLpgHwInfoTests, WhenSetupHardwareInfoThenCorrectValuesOfCCSAndMultiTileInfoAreSet, IsXeLpg) { + HardwareInfo hwInfo = *defaultHwInfo; + auto compilerProductHelper = CompilerProductHelper::create(hwInfo.platform.eProductFamily); + GT_SYSTEM_INFO >SystemInfo = hwInfo.gtSystemInfo; + + hardwareInfoSetup[hwInfo.platform.eProductFamily](&hwInfo, compilerProductHelper->getHwInfoConfig(hwInfo), false, *compilerProductHelper); + + EXPECT_FALSE(gtSystemInfo.MultiTileArchInfo.IsValid); + + EXPECT_TRUE(gtSystemInfo.CCSInfo.IsValid); + EXPECT_TRUE(1u == gtSystemInfo.CCSInfo.NumberOfCCSEnabled); + EXPECT_TRUE(0b1u == gtSystemInfo.CCSInfo.Instances.CCSEnableMask); +} + +HWTEST2_F(XeLpgHwInfoTests, givenBoolWhenCallHardwareInfoSetupThenFeatureTableAndWorkaroundTableAreSetCorrect, IsXeLpg) { + HardwareInfo hwInfo = *defaultHwInfo; + auto compilerProductHelper = CompilerProductHelper::create(hwInfo.platform.eProductFamily); + GT_SYSTEM_INFO >SystemInfo = hwInfo.gtSystemInfo; + FeatureTable &featureTable = hwInfo.featureTable; + WorkaroundTable &workaroundTable = hwInfo.workaroundTable; + + for (auto setParamBool : ::testing::Bool()) { + + gtSystemInfo = {0}; + featureTable = {}; + workaroundTable = {}; + hardwareInfoSetup[productFamily](&hwInfo, setParamBool, compilerProductHelper->getHwInfoConfig(hwInfo), *compilerProductHelper); + + EXPECT_EQ(setParamBool, featureTable.flags.ftrL3IACoherency); + EXPECT_EQ(setParamBool, featureTable.flags.ftrPPGTT); + EXPECT_EQ(setParamBool, featureTable.flags.ftrSVM); + EXPECT_EQ(setParamBool, featureTable.flags.ftrIA32eGfxPTEs); + EXPECT_EQ(setParamBool, featureTable.flags.ftrStandardMipTailFormat); + EXPECT_EQ(setParamBool, featureTable.flags.ftrTranslationTable); + EXPECT_EQ(setParamBool, featureTable.flags.ftrUserModeTranslationTable); + EXPECT_EQ(setParamBool, featureTable.flags.ftrTileMappedResource); + EXPECT_EQ(setParamBool, featureTable.flags.ftrFbc); + EXPECT_EQ(setParamBool, featureTable.flags.ftrAstcHdr2D); + EXPECT_EQ(setParamBool, featureTable.flags.ftrAstcLdr2D); + EXPECT_EQ(setParamBool, featureTable.flags.ftrGpGpuMidBatchPreempt); + EXPECT_EQ(setParamBool, featureTable.flags.ftrGpGpuThreadGroupLevelPreempt); + EXPECT_EQ(setParamBool, featureTable.flags.ftrLinearCCS); + EXPECT_EQ(setParamBool, featureTable.flags.ftrCCSNode); + EXPECT_EQ(setParamBool, featureTable.flags.ftrCCSRing); + + EXPECT_EQ(setParamBool, workaroundTable.flags.wa4kAlignUVOffsetNV12LinearSurface); + EXPECT_EQ(setParamBool, workaroundTable.flags.waUntypedBufferCompression); + EXPECT_FALSE(featureTable.flags.ftrTileY); + EXPECT_FALSE(featureTable.flags.ftrLocalMemory); + EXPECT_FALSE(featureTable.flags.ftrFlatPhysCCS); + EXPECT_FALSE(featureTable.flags.ftrE2ECompression); + EXPECT_FALSE(featureTable.flags.ftrMultiTileArch); + } +} + +HWTEST2_F(XeLpgHwInfoTests, whenUsingCorrectConfigValueThenCorrectHwInfoIsReturned, IsXeLpg) { + HardwareInfo hwInfo = *defaultHwInfo; + auto compilerProductHelper = CompilerProductHelper::create(hwInfo.platform.eProductFamily); + GT_SYSTEM_INFO >SystemInfo = hwInfo.gtSystemInfo; + + uint64_t config = 0x200040010; + gtSystemInfo = {0}; + setHwInfoValuesFromConfig(config, hwInfo); + hardwareInfoSetup[productFamily](&hwInfo, false, config, *compilerProductHelper); + EXPECT_EQ(2u, gtSystemInfo.SliceCount); + EXPECT_EQ(8u, gtSystemInfo.DualSubSliceCount); +} + +HWTEST2_F(XeLpgHwInfoTests, GivenEmptyHwInfoForUnitTestsWhenSetupHardwareInfoIsCalledThenNonZeroValuesAreSet, IsXeLpg) { + HardwareInfo hwInfoToSet = *defaultHwInfo; + auto compilerProductHelper = CompilerProductHelper::create(hwInfoToSet.platform.eProductFamily); + GT_SYSTEM_INFO >SystemInfo = hwInfoToSet.gtSystemInfo; + gtSystemInfo = {}; + + hardwareInfoSetup[productFamily](&hwInfoToSet, false, compilerProductHelper->getHwInfoConfig(hwInfoToSet), *compilerProductHelper); + + EXPECT_GT_VAL(gtSystemInfo.SliceCount, 0u); + EXPECT_GT_VAL(gtSystemInfo.SubSliceCount, 0u); + EXPECT_GT_VAL(gtSystemInfo.DualSubSliceCount, 0u); + EXPECT_GT_VAL(gtSystemInfo.EUCount, 0u); + EXPECT_GT_VAL(gtSystemInfo.MaxEuPerSubSlice, 0u); + EXPECT_GT_VAL(gtSystemInfo.MaxSlicesSupported, 0u); + EXPECT_GT_VAL(gtSystemInfo.MaxSubSlicesSupported, 0u); + + EXPECT_GT_VAL(gtSystemInfo.L3BankCount, 0u); + + EXPECT_TRUE(gtSystemInfo.CCSInfo.IsValid); + EXPECT_GT_VAL(gtSystemInfo.CCSInfo.NumberOfCCSEnabled, 0u); + + EXPECT_NE_VAL(hwInfoToSet.featureTable.ftrBcsInfo, 0u); + EXPECT_TRUE(gtSystemInfo.IsDynamicallyPopulated); + + for (uint32_t i = 0; i < gtSystemInfo.SliceCount; i++) { + EXPECT_TRUE(gtSystemInfo.SliceInfo[i].Enabled); + } +} + HWTEST2_F(XeLpgProductHelperTests, whenCheckPreferredAllocationMethodThenAllocateByKmdIsReturned, IsXeLpg) { for (auto i = 0; i < static_cast(AllocationType::COUNT); i++) { auto allocationType = static_cast(i);