diff --git a/shared/test/unit_test/helpers/hw_helper_tests.cpp b/shared/test/unit_test/helpers/hw_helper_tests.cpp index e63cf4fcc6..a1f5cd1b08 100644 --- a/shared/test/unit_test/helpers/hw_helper_tests.cpp +++ b/shared/test/unit_test/helpers/hw_helper_tests.cpp @@ -331,7 +331,7 @@ HWTEST_F(PipeControlHelperTests, givenNotifyEnableArgumentIsTrueWhenHelperIsUsed HWTEST_F(PipeControlHelperTests, WhenIsDcFlushAllowedIsCalledThenCorrectResultIsReturned) { MockExecutionEnvironment mockExecutionEnvironment{}; - auto &productHelper = *ProductHelper::get(defaultHwInfo->platform.eProductFamily); + auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper(); EXPECT_FALSE(MemorySynchronizationCommands::getDcFlushEnable(false, *mockExecutionEnvironment.rootDeviceEnvironments[0])); EXPECT_EQ(productHelper.isDcFlushAllowed(), MemorySynchronizationCommands::getDcFlushEnable(true, *mockExecutionEnvironment.rootDeviceEnvironments[0])); } diff --git a/shared/test/unit_test/helpers/hw_helper_tests_dg2_and_later.cpp b/shared/test/unit_test/helpers/hw_helper_tests_dg2_and_later.cpp index 4d37dc37f0..651e78952e 100644 --- a/shared/test/unit_test/helpers/hw_helper_tests_dg2_and_later.cpp +++ b/shared/test/unit_test/helpers/hw_helper_tests_dg2_and_later.cpp @@ -210,6 +210,7 @@ HWTEST2_F(GfxCoreHelperDg2AndLaterTest, givenGfxCoreHelperWhenCheckIsUpdateTaskC using ProductHelperTestDg2AndLater = ::testing::Test; HWTEST2_F(ProductHelperTestDg2AndLater, givenDg2AndLaterPlatformWhenAskedIfHeapInLocalMemThenTrueIsReturned, IsAtLeastXeHpgCore) { - const auto &productHelper = *ProductHelper::get(defaultHwInfo->platform.eProductFamily); + MockExecutionEnvironment mockExecutionEnvironment{}; + auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper(); EXPECT_TRUE(productHelper.heapInLocalMem(*defaultHwInfo)); } diff --git a/shared/test/unit_test/helpers/hw_helper_tests_pvc_and_later.cpp b/shared/test/unit_test/helpers/hw_helper_tests_pvc_and_later.cpp index 63c28cd58e..fb6f031808 100644 --- a/shared/test/unit_test/helpers/hw_helper_tests_pvc_and_later.cpp +++ b/shared/test/unit_test/helpers/hw_helper_tests_pvc_and_later.cpp @@ -203,7 +203,7 @@ HWTEST2_F(GfxCoreHelperTestCooperativeEngine, givenCooperativeContextSupportedWh hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 2; hwInfo.featureTable.flags.ftrCCSNode = true; auto &gfxCoreHelper = getHelper(); - auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily); + auto &productHelper = getHelper(); uint32_t revisions[] = {REVISION_A0, REVISION_B}; for (auto &revision : revisions) { diff --git a/shared/test/unit_test/helpers/test_blit_commands_helper_xehp_and_later.cpp b/shared/test/unit_test/helpers/test_blit_commands_helper_xehp_and_later.cpp index db1ae3e8e7..3bd4b0a952 100644 --- a/shared/test/unit_test/helpers/test_blit_commands_helper_xehp_and_later.cpp +++ b/shared/test/unit_test/helpers/test_blit_commands_helper_xehp_and_later.cpp @@ -120,7 +120,7 @@ HWTEST2_F(BlitTests, givenA0StepWhenAppendBlitCommandsForFillBufferWithLocalAcce reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), MemoryPool::LocalMemory, MemoryManager::maxOsContextCount); HardwareInfo *hwInfo = pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->getMutableHardwareInfo(); - const auto &productHelper = *ProductHelper::get(hwInfo->platform.eProductFamily); + const auto &productHelper = pDevice->getProductHelper(); hwInfo->platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_A0, *hwInfo); BlitCommandsHelper::appendBlitCommandsForFillBuffer(&mockAllocation, blitCmd, *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]); @@ -137,7 +137,7 @@ HWTEST2_F(BlitTests, givenA0StepWhenAppendBlitCommandsForFillBufferWithLocalAcce reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), MemoryPool::LocalMemory, MemoryManager::maxOsContextCount); HardwareInfo *hwInfo = pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->getMutableHardwareInfo(); - const auto &productHelper = *ProductHelper::get(hwInfo->platform.eProductFamily); + const auto &productHelper = pDevice->getProductHelper(); hwInfo->platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_A0, *hwInfo); BlitCommandsHelper::appendBlitCommandsForFillBuffer(&mockAllocation, blitCmd, *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]); @@ -154,7 +154,7 @@ HWTEST2_F(BlitTests, givenBStepWhenAppendBlitCommandsForFillBufferWithLocalAcces reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), MemoryPool::LocalMemory, MemoryManager::maxOsContextCount); HardwareInfo *hwInfo = pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->getMutableHardwareInfo(); - const auto &productHelper = *ProductHelper::get(hwInfo->platform.eProductFamily); + const auto &productHelper = pDevice->getProductHelper(); hwInfo->platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_B, *hwInfo); BlitCommandsHelper::appendBlitCommandsForFillBuffer(&mockAllocation, blitCmd, *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]); @@ -171,7 +171,7 @@ HWTEST2_F(BlitTests, givenBStepWhenAppendBlitCommandsForFillBufferWithLocalAcces reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), MemoryPool::LocalMemory, MemoryManager::maxOsContextCount); HardwareInfo *hwInfo = pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->getMutableHardwareInfo(); - const auto &productHelper = *ProductHelper::get(hwInfo->platform.eProductFamily); + const auto &productHelper = pDevice->getProductHelper(); hwInfo->platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_B, *hwInfo); BlitCommandsHelper::appendBlitCommandsForFillBuffer(&mockAllocation, blitCmd, *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]); @@ -188,7 +188,7 @@ HWTEST2_F(BlitTests, givenAllocationInSystemMemWhenAppendBlitCommandsForFillBuff reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), MemoryPool::System4KBPages, MemoryManager::maxOsContextCount); HardwareInfo *hwInfo = pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->getMutableHardwareInfo(); - const auto &productHelper = *ProductHelper::get(hwInfo->platform.eProductFamily); + const auto &productHelper = pDevice->getProductHelper(); hwInfo->platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_A1, *hwInfo); BlitCommandsHelper::appendBlitCommandsForFillBuffer(&mockAllocation, blitCmd, *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]); @@ -205,7 +205,7 @@ HWTEST2_F(BlitTests, givenAllocationInSystemMemWhenAppendBlitCommandsForFillBuff reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), MemoryPool::System4KBPages, MemoryManager::maxOsContextCount); HardwareInfo *hwInfo = pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->getMutableHardwareInfo(); - const auto &productHelper = *ProductHelper::get(hwInfo->platform.eProductFamily); + const auto &productHelper = pDevice->getProductHelper(); hwInfo->platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_A1, *hwInfo); BlitCommandsHelper::appendBlitCommandsForFillBuffer(&mockAllocation, blitCmd, *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]); @@ -722,7 +722,7 @@ HWTEST2_F(BlitTests, givenA0orA1SteppingAndCpuLocalMemoryAccessWhenCallingAppend DebugManager.flags.ForceLocalMemoryAccessMode.set(1); const auto &rootDeviceEnvironment = pDevice->getRootDeviceEnvironment(); - auto productHelper = ProductHelper::get(productFamily); + auto &productHelper = pDevice->getProductHelper(); std::array, 3> testParams = { {{REVISION_A0, XY_BLOCK_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_SYSTEM_MEM}, {REVISION_A1, XY_BLOCK_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_SYSTEM_MEM}, @@ -731,7 +731,7 @@ HWTEST2_F(BlitTests, givenA0orA1SteppingAndCpuLocalMemoryAccessWhenCallingAppend for (const auto &[revision, expectedTargetMemory] : testParams) { auto bltCmd = FamilyType::cmdInitXyBlockCopyBlt; auto hwInfo = rootDeviceEnvironment.getMutableHardwareInfo(); - hwInfo->platform.usRevId = productHelper->getHwRevIdFromStepping(revision, *hwInfo); + hwInfo->platform.usRevId = productHelper.getHwRevIdFromStepping(revision, *hwInfo); BlitCommandsHelper::appendExtraMemoryProperties(bltCmd, rootDeviceEnvironment); EXPECT_EQ(bltCmd.getSourceTargetMemory(), expectedTargetMemory); diff --git a/shared/test/unit_test/os_interface/hw_info_config_tests.cpp b/shared/test/unit_test/os_interface/hw_info_config_tests.cpp index e5fa2724e7..acb2a4f773 100644 --- a/shared/test/unit_test/os_interface/hw_info_config_tests.cpp +++ b/shared/test/unit_test/os_interface/hw_info_config_tests.cpp @@ -647,7 +647,6 @@ HWTEST2_F(ProductHelperTest, givenProductHelperWhenIsPlatformQueryNotSupportedTh HWTEST_F(ProductHelperTest, givenDebugFlagWhenCheckingIsResolveDependenciesByPipeControlsSupportedThenCorrectValueIsReturned) { DebugManagerStateRestore restorer; - auto productHelper = ProductHelper::get(pInHwInfo.platform.eProductFamily); // ResolveDependenciesViaPipeControls = -1 (default) EXPECT_FALSE(productHelper->isResolveDependenciesByPipeControlsSupported(pInHwInfo, false)); diff --git a/shared/test/unit_test/os_interface/linux/drm_debug_prelim_tests.cpp b/shared/test/unit_test/os_interface/linux/drm_debug_prelim_tests.cpp index dece69679e..46f911ad80 100644 --- a/shared/test/unit_test/os_interface/linux/drm_debug_prelim_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/drm_debug_prelim_tests.cpp @@ -303,7 +303,8 @@ HWTEST_F(DrmDebugPrelimTest, givenAddedBindExtHandlesInBoWhenUnbindingThenExtens EXPECT_NE(0u, drm.context.receivedVmBind.value().extensions); bo.unbind(&osContext, 0); - if (ProductHelper::get(defaultHwInfo->platform.eProductFamily)->isVmBindPatIndexProgrammingSupported()) { + auto &productHelper = this->executionEnvironment->rootDeviceEnvironments[0]->getHelper(); + if (productHelper.isVmBindPatIndexProgrammingSupported()) { EXPECT_NE(0u, drm.context.receivedVmUnbind.value().extensions); } else { EXPECT_EQ(0u, drm.context.receivedVmUnbind.value().extensions); diff --git a/shared/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp b/shared/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp index cf89e176f1..0c0bcd0dcf 100644 --- a/shared/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp @@ -5420,8 +5420,8 @@ TEST_F(DrmMemoryManagerWithLocalMemoryAndExplicitExpectationsTest, givenPatIndex auto drmAllocation = static_cast(allocation); ASSERT_NE(nullptr, drmAllocation->getBO()); - - auto isVmBindPatIndexProgrammingSupported = ProductHelper::get(defaultHwInfo->platform.eProductFamily)->isVmBindPatIndexProgrammingSupported(); + auto &productHelper = this->device->getProductHelper(); + auto isVmBindPatIndexProgrammingSupported = productHelper.isVmBindPatIndexProgrammingSupported(); EXPECT_EQ(isVmBindPatIndexProgrammingSupported, mock->isVmBindPatIndexProgrammingSupported()); @@ -5451,8 +5451,8 @@ TEST_F(DrmMemoryManagerWithLocalMemoryAndExplicitExpectationsTest, givenCompress auto drmAllocation = static_cast(allocation); ASSERT_NE(nullptr, drmAllocation->getBO()); - - auto isVmBindPatIndexProgrammingSupported = ProductHelper::get(defaultHwInfo->platform.eProductFamily)->isVmBindPatIndexProgrammingSupported(); + auto &productHelper = this->device->getProductHelper(); + auto isVmBindPatIndexProgrammingSupported = productHelper.isVmBindPatIndexProgrammingSupported(); if (isVmBindPatIndexProgrammingSupported) { auto mockClientContext = static_cast(executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->getGmmClientContext()); diff --git a/shared/test/unit_test/os_interface/linux/drm_residency_handler_prelim_tests.cpp b/shared/test/unit_test/os_interface/linux/drm_residency_handler_prelim_tests.cpp index d2bd3724bf..edd5600790 100644 --- a/shared/test/unit_test/os_interface/linux/drm_residency_handler_prelim_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/drm_residency_handler_prelim_tests.cpp @@ -988,10 +988,10 @@ HWTEST_F(DrmMemoryOperationsHandlerBindTest, givenPatIndexProgrammingEnabledWhen csr->setupContext(*osContext); auto &gfxCoreHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); - auto productHelper = ProductHelper::get(executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->platform.eProductFamily); + auto &productHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); bool closSupported = (gfxCoreHelper.getNumCacheRegions() > 0); - bool patIndexProgrammingSupported = productHelper->isVmBindPatIndexProgrammingSupported(); + bool patIndexProgrammingSupported = productHelper.isVmBindPatIndexProgrammingSupported(); uint64_t gpuAddress = 0x123000; size_t size = 1; @@ -1047,9 +1047,9 @@ HWTEST_F(DrmMemoryOperationsHandlerBindTest, givenPatIndexErrorAndUncachedDebugF auto osContext = memoryManager->createAndRegisterOsContext(csr.get(), EngineDescriptorHelper::getDefaultDescriptor()); csr->setupContext(*osContext); auto &gfxCoreHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); - auto productHelper = ProductHelper::get(executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->platform.eProductFamily); + auto &productHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); bool closSupported = (gfxCoreHelper.getNumCacheRegions() > 0); - bool patIndexProgrammingSupported = productHelper->isVmBindPatIndexProgrammingSupported(); + bool patIndexProgrammingSupported = productHelper.isVmBindPatIndexProgrammingSupported(); if (!closSupported || !patIndexProgrammingSupported) { GTEST_SKIP(); } @@ -1073,9 +1073,9 @@ HWTEST_F(DrmMemoryOperationsHandlerBindTest, givenUncachedDebugFlagSetWhenVmBind auto osContext = memoryManager->createAndRegisterOsContext(csr.get(), EngineDescriptorHelper::getDefaultDescriptor()); csr->setupContext(*osContext); - auto productHelper = ProductHelper::get(executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->platform.eProductFamily); + auto &productHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); - if (!productHelper->isVmBindPatIndexProgrammingSupported()) { + if (!productHelper.isVmBindPatIndexProgrammingSupported()) { GTEST_SKIP(); } @@ -1263,13 +1263,11 @@ TEST(DrmResidencyHandlerTests, givenDebugFlagUseVmBindSetDefaultAndBindAvailable drm.context.vmBindQueryValue = 1; drm.context.vmBindQueryReturn = 0; EXPECT_FALSE(drm.bindAvailable); - - auto hwInfo = drm.getRootDeviceEnvironment().getHardwareInfo(); - auto productHelper = ProductHelper::get(hwInfo->platform.eProductFamily); + auto &productHelper = drm.getRootDeviceEnvironment().getHelper(); EXPECT_EQ(0u, drm.context.vmBindQueryCalled); - EXPECT_EQ(drm.isVmBindAvailable(), productHelper->isNewResidencyModelSupported()); - EXPECT_EQ(drm.bindAvailable, productHelper->isNewResidencyModelSupported()); + EXPECT_EQ(drm.isVmBindAvailable(), productHelper.isNewResidencyModelSupported()); + EXPECT_EQ(drm.bindAvailable, productHelper.isNewResidencyModelSupported()); EXPECT_EQ(1u, drm.context.vmBindQueryCalled); } @@ -1362,8 +1360,7 @@ TEST(DrmResidencyHandlerTests, whenQueryingForSetPairAvailableAndVmBindAvailable auto executionEnvironment = std::make_unique(); DrmQueryMock drm{*executionEnvironment->rootDeviceEnvironments[0]}; - auto hwInfo = drm.getRootDeviceEnvironment().getHardwareInfo(); - auto productHelper = ProductHelper::get(hwInfo->platform.eProductFamily); + auto &productHelper = drm.getRootDeviceEnvironment().getHelper(); drm.context.setPairQueryValue = 1; drm.context.setPairQueryReturn = 0; @@ -1381,8 +1378,8 @@ TEST(DrmResidencyHandlerTests, whenQueryingForSetPairAvailableAndVmBindAvailable EXPECT_EQ(1u, drm.context.setPairQueryCalled); EXPECT_EQ(0u, drm.context.vmBindQueryCalled); - EXPECT_EQ(drm.isVmBindAvailable(), productHelper->isNewResidencyModelSupported()); - EXPECT_EQ(drm.bindAvailable, productHelper->isNewResidencyModelSupported()); + EXPECT_EQ(drm.isVmBindAvailable(), productHelper.isNewResidencyModelSupported()); + EXPECT_EQ(drm.bindAvailable, productHelper.isNewResidencyModelSupported()); EXPECT_EQ(1u, drm.context.vmBindQueryCalled); } diff --git a/shared/test/unit_test/os_interface/linux/drm_with_prelim_tests.cpp b/shared/test/unit_test/os_interface/linux/drm_with_prelim_tests.cpp index 9d41b27aab..d803759467 100644 --- a/shared/test/unit_test/os_interface/linux/drm_with_prelim_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/drm_with_prelim_tests.cpp @@ -563,7 +563,8 @@ TEST_F(IoctlHelperPrelimFixture, givenIoctlHelperWhenFailOnInitializationAndPlat DebugManager.flags.PrintDebugMessages.set(false); std::string output = testing::internal::GetCapturedStderr(); - if (ProductHelper::get(executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->platform.eProductFamily)->isPlatformQuerySupported()) { + auto &productHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); + if (productHelper.isPlatformQuerySupported()) { EXPECT_STRNE(output.c_str(), ""); } else { EXPECT_STREQ(output.c_str(), ""); diff --git a/shared/test/unit_test/os_interface/linux/hw_info_config_linux_tests.cpp b/shared/test/unit_test/os_interface/linux/hw_info_config_linux_tests.cpp index 2e20c3a7d5..c30f712f4e 100644 --- a/shared/test/unit_test/os_interface/linux/hw_info_config_linux_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/hw_info_config_linux_tests.cpp @@ -52,10 +52,9 @@ HWTEST2_F(MockProductHelperTestLinux, givenDebugFlagSetWhenEnablingBlitterOperat } HWTEST2_F(MockProductHelperTestLinux, givenUnsupportedChipsetUniqueUUIDWhenGettingUuidThenReturnFalse, IsAtMostGen11) { - HardwareInfo hardwareInfo = *defaultHwInfo; - auto productHelper = ProductHelper::get(hardwareInfo.platform.eProductFamily); + auto &productHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); std::array id; - EXPECT_FALSE(productHelper->getUuid(nullptr, id)); + EXPECT_FALSE(productHelper.getUuid(nullptr, id)); } TEST_F(MockProductHelperTestLinux, GivenDummyConfigThenEdramIsDetected) { @@ -353,9 +352,9 @@ TEST_F(MockProductHelperTestLinux, givenFailingGttSizeIoctlWhenInitializingHwInf } HWTEST2_F(MockProductHelperTestLinux, givenPlatformWithPlatformQuerySupportedWhenItIsCalledThenReturnTrue, IsAtLeastMtl) { - HardwareInfo hardwareInfo = *defaultHwInfo; - auto productHelper = ProductHelper::get(hardwareInfo.platform.eProductFamily); - EXPECT_TRUE(productHelper->isPlatformQuerySupported()); + auto &productHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); + + EXPECT_TRUE(productHelper.isPlatformQuerySupported()); } using HwConfigLinux = ::testing::Test; diff --git a/shared/test/unit_test/os_interface/linux/hw_info_config_uuid_tests.cpp b/shared/test/unit_test/os_interface/linux/hw_info_config_uuid_tests.cpp index fbd30ae47a..ab32368313 100644 --- a/shared/test/unit_test/os_interface/linux/hw_info_config_uuid_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/hw_info_config_uuid_tests.cpp @@ -137,7 +137,8 @@ HWTEST2_F(MultipleDeviceUuidTest, whenRetrievingDeviceUuidThenCorrectUuidIsRecei std::array uuid; uint8_t expectedUuid[16] = {}; std::memcpy(expectedUuid, &expectedVal, sizeof(expectedVal)); - EXPECT_EQ(true, ProductHelper::get(productFamily)->getUuid(devices[0].get(), uuid)); + auto &productHelper = devices[0]->getProductHelper(); + EXPECT_EQ(true, productHelper.getUuid(devices[0].get(), uuid)); EXPECT_TRUE(0 == std::memcmp(uuid.data(), expectedUuid, sizeof(expectedUuid))); uint32_t subDeviceCount = numSubDevices; @@ -148,7 +149,8 @@ HWTEST2_F(MultipleDeviceUuidTest, whenRetrievingDeviceUuidThenCorrectUuidIsRecei uint8_t expectedUuid[16] = {0}; std::memcpy(expectedUuid, &expectedVal, sizeof(expectedVal)); expectedUuid[15] = i + 1; - EXPECT_EQ(true, ProductHelper::get(productFamily)->getUuid(subDevices[i], uuid)); + + EXPECT_EQ(true, productHelper.getUuid(subDevices[i], uuid)); EXPECT_TRUE(0 == std::memcmp(uuid.data(), expectedUuid, sizeof(expectedUuid))); } } @@ -243,7 +245,8 @@ HWTEST2_F(MultipleDeviceUuidTest, whenRetrievingDeviceUuidThenCorrectUuidIsRecei std::array uuid; uint8_t expectedUuid[16] = {}; std::memcpy(expectedUuid, &expectedVal, sizeof(expectedVal)); - EXPECT_EQ(true, ProductHelper::get(productFamily)->getUuid(devices[0].get(), uuid)); + auto &productHelper = devices[0]->getProductHelper(); + EXPECT_EQ(true, productHelper.getUuid(devices[0].get(), uuid)); EXPECT_TRUE(0 == std::memcmp(uuid.data(), expectedUuid, sizeof(expectedUuid))); uint32_t subDeviceCount = numSubDevices; @@ -254,7 +257,7 @@ HWTEST2_F(MultipleDeviceUuidTest, whenRetrievingDeviceUuidThenCorrectUuidIsRecei uint8_t expectedUuid[16] = {0}; std::memcpy(expectedUuid, &expectedVal, sizeof(expectedVal)); expectedUuid[15] = i + 1; - EXPECT_EQ(true, ProductHelper::get(productFamily)->getUuid(subDevices[i], uuid)); + EXPECT_EQ(true, productHelper.getUuid(subDevices[i], uuid)); EXPECT_TRUE(0 == std::memcmp(uuid.data(), expectedUuid, sizeof(expectedUuid))); } } @@ -287,9 +290,10 @@ HWTEST2_F(MultipleDeviceUuidTest, givenTelemDirectoriesAreLessThanExpectedWhenRe uint32_t subDeviceCount = numSubDevices; std::vector subDevices(subDeviceCount); subDevices = devices[0]->getSubDevices(); + auto &productHelper = devices[0]->getProductHelper(); for (auto i = 0u; i < subDeviceCount; i++) { std::array uuid; - EXPECT_EQ(false, ProductHelper::get(productFamily)->getUuid(subDevices[i], uuid)); + EXPECT_EQ(false, productHelper.getUuid(subDevices[i], uuid)); } } @@ -349,9 +353,11 @@ HWTEST2_F(MultipleDeviceUuidTest, GivenMissingGuidWhenRetrievingUuidForSubDevice uint32_t subDeviceCount = numSubDevices; std::vector subDevices(subDeviceCount); subDevices = devices[0]->getSubDevices(); + + auto &productHelper = devices[0]->getProductHelper(); for (auto i = 0u; i < subDeviceCount; i++) { std::array uuid; - EXPECT_EQ(false, ProductHelper::get(productFamily)->getUuid(subDevices[i], uuid)); + EXPECT_EQ(false, productHelper.getUuid(subDevices[i], uuid)); } } @@ -395,9 +401,10 @@ HWTEST2_F(MultipleDeviceUuidTest, GivenIncorrectGuidWhenRetrievingUuidForSubDevi uint32_t subDeviceCount = numSubDevices; std::vector subDevices(subDeviceCount); subDevices = devices[0]->getSubDevices(); + auto &productHelper = devices[0]->getProductHelper(); for (auto i = 0u; i < subDeviceCount; i++) { std::array uuid; - EXPECT_EQ(false, ProductHelper::get(productFamily)->getUuid(subDevices[i], uuid)); + EXPECT_EQ(false, productHelper.getUuid(subDevices[i], uuid)); } } @@ -451,9 +458,10 @@ HWTEST2_F(MultipleDeviceUuidTest, GivenMissingOffsetWhenRetrievingUuidForSubDevi uint32_t subDeviceCount = numSubDevices; std::vector subDevices(subDeviceCount); subDevices = devices[0]->getSubDevices(); + auto &productHelper = devices[0]->getProductHelper(); for (auto i = 0u; i < subDeviceCount; i++) { std::array uuid; - EXPECT_EQ(false, ProductHelper::get(productFamily)->getUuid(subDevices[i], uuid)); + EXPECT_EQ(false, productHelper.getUuid(subDevices[i], uuid)); } } @@ -506,9 +514,10 @@ HWTEST2_F(MultipleDeviceUuidTest, GivenIncorrectOffsetWhenRetrievingUuidForSubDe uint32_t subDeviceCount = numSubDevices; std::vector subDevices(subDeviceCount); subDevices = devices[0]->getSubDevices(); + auto &productHelper = devices[0]->getProductHelper(); for (auto i = 0u; i < subDeviceCount; i++) { std::array uuid; - EXPECT_EQ(false, ProductHelper::get(productFamily)->getUuid(subDevices[i], uuid)); + EXPECT_EQ(false, productHelper.getUuid(subDevices[i], uuid)); } } @@ -560,7 +569,8 @@ HWTEST2_F(MultipleDeviceUuidTest, GivenMissingTelemNodeWhenRetrievingUuidThenFai }); std::array uuid; - EXPECT_EQ(false, ProductHelper::get(productFamily)->getUuid(devices[0].get(), uuid)); + auto &productHelper = devices[0]->getProductHelper(); + EXPECT_EQ(false, productHelper.getUuid(devices[0].get(), uuid)); } HWTEST2_F(MultipleDeviceUuidTest, GivenIncorrectTelemNodeWhenRetrievingUuidThenFailureIsReturned, IsXEHP) { @@ -612,7 +622,8 @@ HWTEST2_F(MultipleDeviceUuidTest, GivenIncorrectTelemNodeWhenRetrievingUuidThenF }); std::array uuid; - EXPECT_EQ(false, ProductHelper::get(productFamily)->getUuid(devices[0].get(), uuid)); + auto &productHelper = devices[0]->getProductHelper(); + EXPECT_EQ(false, productHelper.getUuid(devices[0].get(), uuid)); } HWTEST2_F(MultipleDeviceUuidTest, GivenIncorrectGuidValueWhenRetrievingUuidThenFailureIsReturned, IsXEHP) { @@ -665,7 +676,8 @@ HWTEST2_F(MultipleDeviceUuidTest, GivenIncorrectGuidValueWhenRetrievingUuidThenF }); std::array uuid; - EXPECT_EQ(false, ProductHelper::get(productFamily)->getUuid(devices[0].get(), uuid)); + auto &productHelper = devices[0]->getProductHelper(); + EXPECT_EQ(false, productHelper.getUuid(devices[0].get(), uuid)); } HWTEST2_F(MultipleDeviceUuidTest, GivenDeviceLinkIsNotAvailableWhenRetrievingUuidForRootDeviceThenFailureIsReturned, IsXEHP) { @@ -683,7 +695,8 @@ HWTEST2_F(MultipleDeviceUuidTest, GivenDeviceLinkIsNotAvailableWhenRetrievingUui }); std::array uuid; - EXPECT_EQ(false, ProductHelper::get(productFamily)->getUuid(devices[0].get(), uuid)); + auto &productHelper = devices[0]->getProductHelper(); + EXPECT_EQ(false, productHelper.getUuid(devices[0].get(), uuid)); } TEST(PmtUtilTest, givenDataPtrIsNullWhenPmtUtilReadTelemIsCalledThenVerifyZeroIsReturned) { @@ -736,7 +749,8 @@ HWTEST2_F(SysfsBasedUuidTest, whenRetrievingDeviceUuidThenCorrectUuidIsReceived, // Prepare expected Uuid value const uint64_t expectedUuidValue = 0x6769df256e271362; std::array uuid; - EXPECT_TRUE(ProductHelper::get(productFamily)->getUuid(device, uuid)); + auto &productHelper = device->getProductHelper(); + EXPECT_TRUE(productHelper.getUuid(device, uuid)); EXPECT_TRUE(0 == std::memcmp(uuid.data(), &expectedUuidValue, sizeof(expectedUuidValue))); NEO::directoryFilesMap.clear(); } @@ -750,7 +764,8 @@ HWTEST2_F(SysfsBasedUuidTest, givenSysfsFileNotAvailableWhenRetrievingDeviceUuid }); std::array uuid; - EXPECT_FALSE(ProductHelper::get(productFamily)->getUuid(device, uuid)); + auto &productHelper = device->getProductHelper(); + EXPECT_FALSE(productHelper.getUuid(device, uuid)); NEO::directoryFilesMap.clear(); } @@ -769,7 +784,8 @@ HWTEST2_F(SysfsBasedUuidTest, givenIncorrectUuidWhenRetrievingDeviceUuidThenFail }); std::array uuid; - EXPECT_FALSE(ProductHelper::get(productFamily)->getUuid(device, uuid)); + auto &productHelper = device->getProductHelper(); + EXPECT_FALSE(productHelper.getUuid(device, uuid)); NEO::directoryFilesMap.clear(); } @@ -789,7 +805,8 @@ HWTEST2_F(SysfsBasedUuidTest, givenErrnoIsSetWhenRetrievingDeviceUuidThenFailure }); std::array uuid; - EXPECT_FALSE(ProductHelper::get(productFamily)->getUuid(device, uuid)); + auto &productHelper = device->getProductHelper(); + EXPECT_FALSE(productHelper.getUuid(device, uuid)); NEO::directoryFilesMap.clear(); } @@ -799,5 +816,6 @@ HWTEST2_F(SysfsBasedUuidTest, givenDriverModelIsNotDrmWhenRetrievingDeviceUuidTh auto executionEnvironment = device->getExecutionEnvironment(); executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::move(driverModelMock)); std::array uuid; - EXPECT_FALSE(ProductHelper::get(productFamily)->getUuid(device, uuid)); + auto &productHelper = device->getProductHelper(); + EXPECT_FALSE(productHelper.getUuid(device, uuid)); } \ No newline at end of file diff --git a/shared/test/unit_test/os_interface/windows/wddm_tests.cpp b/shared/test/unit_test/os_interface/windows/wddm_tests.cpp index 7d565d73d2..304f4d2419 100644 --- a/shared/test/unit_test/os_interface/windows/wddm_tests.cpp +++ b/shared/test/unit_test/os_interface/windows/wddm_tests.cpp @@ -116,10 +116,9 @@ TEST_F(WddmTests, whenGetAdapterLuidThenLuidIsReturned) { TEST_F(WddmTests, GivenDebugFlagDisablesEvictIfNecessarySupportThenFlagIsFalse) { DebugManagerStateRestore restorer{}; DebugManager.flags.PlaformSupportEvictIfNecessaryFlag.set(0); + auto &productHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); - auto productHelper = ProductHelper::get(rootDeviceEnvironment->getHardwareInfo()->platform.eProductFamily); - - wddm->setPlatformSupportEvictIfNecessaryFlag(*productHelper); + wddm->setPlatformSupportEvictIfNecessaryFlag(productHelper); EXPECT_FALSE(wddm->platformSupportsEvictIfNecessary); } @@ -127,25 +126,25 @@ TEST_F(WddmTests, GivenDebugFlagEnablesEvictIfNecessarySupportThenFlagIsTrue) { DebugManagerStateRestore restorer{}; DebugManager.flags.PlaformSupportEvictIfNecessaryFlag.set(1); - auto productHelper = ProductHelper::get(rootDeviceEnvironment->getHardwareInfo()->platform.eProductFamily); + auto &productHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); - wddm->setPlatformSupportEvictIfNecessaryFlag(*productHelper); + wddm->setPlatformSupportEvictIfNecessaryFlag(productHelper); EXPECT_TRUE(wddm->platformSupportsEvictIfNecessary); } TEST_F(WddmTests, givenDebugFlagForceEvictOnlyIfNecessaryAllValuesThenForceSettingIsSetCorrectly) { DebugManagerStateRestore restorer{}; - auto productHelper = ProductHelper::get(rootDeviceEnvironment->getHardwareInfo()->platform.eProductFamily); + auto &productHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); - wddm->setPlatformSupportEvictIfNecessaryFlag(*productHelper); + wddm->setPlatformSupportEvictIfNecessaryFlag(productHelper); EXPECT_EQ(-1, wddm->forceEvictOnlyIfNecessary); DebugManager.flags.ForceEvictOnlyIfNecessaryFlag.set(0); - wddm->setPlatformSupportEvictIfNecessaryFlag(*productHelper); + wddm->setPlatformSupportEvictIfNecessaryFlag(productHelper); EXPECT_EQ(0, wddm->forceEvictOnlyIfNecessary); DebugManager.flags.ForceEvictOnlyIfNecessaryFlag.set(1); - wddm->setPlatformSupportEvictIfNecessaryFlag(*productHelper); + wddm->setPlatformSupportEvictIfNecessaryFlag(productHelper); EXPECT_EQ(1, wddm->forceEvictOnlyIfNecessary); } diff --git a/shared/test/unit_test/xe_hpc_core/compute_mode_tests_xe_hpc_core.cpp b/shared/test/unit_test/xe_hpc_core/compute_mode_tests_xe_hpc_core.cpp index 0ad314aae6..01277c0aab 100644 --- a/shared/test/unit_test/xe_hpc_core/compute_mode_tests_xe_hpc_core.cpp +++ b/shared/test/unit_test/xe_hpc_core/compute_mode_tests_xe_hpc_core.cpp @@ -151,7 +151,8 @@ HWTEST2_F(XeHpcComputeModeRequirements, giventhreadArbitrationPolicyWithoutShare setUpImpl(); using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE; using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; - auto &productHelper = *ProductHelper::get(defaultHwInfo->platform.eProductFamily); + MockExecutionEnvironment mockExecutionEnvironment{}; + auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper(); auto startOffset = getCsrHw()->commandStream.getUsed(); diff --git a/shared/test/unit_test/xe_hpc_core/dispatch_walker_tests_xe_hpc_core.cpp b/shared/test/unit_test/xe_hpc_core/dispatch_walker_tests_xe_hpc_core.cpp index ae3255db9f..39812fd9f5 100644 --- a/shared/test/unit_test/xe_hpc_core/dispatch_walker_tests_xe_hpc_core.cpp +++ b/shared/test/unit_test/xe_hpc_core/dispatch_walker_tests_xe_hpc_core.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2022 Intel Corporation + * Copyright (C) 2021-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -10,6 +10,7 @@ #include "shared/source/os_interface/hw_info_config.h" #include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/default_hw_info.h" +#include "shared/test/common/mocks/mock_execution_environment.h" #include "shared/test/common/test_macros/header/per_product_test_definitions.h" #include "shared/test/common/test_macros/test.h" @@ -33,7 +34,8 @@ XE_HPC_CORETEST_F(WalkerDispatchTestsXeHpcCore, givenXeHpcWhenEncodeAdditionalWa } { - const auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily); + MockExecutionEnvironment mockExecutionEnvironment{}; + const auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper(); uint32_t expectedValue = productHelper.isComputeDispatchAllWalkerEnableInComputeWalkerRequired(hwInfo); walkerArgs.kernelExecutionType = KernelExecutionType::Concurrent; EncodeDispatchKernel::encodeAdditionalWalkerFields(hwInfo, walkerCmd, walkerArgs); diff --git a/shared/test/unit_test/xe_hpc_core/hw_helper_xe_hpc_core_tests.cpp b/shared/test/unit_test/xe_hpc_core/hw_helper_xe_hpc_core_tests.cpp index bf7e48c7af..41d4a284c0 100644 --- a/shared/test/unit_test/xe_hpc_core/hw_helper_xe_hpc_core_tests.cpp +++ b/shared/test/unit_test/xe_hpc_core/hw_helper_xe_hpc_core_tests.cpp @@ -84,7 +84,9 @@ XE_HPC_CORETEST_F(GfxCoreHelperXeHpcCoreTest, givenXeHPCPlatformWhenCheckAssignE auto hwInfo = *defaultHwInfo; MockExecutionEnvironment mockExecutionEnvironment{}; auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper(); - EXPECT_EQ(gfxCoreHelper.isAssignEngineRoundRobinSupported(hwInfo), ProductHelper::get(hwInfo.platform.eProductFamily)->isAssignEngineRoundRobinSupported()); + auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper(); + + EXPECT_EQ(gfxCoreHelper.isAssignEngineRoundRobinSupported(hwInfo), productHelper.isAssignEngineRoundRobinSupported()); } XE_HPC_CORETEST_F(GfxCoreHelperTest, givenGfxCoreHelperWhenCallCopyThroughLockedPtrEnabledThenReturnTrue) { diff --git a/shared/test/unit_test/xe_hpc_core/pvc/engine_node_helper_tests_pvc.cpp b/shared/test/unit_test/xe_hpc_core/pvc/engine_node_helper_tests_pvc.cpp index 48445eacc0..0676169ff7 100644 --- a/shared/test/unit_test/xe_hpc_core/pvc/engine_node_helper_tests_pvc.cpp +++ b/shared/test/unit_test/xe_hpc_core/pvc/engine_node_helper_tests_pvc.cpp @@ -504,7 +504,7 @@ PVCTEST_F(EngineNodeHelperPvcTests, whenGetGpgpuEnginesThenReturnTwoCccsEnginesA PVCTEST_F(EngineNodeHelperPvcTests, givenNonTile0AccessWhenGettingIsBlitCopyRequiredForLocalMemoryThenProperValueIsReturned) { HardwareInfo hwInfo = *defaultHwInfo; - auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily); + auto &productHelper = getHelper(); hwInfo.capabilityTable.blitterOperationsSupported = true; MockGraphicsAllocation graphicsAllocation; graphicsAllocation.setAllocationType(AllocationType::BUFFER_HOST_MEMORY); diff --git a/shared/test/unit_test/xe_hpc_core/pvc/sampler_tests_pvc.cpp b/shared/test/unit_test/xe_hpc_core/pvc/sampler_tests_pvc.cpp index 80199ae550..09fe0958fe 100644 --- a/shared/test/unit_test/xe_hpc_core/pvc/sampler_tests_pvc.cpp +++ b/shared/test/unit_test/xe_hpc_core/pvc/sampler_tests_pvc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2022 Intel Corporation + * Copyright (C) 2021-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -9,6 +9,7 @@ #include "shared/source/xe_hpc_core/hw_cmds_pvc.h" #include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/default_hw_info.h" +#include "shared/test/common/mocks/mock_execution_environment.h" #include "shared/test/common/test_macros/header/per_product_test_definitions.h" #include "shared/test/common/test_macros/test.h" @@ -20,11 +21,13 @@ using PvcSamplerTest = ::testing::Test; PVCTEST_F(PvcSamplerTest, givenPvcSamplerWhenUsingDefaultFilteringAndAppendSamplerStateParamsThenDisableLowQualityFilter) { EXPECT_FALSE(DebugManager.flags.ForceSamplerLowFilteringPrecision.get()); typedef typename FamilyType::SAMPLER_STATE SAMPLER_STATE; + MockExecutionEnvironment mockExecutionEnvironment{}; + auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper(); auto state = FamilyType::cmdInitSamplerState; EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter()); - ProductHelper::get(defaultHwInfo->platform.eProductFamily)->adjustSamplerState(&state, *defaultHwInfo); + productHelper.adjustSamplerState(&state, *defaultHwInfo); EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter()); } @@ -33,10 +36,11 @@ PVCTEST_F(PvcSamplerTest, givenPvcSamplerWhenForcingLowQualityFilteringAndAppend DebugManager.flags.ForceSamplerLowFilteringPrecision.set(true); EXPECT_TRUE(DebugManager.flags.ForceSamplerLowFilteringPrecision.get()); typedef typename FamilyType::SAMPLER_STATE SAMPLER_STATE; - + MockExecutionEnvironment mockExecutionEnvironment{}; + auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper(); auto state = FamilyType::cmdInitSamplerState; EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter()); - ProductHelper::get(defaultHwInfo->platform.eProductFamily)->adjustSamplerState(&state, *defaultHwInfo); + productHelper.adjustSamplerState(&state, *defaultHwInfo); EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_ENABLE, state.getLowQualityFilter()); } diff --git a/shared/test/unit_test/xe_hpc_core/pvc/test_encode_dispatch_kernel_pvc.cpp b/shared/test/unit_test/xe_hpc_core/pvc/test_encode_dispatch_kernel_pvc.cpp index ef66a7d9b5..781fbf8e09 100644 --- a/shared/test/unit_test/xe_hpc_core/pvc/test_encode_dispatch_kernel_pvc.cpp +++ b/shared/test/unit_test/xe_hpc_core/pvc/test_encode_dispatch_kernel_pvc.cpp @@ -77,12 +77,12 @@ PVCTEST_F(EncodeKernelPvcTest, givenRevisionBAndAboveWhenSpecialModeRequiredThen {0x6, false}, {0x7, false}, }; - auto productHelper = ProductHelper::get(hwInfo->platform.eProductFamily); + auto &productHelper = pDevice->getProductHelper(); for (const auto &testInput : testInputs) { for (const auto &deviceId : pvcXlDeviceIds) { hwInfo->platform.usDeviceID = deviceId; hwInfo->platform.usRevId = testInput.revId; - cmdContainer->systolicModeSupport = productHelper->isSystolicModeConfigurable(*hwInfo); + cmdContainer->systolicModeSupport = productHelper.isSystolicModeConfigurable(*hwInfo); cmdContainer->lastPipelineSelectModeRequired = false; EncodeDispatchKernelArgs dispatchArgs = createDefaultDispatchKernelArgs(pDevice, dispatchInterface.get(), dims, requiresUncachedMocs); @@ -112,12 +112,12 @@ PVCTEST_F(EncodeKernelPvcTest, givenRevisionBAndAboveWhenSpecialModeRequiredAndA {0x6, false}, {0x7, false}, }; - auto productHelper = ProductHelper::get(hwInfo->platform.eProductFamily); + auto &productHelper = pDevice->getProductHelper(); for (const auto &testInput : testInputs) { for (const auto &deviceId : pvcXlDeviceIds) { hwInfo->platform.usDeviceID = deviceId; hwInfo->platform.usRevId = testInput.revId; - cmdContainer->systolicModeSupport = productHelper->isSystolicModeConfigurable(*hwInfo); + cmdContainer->systolicModeSupport = productHelper.isSystolicModeConfigurable(*hwInfo); EncodeComputeMode::adjustPipelineSelect(*cmdContainer.get(), dispatchInterface->kernelDescriptor); GenCmdList commands; CmdParse::parseCommandBuffer(commands, ptrOffset(cmdContainer->getCommandStream()->getCpuBase(), 0), cmdContainer->getCommandStream()->getUsed()); diff --git a/shared/test/unit_test/xe_hpc_core/pvc/test_preamble_pvc.cpp b/shared/test/unit_test/xe_hpc_core/pvc/test_preamble_pvc.cpp index 2ac1a1721e..afcb24173d 100644 --- a/shared/test/unit_test/xe_hpc_core/pvc/test_preamble_pvc.cpp +++ b/shared/test/unit_test/xe_hpc_core/pvc/test_preamble_pvc.cpp @@ -65,7 +65,7 @@ PVCTEST_F(PreamblePipelineSelectState, givenRevisionBAndAboveWhenCallingProgramP {0x6, false}, {0x7, false}, }; - auto &productHelper = *ProductHelper::get(hwInfo->platform.eProductFamily); + auto &productHelper = pDevice->getProductHelper(); for (auto &testInput : testInputs) { LinearStream linearStream(&gfxAllocation); hwInfo->platform.usRevId = testInput.revId; diff --git a/shared/test/unit_test/xe_hpc_core/test_encode_xe_hpc_core.cpp b/shared/test/unit_test/xe_hpc_core/test_encode_xe_hpc_core.cpp index 56e5127cd7..0cd70c841c 100644 --- a/shared/test/unit_test/xe_hpc_core/test_encode_xe_hpc_core.cpp +++ b/shared/test/unit_test/xe_hpc_core/test_encode_xe_hpc_core.cpp @@ -361,7 +361,7 @@ XE_HPC_CORETEST_F(EncodeKernelXeHpcCoreTest, givenDefaultSettingForFenceAsPostSy DebugManager.flags.ProgramGlobalFenceAsPostSyncOperationInComputeWalker.set(-1); auto &hwInfo = *pDevice->getRootDeviceEnvironment().getMutableHardwareInfo(); - auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily); + auto &productHelper = pDevice->getProductHelper(); VariableBackup hwRevId{&hwInfo.platform.usRevId}; hwRevId = productHelper.getHwRevIdFromStepping(REVISION_A0, hwInfo); @@ -395,7 +395,7 @@ XE_HPC_CORETEST_F(EncodeKernelXeHpcCoreTest, givenDefaultSettingForFenceWhenKern DebugManager.flags.ProgramGlobalFenceAsPostSyncOperationInComputeWalker.set(-1); auto &hwInfo = *pDevice->getRootDeviceEnvironment().getMutableHardwareInfo(); - auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily); + auto &productHelper = pDevice->getProductHelper(); unsigned short pvcRevB = productHelper.getHwRevIdFromStepping(REVISION_B, hwInfo); VariableBackup hwRevId(&hwInfo.platform.usRevId, pvcRevB); @@ -431,7 +431,7 @@ XE_HPC_CORETEST_F(EncodeKernelXeHpcCoreTest, givenDefaultSettingForFenceWhenEven DebugManager.flags.ProgramGlobalFenceAsPostSyncOperationInComputeWalker.set(-1); auto &hwInfo = *pDevice->getRootDeviceEnvironment().getMutableHardwareInfo(); - auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily); + auto &productHelper = pDevice->getProductHelper(); unsigned short pvcRevB = productHelper.getHwRevIdFromStepping(REVISION_B, hwInfo); VariableBackup hwRevId(&hwInfo.platform.usRevId, pvcRevB); @@ -467,7 +467,7 @@ XE_HPC_CORETEST_F(EncodeKernelXeHpcCoreTest, givenDefaultSettingForFenceWhenKern DebugManager.flags.ProgramGlobalFenceAsPostSyncOperationInComputeWalker.set(-1); auto &hwInfo = *pDevice->getRootDeviceEnvironment().getMutableHardwareInfo(); - auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily); + auto &productHelper = pDevice->getProductHelper(); unsigned short pvcRevB = productHelper.getHwRevIdFromStepping(REVISION_B, hwInfo); VariableBackup hwRevId(&hwInfo.platform.usRevId, pvcRevB); @@ -521,7 +521,7 @@ XE_HPC_CORETEST_F(EncodeKernelXeHpcCoreTest, givenCleanHeapsAndSlmNotChangedAndU XE_HPC_CORETEST_F(EncodeKernelXeHpcCoreTest, givenDispatchSizeSmallerOrEqualToAvailableThreadCountWhenAdjustInterfaceDescriptorDataIsCalledThenThreadGroupDispatchSizeIsCorrectlySet) { using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA; - const auto &productHelper = *ProductHelper::get(productFamily); + const auto &productHelper = pDevice->getProductHelper(); auto hwInfo = pDevice->getHardwareInfo(); hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_B, hwInfo); hwInfo.gtSystemInfo.EUCount = 2u; @@ -541,7 +541,7 @@ XE_HPC_CORETEST_F(EncodeKernelXeHpcCoreTest, givenMultipleTilesAndImplicitScalin using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA; DebugManagerStateRestore restorer; DebugManager.flags.EnableWalkerPartition.set(0); - const auto &productHelper = *ProductHelper::get(productFamily); + const auto &productHelper = pDevice->getProductHelper(); auto hwInfo = pDevice->getHardwareInfo(); hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_B, hwInfo); hwInfo.gtSystemInfo.EUCount = 32; @@ -564,7 +564,7 @@ XE_HPC_CORETEST_F(EncodeKernelXeHpcCoreTest, givenMultipleTilesAndImplicitScalin XE_HPC_CORETEST_F(EncodeKernelXeHpcCoreTest, givenNumberOfThreadsInThreadGroupWhenCallingAdjustInterfaceDescriptorDataThenThreadGroupDispatchSizeIsCorrectlySet) { using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA; - const auto &productHelper = *ProductHelper::get(productFamily); + const auto &productHelper = pDevice->getProductHelper(); auto hwInfo = pDevice->getHardwareInfo(); hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_B, hwInfo); @@ -587,7 +587,7 @@ XE_HPC_CORETEST_F(EncodeKernelXeHpcCoreTest, givenNumberOfThreadsInThreadGroupWh XE_HPC_CORETEST_F(EncodeKernelXeHpcCoreTest, givenDifferentNumGrfWhenCallingAdjustInterfaceDescriptorDataThenThreadGroupDispatchSizeIsCorrectlySet) { using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA; - const auto &productHelper = *ProductHelper::get(productFamily); + const auto &productHelper = pDevice->getProductHelper(); auto hwInfo = pDevice->getHardwareInfo(); hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_B, hwInfo); @@ -616,7 +616,7 @@ XE_HPC_CORETEST_F(EncodeKernelXeHpcCoreTest, givenNumberOfThreadsInThreadGroupAn using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA; DebugManagerStateRestore restorer; DebugManager.flags.AdjustThreadGroupDispatchSize.set(0); - const auto &productHelper = *ProductHelper::get(productFamily); + const auto &productHelper = pDevice->getProductHelper(); auto hwInfo = pDevice->getHardwareInfo(); hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_B, hwInfo); @@ -639,7 +639,7 @@ XE_HPC_CORETEST_F(EncodeKernelXeHpcCoreTest, givenNumberOfThreadsInThreadGroupAn XE_HPC_CORETEST_F(EncodeKernelXeHpcCoreTest, givenIndivisibleDispatchSizeWhenCallingAdjustInterfaceDescriptorDataThenThreadGroupDispatchSizeIsCorrectlySet) { using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA; - const auto &productHelper = *ProductHelper::get(productFamily); + const auto &productHelper = pDevice->getProductHelper(); auto hwInfo = pDevice->getHardwareInfo(); hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_B, hwInfo); @@ -656,7 +656,7 @@ XE_HPC_CORETEST_F(EncodeKernelXeHpcCoreTest, givenIndivisibleDispatchSizeWhenCal XE_HPC_CORETEST_F(EncodeKernelXeHpcCoreTest, givenThreadGroupCountZeroWhenCallingAdjustInterfaceDescriptorDataThenThreadGroupDispatchSizeIsSetToDefault) { using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA; - const auto &productHelper = *ProductHelper::get(productFamily); + const auto &productHelper = pDevice->getProductHelper(); auto hwInfo = pDevice->getHardwareInfo(); hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_B, hwInfo); diff --git a/shared/test/unit_test/xe_hpg_core/compute_mode_tests_xe_hpg_core.cpp b/shared/test/unit_test/xe_hpg_core/compute_mode_tests_xe_hpg_core.cpp index 98df8b6340..6d0d173743 100644 --- a/shared/test/unit_test/xe_hpg_core/compute_mode_tests_xe_hpg_core.cpp +++ b/shared/test/unit_test/xe_hpg_core/compute_mode_tests_xe_hpg_core.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2022 Intel Corporation + * Copyright (C) 2021-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -24,7 +24,7 @@ XE_HPG_CORETEST_F(ComputeModeRequirementsXeHpgCore, GivenVariousSettingsWhenComp using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE; using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; - const auto &productHelper = *ProductHelper::get(productFamily); + const auto &productHelper = this->device->getProductHelper(); const auto &[isBasicWARequired, isExtendedWARequired] = productHelper.isPipeControlPriorToNonPipelinedStateCommandsWARequired(*defaultHwInfo, csr->isRcs()); std::ignore = isExtendedWARequired; diff --git a/shared/test/unit_test/xe_hpg_core/dg2/hw_helper_tests_dg2.cpp b/shared/test/unit_test/xe_hpg_core/dg2/hw_helper_tests_dg2.cpp index f864e778a6..2289886a25 100644 --- a/shared/test/unit_test/xe_hpg_core/dg2/hw_helper_tests_dg2.cpp +++ b/shared/test/unit_test/xe_hpg_core/dg2/hw_helper_tests_dg2.cpp @@ -34,14 +34,16 @@ DG2TEST_F(GfxCoreHelperTestDg2, whenGetExtensionsIsCalledThenMatrixMultiplyAccum DG2TEST_F(GfxCoreHelperTestDg2, givenRcsDisabledWhenGetGpgpuEnginesCalledThenDontSetRcs) { HardwareInfo hwInfo = *defaultHwInfo; - auto productHelper = ProductHelper::get(productFamily); + MockExecutionEnvironment mockExecutionEnvironment{}; + + auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper(); hwInfo.featureTable.flags.ftrCCSNode = true; hwInfo.featureTable.ftrBcsInfo = 1; hwInfo.featureTable.flags.ftrRcsNode = true; hwInfo.capabilityTable.blitterOperationsSupported = true; hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS; hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4; - productHelper->configureHardwareCustom(&hwInfo, nullptr); + productHelper.configureHardwareCustom(&hwInfo, nullptr); auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo, 0)); auto &gfxCoreHelper = device->getGfxCoreHelper(); diff --git a/shared/test/unit_test/xe_hpg_core/dg2/hw_info_config_tests_dg2.cpp b/shared/test/unit_test/xe_hpg_core/dg2/hw_info_config_tests_dg2.cpp index 3c9c59162d..5761c85056 100644 --- a/shared/test/unit_test/xe_hpg_core/dg2/hw_info_config_tests_dg2.cpp +++ b/shared/test/unit_test/xe_hpg_core/dg2/hw_info_config_tests_dg2.cpp @@ -6,13 +6,14 @@ */ #include "shared/source/command_stream/stream_properties.h" +#include "shared/source/execution_environment/execution_environment.h" +#include "shared/source/execution_environment/root_device_environment.h" #include "shared/source/helpers/constants.h" #include "shared/source/helpers/hw_helper.h" #include "shared/source/os_interface/hw_info_config.h" #include "shared/test/common/fixtures/device_fixture.h" #include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/default_hw_info.h" -#include "shared/test/common/mocks/mock_device.h" #include "shared/test/common/test_macros/test.h" #include "shared/test/common/xe_hpg_core/dg2/product_configs_dg2.h" #include "shared/test/unit_test/fixtures/product_config_fixture.h" @@ -22,12 +23,9 @@ using namespace NEO; -using ProductHelperTestDg2 = Test; -using ProductHelperTestDg2 = Test; +using ProductHelperTestDg2 = ProductHelperTest; -using Dg2HwInfo = ProductHelperTest; - -DG2TEST_F(Dg2HwInfo, whenGettingAubstreamProductFamilyThenProperEnumValueIsReturned) { +DG2TEST_F(ProductHelperTestDg2, whenGettingAubstreamProductFamilyThenProperEnumValueIsReturned) { EXPECT_EQ(aub_stream::ProductFamily::Dg2, productHelper->getAubStreamProductFamily()); } @@ -56,149 +54,140 @@ DG2TEST_F(ProductHelperTestDg2, givenDg2ConfigWhenSetupHardwareInfoThenGtSystemI } DG2TEST_F(ProductHelperTestDg2, givenG10DevIdWhenAdditionalKernelExecInfoSupportCheckedThenCorrectValueIsReturned) { - auto &productHelper = *ProductHelper::get(defaultHwInfo->platform.eProductFamily); HardwareInfo myHwInfo = *defaultHwInfo; myHwInfo.platform.usDeviceID = dg2G10DeviceIds[0]; - EXPECT_FALSE(productHelper.isDisableOverdispatchAvailable(myHwInfo)); + EXPECT_FALSE(productHelper->isDisableOverdispatchAvailable(myHwInfo)); FrontEndPropertiesSupport fePropertiesSupport{}; - productHelper.fillFrontEndPropertiesSupportStructure(fePropertiesSupport, myHwInfo); + productHelper->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, myHwInfo); EXPECT_FALSE(fePropertiesSupport.disableOverdispatch); - myHwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_B, myHwInfo); - EXPECT_TRUE(productHelper.isDisableOverdispatchAvailable(myHwInfo)); + myHwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(REVISION_B, myHwInfo); + EXPECT_TRUE(productHelper->isDisableOverdispatchAvailable(myHwInfo)); - productHelper.fillFrontEndPropertiesSupportStructure(fePropertiesSupport, myHwInfo); + productHelper->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, myHwInfo); EXPECT_TRUE(fePropertiesSupport.disableOverdispatch); } DG2TEST_F(ProductHelperTestDg2, givenG11DevIdWhenIsDisableOverdispatchAvailableCalledThenTrueReturnedForAllSteppings) { FrontEndPropertiesSupport fePropertiesSupport{}; - auto &productHelper = *ProductHelper::get(defaultHwInfo->platform.eProductFamily); HardwareInfo myHwInfo = *defaultHwInfo; myHwInfo.platform.usDeviceID = dg2G11DeviceIds[0]; - myHwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_A0, myHwInfo); - EXPECT_TRUE(productHelper.isDisableOverdispatchAvailable(myHwInfo)); - productHelper.fillFrontEndPropertiesSupportStructure(fePropertiesSupport, myHwInfo); + myHwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(REVISION_A0, myHwInfo); + EXPECT_TRUE(productHelper->isDisableOverdispatchAvailable(myHwInfo)); + productHelper->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, myHwInfo); EXPECT_TRUE(fePropertiesSupport.disableOverdispatch); - myHwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_B, myHwInfo); - EXPECT_TRUE(productHelper.isDisableOverdispatchAvailable(myHwInfo)); - productHelper.fillFrontEndPropertiesSupportStructure(fePropertiesSupport, myHwInfo); + myHwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(REVISION_B, myHwInfo); + EXPECT_TRUE(productHelper->isDisableOverdispatchAvailable(myHwInfo)); + productHelper->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, myHwInfo); EXPECT_TRUE(fePropertiesSupport.disableOverdispatch); - myHwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_C, myHwInfo); - EXPECT_TRUE(productHelper.isDisableOverdispatchAvailable(myHwInfo)); - productHelper.fillFrontEndPropertiesSupportStructure(fePropertiesSupport, myHwInfo); + myHwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(REVISION_C, myHwInfo); + EXPECT_TRUE(productHelper->isDisableOverdispatchAvailable(myHwInfo)); + productHelper->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, myHwInfo); EXPECT_TRUE(fePropertiesSupport.disableOverdispatch); } DG2TEST_F(ProductHelperTestDg2, givenG12DevIdWhenIsDisableOverdispatchAvailableCalledThenTrueReturnedForAllSteppings) { FrontEndPropertiesSupport fePropertiesSupport{}; - auto &productHelper = *ProductHelper::get(defaultHwInfo->platform.eProductFamily); HardwareInfo myHwInfo = *defaultHwInfo; myHwInfo.platform.usDeviceID = dg2G12DeviceIds[0]; - myHwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_A0, myHwInfo); - EXPECT_TRUE(productHelper.isDisableOverdispatchAvailable(myHwInfo)); - productHelper.fillFrontEndPropertiesSupportStructure(fePropertiesSupport, myHwInfo); + myHwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(REVISION_A0, myHwInfo); + EXPECT_TRUE(productHelper->isDisableOverdispatchAvailable(myHwInfo)); + productHelper->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, myHwInfo); EXPECT_TRUE(fePropertiesSupport.disableOverdispatch); - myHwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_B, myHwInfo); - EXPECT_TRUE(productHelper.isDisableOverdispatchAvailable(myHwInfo)); - productHelper.fillFrontEndPropertiesSupportStructure(fePropertiesSupport, myHwInfo); + myHwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(REVISION_B, myHwInfo); + EXPECT_TRUE(productHelper->isDisableOverdispatchAvailable(myHwInfo)); + productHelper->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, myHwInfo); EXPECT_TRUE(fePropertiesSupport.disableOverdispatch); - myHwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(REVISION_C, myHwInfo); - EXPECT_TRUE(productHelper.isDisableOverdispatchAvailable(myHwInfo)); - productHelper.fillFrontEndPropertiesSupportStructure(fePropertiesSupport, myHwInfo); + myHwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(REVISION_C, myHwInfo); + EXPECT_TRUE(productHelper->isDisableOverdispatchAvailable(myHwInfo)); + productHelper->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, myHwInfo); EXPECT_TRUE(fePropertiesSupport.disableOverdispatch); } DG2TEST_F(ProductHelperTestDg2, whenAdjustingDefaultEngineTypeThenSelectEngineTypeBasedOnRevisionId) { auto hwInfo = *defaultHwInfo; hwInfo.featureTable.flags.ftrCCSNode = true; - - auto &gfxCoreHelper = getHelper(); - auto &productHelper = getHelper(); + auto &gfxCoreHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); for (uint8_t revision : {REVISION_A0, REVISION_A1, REVISION_B, REVISION_C}) { for (auto deviceId : {dg2G10DeviceIds[0], dg2G11DeviceIds[0], dg2G12DeviceIds[0]}) { - hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(revision, hwInfo); + hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(revision, hwInfo); hwInfo.platform.usDeviceID = deviceId; hwInfo.capabilityTable.defaultEngineType = defaultHwInfo->capabilityTable.defaultEngineType; gfxCoreHelper.adjustDefaultEngineType(&hwInfo); if (DG2::isG10(hwInfo) && revision < REVISION_B) { EXPECT_EQ(aub_stream::ENGINE_RCS, hwInfo.capabilityTable.defaultEngineType); } else { - EXPECT_EQ(aub_stream::ENGINE_CCS, hardwareInfo.capabilityTable.defaultEngineType); + EXPECT_EQ(aub_stream::ENGINE_CCS, defaultHwInfo->capabilityTable.defaultEngineType); } } } } DG2TEST_F(ProductHelperTestDg2, givenDg2G11OrG12WhenAskingIfMaxThreadsForWorkgroupWAIsRequiredThenReturnFalse) { - auto &productHelper = getHelper(); auto hwInfo = *defaultHwInfo; for (uint8_t revision : {REVISION_A0, REVISION_A1, REVISION_B, REVISION_C}) { for (auto deviceId : {dg2G11DeviceIds[0], dg2G12DeviceIds[0]}) { - hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(revision, hwInfo); + hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(revision, hwInfo); hwInfo.platform.usDeviceID = deviceId; - EXPECT_FALSE(productHelper.isMaxThreadsForWorkgroupWARequired(hwInfo)); + EXPECT_FALSE(productHelper->isMaxThreadsForWorkgroupWARequired(hwInfo)); } } } DG2TEST_F(ProductHelperTestDg2, givenDg2G10A0OrA1SteppingWhenAskingIfWAIsRequiredThenReturnTrue) { - auto &productHelper = getHelper(); + auto hwInfo = *defaultHwInfo; for (uint8_t revision : {REVISION_A0, REVISION_A1, REVISION_B, REVISION_C}) { for (auto deviceId : {dg2G10DeviceIds[0], dg2G11DeviceIds[0], dg2G12DeviceIds[0]}) { - hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(revision, hwInfo); + hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(revision, hwInfo); hwInfo.platform.usDeviceID = deviceId; auto expectedValue = DG2::isG10(hwInfo) && revision < REVISION_B; - EXPECT_EQ(expectedValue, productHelper.isDefaultEngineTypeAdjustmentRequired(hwInfo)); - EXPECT_EQ(expectedValue, productHelper.isAllocationSizeAdjustmentRequired(hwInfo)); - EXPECT_EQ(expectedValue, productHelper.isPrefetchDisablingRequired(hwInfo)); + EXPECT_EQ(expectedValue, productHelper->isDefaultEngineTypeAdjustmentRequired(hwInfo)); + EXPECT_EQ(expectedValue, productHelper->isAllocationSizeAdjustmentRequired(hwInfo)); + EXPECT_EQ(expectedValue, productHelper->isPrefetchDisablingRequired(hwInfo)); } } } DG2TEST_F(ProductHelperTestDg2, givenDg2G10WhenAskingForSBAWaThenReturnSuccessOnlyForBStepping) { - auto &productHelper = getHelper(); auto hwInfo = *defaultHwInfo; for (uint8_t revision : {REVISION_A0, REVISION_A1, REVISION_B, REVISION_C}) { - hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(revision, hwInfo); + hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(revision, hwInfo); hwInfo.platform.usDeviceID = dg2G10DeviceIds[0]; auto expectedValue = revision == REVISION_B; - EXPECT_EQ(expectedValue, productHelper.isAdditionalStateBaseAddressWARequired(hwInfo)); + EXPECT_EQ(expectedValue, productHelper->isAdditionalStateBaseAddressWARequired(hwInfo)); } } DG2TEST_F(ProductHelperTestDg2, givenDg2G11WhenAskingForSBAWaThenReturnSuccess) { - auto &productHelper = getHelper(); auto hwInfo = *defaultHwInfo; for (uint8_t revision : {REVISION_A0, REVISION_A1, REVISION_B, REVISION_C}) { - hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(revision, hwInfo); + hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(revision, hwInfo); hwInfo.platform.usDeviceID = dg2G11DeviceIds[0]; - EXPECT_TRUE(productHelper.isAdditionalStateBaseAddressWARequired(hwInfo)); + EXPECT_TRUE(productHelper->isAdditionalStateBaseAddressWARequired(hwInfo)); } } DG2TEST_F(ProductHelperTestDg2, givenDg2G12WhenAskingForSBAWaThenReturnSuccess) { - auto &productHelper = getHelper(); auto hwInfo = *defaultHwInfo; for (uint8_t revision : {REVISION_A0, REVISION_A1, REVISION_B, REVISION_C}) { - hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(revision, hwInfo); + hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(revision, hwInfo); hwInfo.platform.usDeviceID = dg2G12DeviceIds[0]; - EXPECT_FALSE(productHelper.isAdditionalStateBaseAddressWARequired(hwInfo)); + EXPECT_FALSE(productHelper->isAdditionalStateBaseAddressWARequired(hwInfo)); } } @@ -206,11 +195,10 @@ DG2TEST_F(ProductHelperTestDg2, givenProgramExtendedPipeControlPriorToNonPipelin DebugManagerStateRestore restorer; DebugManager.flags.ProgramExtendedPipeControlPriorToNonPipelinedStateCommand.set(true); - const auto &productHelper = *ProductHelper::get(productFamily); auto hwInfo = *defaultHwInfo; auto isRcs = false; - const auto &[isBasicWARequired, isExtendedWARequired] = productHelper.isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs); + const auto &[isBasicWARequired, isExtendedWARequired] = productHelper->isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs); EXPECT_TRUE(isExtendedWARequired); EXPECT_TRUE(isBasicWARequired); @@ -220,11 +208,10 @@ DG2TEST_F(ProductHelperTestDg2, givenProgramExtendedPipeControlPriorToNonPipelin DebugManagerStateRestore restorer; DebugManager.flags.ProgramExtendedPipeControlPriorToNonPipelinedStateCommand.set(true); - const auto &productHelper = *ProductHelper::get(productFamily); auto hwInfo = *defaultHwInfo; auto isRcs = true; - const auto &[isBasicWARequired, isExtendedWARequired] = productHelper.isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs); + const auto &[isBasicWARequired, isExtendedWARequired] = productHelper->isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs); EXPECT_TRUE(isExtendedWARequired); EXPECT_TRUE(isBasicWARequired); @@ -234,76 +221,75 @@ DG2TEST_F(ProductHelperTestDg2, givenProgramPipeControlPriorToNonPipelinedStateC DebugManagerStateRestore restorer; DebugManager.flags.ProgramExtendedPipeControlPriorToNonPipelinedStateCommand.set(0); - const auto &productHelper = *ProductHelper::get(productFamily); auto hwInfo = *defaultHwInfo; auto isRcs = true; - const auto &[isBasicWARequired, isExtendedWARequired] = productHelper.isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs); + const auto &[isBasicWARequired, isExtendedWARequired] = productHelper->isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs); EXPECT_FALSE(isExtendedWARequired); EXPECT_TRUE(isBasicWARequired); } DG2TEST_F(ProductHelperTestDg2, givenProductHelperWithMultipleCSSWhenIsPipeControlPriorToNonPipelinedStateCommandsWARequiredIsCalledOnCcsThenTrueIsReturned) { - const auto &productHelper = *ProductHelper::get(productFamily); + auto hwInfo = *defaultHwInfo; hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 2; auto isRcs = false; - const auto &[isBasicWARequired, isExtendedWARequired] = productHelper.isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs); + const auto &[isBasicWARequired, isExtendedWARequired] = productHelper->isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs); EXPECT_TRUE(isExtendedWARequired); EXPECT_TRUE(isBasicWARequired); } DG2TEST_F(ProductHelperTestDg2, givenProductHelperWithMultipleCSSWhenIsPipeControlPriorToNonPipelinedStateCommandsWARequiredIsCalledOnRcsThenFalseIsReturned) { - const auto &productHelper = *ProductHelper::get(productFamily); + auto hwInfo = *defaultHwInfo; hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 2; auto isRcs = true; - const auto &[isBasicWARequired, isExtendedWARequired] = productHelper.isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs); + const auto &[isBasicWARequired, isExtendedWARequired] = productHelper->isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs); EXPECT_FALSE(isExtendedWARequired); EXPECT_TRUE(isBasicWARequired); } DG2TEST_F(ProductHelperTestDg2, givenProductHelperWithSingleCSSWhenIsPipeControlPriorToNonPipelinedStateCommandsWARequiredIsCalledOnCcsThenTrueIsReturned) { - const auto &productHelper = *ProductHelper::get(productFamily); + auto hwInfo = *defaultHwInfo; hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 1; auto isRcs = false; - const auto &[isBasicWARequired, isExtendedWARequired] = productHelper.isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs); + const auto &[isBasicWARequired, isExtendedWARequired] = productHelper->isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs); EXPECT_FALSE(isExtendedWARequired); EXPECT_TRUE(isBasicWARequired); } DG2TEST_F(ProductHelperTestDg2, givenProductHelperWithSingleCSSWhenIsPipeControlPriorToNonPipelinedStateCommandsWARequiredIsCalledOnRcsThenTrueIsReturned) { - const auto &productHelper = *ProductHelper::get(productFamily); + auto hwInfo = *defaultHwInfo; hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 1; auto isRcs = true; - const auto &[isBasicWARequired, isExtendedWARequired] = productHelper.isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs); + const auto &[isBasicWARequired, isExtendedWARequired] = productHelper->isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs); EXPECT_FALSE(isExtendedWARequired); EXPECT_TRUE(isBasicWARequired); } DG2TEST_F(ProductHelperTestDg2, givenDg2WhenIsBlitterForImagesSupportedIsCalledThenTrueIsReturned) { - const auto &productHelper = *ProductHelper::get(productFamily); - EXPECT_TRUE(productHelper.isBlitterForImagesSupported()); + + EXPECT_TRUE(productHelper->isBlitterForImagesSupported()); } DG2TEST_F(ProductHelperTestDg2, WhenGetSvmCpuAlignmentThenProperValueIsReturned) { - const auto &productHelper = *ProductHelper::get(productFamily); - EXPECT_EQ(MemoryConstants::pageSize2Mb, productHelper.getSvmCpuAlignment()); + + EXPECT_EQ(MemoryConstants::pageSize2Mb, productHelper->getSvmCpuAlignment()); } DG2TEST_F(ProductHelperTestDg2, givenB0rCSteppingWhenAskingIfTile64With3DSurfaceOnBCSIsSupportedThenReturnTrue) { - auto &productHelper = getHelper(); + std::array, 4> revisions = { {{REVISION_A0, false}, {REVISION_A1, false}, @@ -312,73 +298,69 @@ DG2TEST_F(ProductHelperTestDg2, givenB0rCSteppingWhenAskingIfTile64With3DSurface for (const auto &[revision, paramBool] : revisions) { auto hwInfo = *defaultHwInfo; - hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(revision, hwInfo); + hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(revision, hwInfo); - productHelper.configureHardwareCustom(&hwInfo, nullptr); + productHelper->configureHardwareCustom(&hwInfo, nullptr); - EXPECT_EQ(paramBool, productHelper.isTile64With3DSurfaceOnBCSSupported(hwInfo)); + EXPECT_EQ(paramBool, productHelper->isTile64With3DSurfaceOnBCSSupported(hwInfo)); } } DG2TEST_F(ProductHelperTestDg2, givenDg2G10A0WhenConfigureCalledThenDisableCompression) { - auto &productHelper = getHelper(); for (uint8_t revision : {REVISION_A0, REVISION_A1}) { for (auto deviceId : {dg2G10DeviceIds[0], dg2G11DeviceIds[0], dg2G12DeviceIds[0]}) { HardwareInfo hwInfo = *defaultHwInfo; hwInfo.featureTable.flags.ftrE2ECompression = true; - hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(revision, hwInfo); + hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(revision, hwInfo); hwInfo.platform.usDeviceID = deviceId; - productHelper.configureHardwareCustom(&hwInfo, nullptr); + productHelper->configureHardwareCustom(&hwInfo, nullptr); auto compressionExpected = DG2::isG10(hwInfo) ? (revision != REVISION_A0) : true; EXPECT_EQ(compressionExpected, hwInfo.capabilityTable.ftrRenderCompressedBuffers); EXPECT_EQ(compressionExpected, hwInfo.capabilityTable.ftrRenderCompressedImages); - EXPECT_EQ(compressionExpected, productHelper.allowCompression(hwInfo)); + EXPECT_EQ(compressionExpected, productHelper->allowCompression(hwInfo)); } } } DG2TEST_F(ProductHelperTestDg2, givenDg2G10WhenAskingForTile64For3dSurfaceOnBcsSupportThenReturnSuccessOnlyForCStepping) { - auto &productHelper = getHelper(); for (uint8_t revision : {REVISION_A0, REVISION_A1, REVISION_B, REVISION_C}) { HardwareInfo hwInfo = *defaultHwInfo; - hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(revision, hwInfo); + hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(revision, hwInfo); hwInfo.platform.usDeviceID = dg2G10DeviceIds[0]; auto expectedValue = revision == REVISION_C; - EXPECT_EQ(expectedValue, productHelper.isTile64With3DSurfaceOnBCSSupported(hwInfo)); + EXPECT_EQ(expectedValue, productHelper->isTile64With3DSurfaceOnBCSSupported(hwInfo)); } } DG2TEST_F(ProductHelperTestDg2, givenDg2G11WhenAskingForTile64For3dSurfaceOnBcsSupportThenReturnSuccessOnlyForHigherThanAStepping) { - auto &productHelper = getHelper(); for (uint8_t revision : {REVISION_A0, REVISION_A1, REVISION_B, REVISION_C}) { HardwareInfo hwInfo = *defaultHwInfo; - hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(revision, hwInfo); + hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(revision, hwInfo); hwInfo.platform.usDeviceID = dg2G11DeviceIds[0]; auto expectedValue = revision >= REVISION_B; - EXPECT_EQ(expectedValue, productHelper.isTile64With3DSurfaceOnBCSSupported(hwInfo)); + EXPECT_EQ(expectedValue, productHelper->isTile64With3DSurfaceOnBCSSupported(hwInfo)); } } DG2TEST_F(ProductHelperTestDg2, givenDg2G12WhenAskingForTile64For3dSurfaceOnBcsSupportThenReturnSuccess) { - auto &productHelper = getHelper(); for (uint8_t revision : {REVISION_A0, REVISION_A1, REVISION_B, REVISION_C}) { HardwareInfo hwInfo = *defaultHwInfo; - hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(revision, hwInfo); + hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(revision, hwInfo); hwInfo.platform.usDeviceID = dg2G12DeviceIds[0]; - EXPECT_TRUE(productHelper.isTile64With3DSurfaceOnBCSSupported(hwInfo)); + EXPECT_TRUE(productHelper->isTile64With3DSurfaceOnBCSSupported(hwInfo)); } } @@ -392,52 +374,51 @@ DG2TEST_F(ProductHelperTestDg2, givenRevisionEnumAndPlatformFamilyTypeThenProper }; auto hardwareInfo = *defaultHwInfo; - const auto &productHelper = getHelper(); for (auto stepping : steppings) { - hardwareInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(stepping, hardwareInfo); + hardwareInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(stepping, hardwareInfo); if (stepping <= REVISION_B) { if (stepping == REVISION_A0) { - EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_A1, hardwareInfo, productHelper)); - EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo, productHelper)); - EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_C, hardwareInfo, productHelper)); - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A1, REVISION_B, hardwareInfo, productHelper)); - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A1, REVISION_C, hardwareInfo, productHelper)); - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_B, REVISION_C, hardwareInfo, productHelper)); + EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_A1, hardwareInfo, *productHelper)); + EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo, *productHelper)); + EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_C, hardwareInfo, *productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A1, REVISION_B, hardwareInfo, *productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A1, REVISION_C, hardwareInfo, *productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_B, REVISION_C, hardwareInfo, *productHelper)); } else if (stepping == REVISION_A1) { - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_A1, hardwareInfo, productHelper)); - EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo, productHelper)); - EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_C, hardwareInfo, productHelper)); - EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A1, REVISION_B, hardwareInfo, productHelper)); - EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A1, REVISION_C, hardwareInfo, productHelper)); - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_B, REVISION_C, hardwareInfo, productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_A1, hardwareInfo, *productHelper)); + EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo, *productHelper)); + EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_C, hardwareInfo, *productHelper)); + EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A1, REVISION_B, hardwareInfo, *productHelper)); + EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A1, REVISION_C, hardwareInfo, *productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_B, REVISION_C, hardwareInfo, *productHelper)); } else { // REVISION_B - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_A1, hardwareInfo, productHelper)); - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo, productHelper)); - EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_C, hardwareInfo, productHelper)); - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A1, REVISION_B, hardwareInfo, productHelper)); - EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A1, REVISION_C, hardwareInfo, productHelper)); - EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_B, REVISION_C, hardwareInfo, productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_A1, hardwareInfo, *productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo, *productHelper)); + EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_C, hardwareInfo, *productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A1, REVISION_B, hardwareInfo, *productHelper)); + EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A1, REVISION_C, hardwareInfo, *productHelper)); + EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_B, REVISION_C, hardwareInfo, *productHelper)); } } else { - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_A1, hardwareInfo, productHelper)); - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo, productHelper)); - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_C, hardwareInfo, productHelper)); - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A1, REVISION_B, hardwareInfo, productHelper)); - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A1, REVISION_C, hardwareInfo, productHelper)); - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_B, REVISION_C, hardwareInfo, productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_A1, hardwareInfo, *productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo, *productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_C, hardwareInfo, *productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A1, REVISION_B, hardwareInfo, *productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A1, REVISION_C, hardwareInfo, *productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_B, REVISION_C, hardwareInfo, *productHelper)); } - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A1, REVISION_A0, hardwareInfo, productHelper)); - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_B, REVISION_A0, hardwareInfo, productHelper)); - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_C, REVISION_A0, hardwareInfo, productHelper)); - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_B, REVISION_A1, hardwareInfo, productHelper)); - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_C, REVISION_A1, hardwareInfo, productHelper)); - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_C, REVISION_B, hardwareInfo, productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A1, REVISION_A0, hardwareInfo, *productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_B, REVISION_A0, hardwareInfo, *productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_C, REVISION_A0, hardwareInfo, *productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_B, REVISION_A1, hardwareInfo, *productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_C, REVISION_A1, hardwareInfo, *productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_C, REVISION_B, hardwareInfo, *productHelper)); - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_D, hardwareInfo, productHelper)); - EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_D, REVISION_A0, hardwareInfo, productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_D, hardwareInfo, *productHelper)); + EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_D, REVISION_A0, hardwareInfo, *productHelper)); } } @@ -451,15 +432,14 @@ DG2TEST_F(ProductHelperTestDg2, givenRevisionEnumAndDisableL3CacheForDebugCalled }; auto hardwareInfo = *defaultHwInfo; - const auto &gfxCoreHelper = getHelper(); - const auto &productHelper = getHelper(); + const auto &gfxCoreHelper = this->executionEnvironment->rootDeviceEnvironments[0]->getHelper(); for (auto stepping : steppings) { - hardwareInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(stepping, hardwareInfo); + hardwareInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(stepping, hardwareInfo); if (stepping < REVISION_B) { - EXPECT_TRUE(gfxCoreHelper.disableL3CacheForDebug(hardwareInfo, productHelper)); + EXPECT_TRUE(gfxCoreHelper.disableL3CacheForDebug(hardwareInfo, *productHelper)); } else { - EXPECT_FALSE(gfxCoreHelper.disableL3CacheForDebug(hardwareInfo, productHelper)); + EXPECT_FALSE(gfxCoreHelper.disableL3CacheForDebug(hardwareInfo, *productHelper)); } } } @@ -467,8 +447,6 @@ DG2TEST_F(ProductHelperTestDg2, givenRevisionEnumAndDisableL3CacheForDebugCalled DG2TEST_F(ProductHelperTestDg2, givenDg2WhenSetForceNonCoherentThenProperFlagSet) { using FORCE_NON_COHERENT = typename FamilyType::STATE_COMPUTE_MODE::FORCE_NON_COHERENT; - auto productHelper = ProductHelper::get(productFamily); - auto stateComputeMode = FamilyType::cmdInitStateComputeMode; auto properties = StateComputeModeProperties{}; @@ -484,7 +462,7 @@ DG2TEST_F(ProductHelperTestDg2, givenDg2WhenSetForceNonCoherentThenProperFlagSet } DG2TEST_F(ProductHelperTestDg2, givenEnabledSliceInNonStandardConfigWhenComputeUnitsUsedForScratchThenProperCalculationIsReturned) { - HardwareInfo &hwInfo = *pDevice->getRootDeviceEnvironment().getMutableHardwareInfo(); + HardwareInfo &hwInfo = *executionEnvironment->rootDeviceEnvironments[0]->getMutableHardwareInfo(); GT_SYSTEM_INFO &testSysInfo = hwInfo.gtSystemInfo; testSysInfo.IsDynamicallyPopulated = true; for (int i = 0; i < GT_MAX_SLICE; i++) { @@ -496,29 +474,29 @@ DG2TEST_F(ProductHelperTestDg2, givenEnabledSliceInNonStandardConfigWhenComputeU auto subSlicesPerSlice = testSysInfo.MaxSubSlicesSupported / testSysInfo.MaxSlicesSupported; auto maxSubSlice = highestEnabledSlice * subSlicesPerSlice; - auto &gfxCoreHelper = getHelper(); + auto &gfxCoreHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); uint32_t expectedCalculation = maxSubSlice * testSysInfo.MaxEuPerSubSlice * (testSysInfo.ThreadCount / testSysInfo.EUCount); - EXPECT_EQ(expectedCalculation, gfxCoreHelper.getComputeUnitsUsedForScratch(pDevice->getRootDeviceEnvironment())); + EXPECT_EQ(expectedCalculation, gfxCoreHelper.getComputeUnitsUsedForScratch(*executionEnvironment->rootDeviceEnvironments[0])); } DG2TEST_F(ProductHelperTestDg2, givenNotEnabledSliceWhenComputeUnitsUsedForScratchThenThrowUnrecoverableIf) { - HardwareInfo &hwInfo = *pDevice->getRootDeviceEnvironment().getMutableHardwareInfo(); + HardwareInfo &hwInfo = *executionEnvironment->rootDeviceEnvironments[0]->getMutableHardwareInfo(); GT_SYSTEM_INFO &testSysInfo = hwInfo.gtSystemInfo; testSysInfo.IsDynamicallyPopulated = true; for (int i = 0; i < GT_MAX_SLICE; i++) { testSysInfo.SliceInfo[i].Enabled = false; } - auto &gfxCoreHelper = getHelper(); + auto &gfxCoreHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); - EXPECT_THROW(gfxCoreHelper.getComputeUnitsUsedForScratch(pDevice->getRootDeviceEnvironment()), std::exception); + EXPECT_THROW(gfxCoreHelper.getComputeUnitsUsedForScratch(*executionEnvironment->rootDeviceEnvironments[0]), std::exception); } DG2TEST_F(ProductHelperTestDg2, givenDG2WhenCheckingIsTimestampWaitSupportedForEventsThenReturnTrue) { - auto &helper = getHelper(); - EXPECT_TRUE(helper.isTimestampWaitSupportedForEvents()); + + EXPECT_TRUE(productHelper->isTimestampWaitSupportedForEvents()); } DG2TEST_F(ProductConfigTests, givenDg2G10DeviceIdsWhenConfigIsCheckedThenCorrectValueIsReturned) { @@ -627,7 +605,6 @@ DG2TEST_F(ProductConfigTests, givenNotSetDeviceAndRevisionIdWhenGetProductConfig } DG2TEST_F(ProductHelperTestDg2, givenProductHelperWhenAskedIfStorageInfoAdjustmentIsRequiredThenTrueIsReturned) { - auto productHelper = ProductHelper::get(defaultHwInfo->platform.eProductFamily); if constexpr (is32bit) { EXPECT_TRUE(productHelper->isStorageInfoAdjustmentRequired()); } else { @@ -636,14 +613,12 @@ DG2TEST_F(ProductHelperTestDg2, givenProductHelperWhenAskedIfStorageInfoAdjustme } DG2TEST_F(ProductHelperTestDg2, givenProductHelperWhenGettingEvictIfNecessaryFlagSupportedThenExpectTrue) { - HardwareInfo hwInfo = *defaultHwInfo; - const auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily); - EXPECT_TRUE(productHelper.isEvictionIfNecessaryFlagSupported()); + + EXPECT_TRUE(productHelper->isEvictionIfNecessaryFlagSupported()); } DG2TEST_F(ProductHelperTestDg2, givenDebugFlagWhenCheckingIsResolveDependenciesByPipeControlsSupportedThenCorrectValueIsReturned) { DebugManagerStateRestore restorer; - auto productHelper = ProductHelper::get(defaultHwInfo->platform.eProductFamily); // ResolveDependenciesViaPipeControls = -1 (default) EXPECT_TRUE(productHelper->isResolveDependenciesByPipeControlsSupported(*defaultHwInfo, false)); @@ -659,7 +634,6 @@ DG2TEST_F(ProductHelperTestDg2, givenDebugFlagWhenCheckingIsResolveDependenciesB } DG2TEST_F(ProductHelperTestDg2, givenProductHelperWhenCheckingIsBufferPoolAllocatorSupportedThenCorrectValueIsReturned) { - auto productHelper = ProductHelper::get(defaultHwInfo->platform.eProductFamily); EXPECT_TRUE(productHelper->isBufferPoolAllocatorSupported()); } diff --git a/shared/test/unit_test/xe_hpg_core/dg2/test_hw_helper_dg2.cpp b/shared/test/unit_test/xe_hpg_core/dg2/test_hw_helper_dg2.cpp index 7c44d2eeb2..5513c10c58 100644 --- a/shared/test/unit_test/xe_hpg_core/dg2/test_hw_helper_dg2.cpp +++ b/shared/test/unit_test/xe_hpg_core/dg2/test_hw_helper_dg2.cpp @@ -24,7 +24,7 @@ DG2TEST_F(GfxCoreHelperTestDg2, GivenDifferentSteppingWhenComputeSlmSizeIsCalled MockExecutionEnvironment mockExecutionEnvironment{}; auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper(); - const auto &productHelper = *ProductHelper::get(productFamily); + const auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper(); auto hwInfo = *mockExecutionEnvironment.rootDeviceEnvironments[0]->getMutableHardwareInfo(); for (auto revision : revisions) { diff --git a/shared/test/unit_test/xe_hpg_core/mtl/hw_helper_tests_mtl.cpp b/shared/test/unit_test/xe_hpg_core/mtl/hw_helper_tests_mtl.cpp index bcf57e4fc0..cb8b785c27 100644 --- a/shared/test/unit_test/xe_hpg_core/mtl/hw_helper_tests_mtl.cpp +++ b/shared/test/unit_test/xe_hpg_core/mtl/hw_helper_tests_mtl.cpp @@ -40,7 +40,7 @@ using ProductHelperTestMtl = Test; MTLTEST_F(ProductHelperTestMtl, givenMtlWhenCallIsAdjustWalkOrderAvailableThenReturnProperValue) { VariableBackup backupHwInfo(defaultHwInfo.get()); - const auto &productHelper = *ProductHelper::get(defaultHwInfo->platform.eProductFamily); + const auto &productHelper = getHelper(); unsigned int gmdReleases[] = {70, 71, 72, 73}; defaultHwInfo->ipVersion.architecture = 12; @@ -132,13 +132,13 @@ MTLTEST_F(ProductHelperTestMtl, givenMultitileConfigWhenConfiguringHwInfoThenEna MTLTEST_F(GfxCoreHelperTestMtl, givenMtlWhenSetForceNonCoherentThenNothingChanged) { using FORCE_NON_COHERENT = typename FamilyType::STATE_COMPUTE_MODE::FORCE_NON_COHERENT; - auto productHelper = ProductHelper::get(productFamily); + auto &productHelper = getHelper(); auto stateComputeMode = FamilyType::cmdInitStateComputeMode; auto properties = StateComputeModeProperties{}; properties.isCoherencyRequired.set(true); - productHelper->setForceNonCoherent(&stateComputeMode, properties); + productHelper.setForceNonCoherent(&stateComputeMode, properties); EXPECT_EQ(FORCE_NON_COHERENT::FORCE_NON_COHERENT_FORCE_DISABLED, stateComputeMode.getForceNonCoherent()); EXPECT_EQ(0u, stateComputeMode.getMaskBits()); } diff --git a/shared/test/unit_test/xe_hpg_core/mtl/sampler_tests_mtl.cpp b/shared/test/unit_test/xe_hpg_core/mtl/sampler_tests_mtl.cpp index ed8b4292cc..cd4de6e4b8 100644 --- a/shared/test/unit_test/xe_hpg_core/mtl/sampler_tests_mtl.cpp +++ b/shared/test/unit_test/xe_hpg_core/mtl/sampler_tests_mtl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Intel Corporation + * Copyright (C) 2022-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -9,6 +9,7 @@ #include "shared/source/os_interface/hw_info_config.h" #include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/default_hw_info.h" +#include "shared/test/common/mocks/mock_execution_environment.h" #include "shared/test/common/test_macros/hw_test.h" #include @@ -20,9 +21,12 @@ using SamplerTestMtl = ::testing::Test; HWTEST2_F(SamplerTestMtl, givenMtlSamplerWhenUsingDefaultFilteringAndAppendSamplerStateParamsThenDisableLowQualityFilter, IsMTL) { EXPECT_FALSE(DebugManager.flags.ForceSamplerLowFilteringPrecision.get()); typedef typename FamilyType::SAMPLER_STATE SAMPLER_STATE; + + MockExecutionEnvironment mockExecutionEnvironment{}; auto state = FamilyType::cmdInitSamplerState; EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter()); - ProductHelper::get(defaultHwInfo->platform.eProductFamily)->adjustSamplerState(&state, *defaultHwInfo); + auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper(); + productHelper.adjustSamplerState(&state, *defaultHwInfo); EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter()); } @@ -30,9 +34,12 @@ HWTEST2_F(SamplerTestMtl, giveMtlSamplerWhenForcingLowQualityFilteringAndAppendS DebugManagerStateRestore dbgRestore; DebugManager.flags.ForceSamplerLowFilteringPrecision.set(true); EXPECT_TRUE(DebugManager.flags.ForceSamplerLowFilteringPrecision.get()); + + MockExecutionEnvironment mockExecutionEnvironment{}; typedef typename FamilyType::SAMPLER_STATE SAMPLER_STATE; auto state = FamilyType::cmdInitSamplerState; EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter()); - ProductHelper::get(defaultHwInfo->platform.eProductFamily)->adjustSamplerState(&state, *defaultHwInfo); + auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper(); + productHelper.adjustSamplerState(&state, *defaultHwInfo); EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_ENABLE, state.getLowQualityFilter()); }