diff --git a/level_zero/core/test/unit_tests/xe_hpg_core/dg2/test_cmdqueue_dg2.cpp b/level_zero/core/test/unit_tests/xe_hpg_core/dg2/test_cmdqueue_dg2.cpp index 441efd8903..f77be515d5 100644 --- a/level_zero/core/test/unit_tests/xe_hpg_core/dg2/test_cmdqueue_dg2.cpp +++ b/level_zero/core/test/unit_tests/xe_hpg_core/dg2/test_cmdqueue_dg2.cpp @@ -18,7 +18,7 @@ namespace L0 { namespace ult { using CommandQueueTestDG2 = Test; -HWTEST2_F(CommandQueueTestDG2, givenBindlessEnabledWhenEstimateStateBaseAddressCmdSizeCalledOnDG2ThenReturnedSizeOf2SBAAndPCAnd3DBindingTablePoolPool, IsDG2) { +HWTEST2_F(CommandQueueTestDG2, givenBindlessEnabledWhenEstimateStateBaseAddressCmdSizeCalledOnDG2ThenReturnedSizeOfSBAAndPCAnd3DBindingTablePoolPool, IsDG2) { DebugManagerStateRestore restorer; DebugManager.flags.UseBindlessMode.set(1); using GfxFamily = typename NEO::GfxFamilyMapper::GfxFamily; @@ -29,7 +29,15 @@ HWTEST2_F(CommandQueueTestDG2, givenBindlessEnabledWhenEstimateStateBaseAddressC auto csr = std::unique_ptr(neoDevice->createCommandStreamReceiver()); auto commandQueue = std::make_unique>(device, csr.get(), &desc); auto size = commandQueue->estimateStateBaseAddressCmdSize(); - auto expectedSize = 2 * sizeof(STATE_BASE_ADDRESS) + sizeof(PIPE_CONTROL) + sizeof(_3DSTATE_BINDING_TABLE_POOL_ALLOC); + auto expectedSize = sizeof(STATE_BASE_ADDRESS) + sizeof(PIPE_CONTROL) + sizeof(_3DSTATE_BINDING_TABLE_POOL_ALLOC); + + auto &productHelper = neoDevice->getProductHelper(); + auto &hwInfo = neoDevice->getHardwareInfo(); + + if (productHelper.isAdditionalStateBaseAddressWARequired(hwInfo)) { + expectedSize += sizeof(STATE_BASE_ADDRESS); + } + EXPECT_EQ(size, expectedSize); } diff --git a/shared/source/xe_hpg_core/dg2/os_agnostic_hw_info_config_dg2.inl b/shared/source/xe_hpg_core/dg2/os_agnostic_hw_info_config_dg2.inl index d8432b27f9..ff74ebea5a 100644 --- a/shared/source/xe_hpg_core/dg2/os_agnostic_hw_info_config_dg2.inl +++ b/shared/source/xe_hpg_core/dg2/os_agnostic_hw_info_config_dg2.inl @@ -72,12 +72,13 @@ bool ProductHelperHw::isDirectSubmissionSupported(const HardwareInfo template <> bool ProductHelperHw::isAdditionalStateBaseAddressWARequired(const HardwareInfo &hwInfo) const { - uint32_t stepping = getSteppingFromHwRevId(hwInfo); - if (stepping <= REVISION_B) { + if (DG2::isG10(hwInfo) && GfxCoreHelper::isWorkaroundRequired(REVISION_B, REVISION_C, hwInfo, *this)) { return true; - } else { - return false; } + if (DG2::isG11(hwInfo)) { + return true; + } + return false; } template <> diff --git a/shared/test/unit_test/encoders/command_encoder_tests_dg2.cpp b/shared/test/unit_test/encoders/command_encoder_tests_dg2.cpp index 942b608c3d..236d42513c 100644 --- a/shared/test/unit_test/encoders/command_encoder_tests_dg2.cpp +++ b/shared/test/unit_test/encoders/command_encoder_tests_dg2.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2022 Intel Corporation + * Copyright (C) 2021-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -31,15 +31,37 @@ HWTEST2_F(DG2CommandEncoderTest, givenDG2WhenGettingRequiredSizeForStateBaseAddr auto container = MockCommandContainer(); container.clearHeaps(); - size_t size = EncodeStateBaseAddress::getRequiredSizeForStateBaseAddress(*pDevice, container, false); - EXPECT_EQ(size, 176ul); + + auto &hwInfo = *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[0]->getMutableHardwareInfo(); + + auto &productHelper = pDevice->getProductHelper(); + for (uint8_t revision : {REVISION_A0, REVISION_A1, REVISION_B, REVISION_C}) { + hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(revision, hwInfo); + auto expectedSize = 88ull; + if (productHelper.isAdditionalStateBaseAddressWARequired(hwInfo)) { + expectedSize += sizeof(typename FamilyType::STATE_BASE_ADDRESS); + } + size_t size = EncodeStateBaseAddress::getRequiredSizeForStateBaseAddress(*pDevice, container, false); + EXPECT_EQ(size, expectedSize); + } } HWTEST2_F(DG2CommandEncoderTest, givenDG2AndCommandContainerWithDirtyHeapWhenGettingRequiredSizeForStateBaseAddressCommandThenCorrectSizeIsReturned, IsDG2) { auto container = CommandContainer(); container.setHeapDirty(HeapType::SURFACE_STATE); - size_t size = EncodeStateBaseAddress::getRequiredSizeForStateBaseAddress(*pDevice, container, false); - EXPECT_EQ(size, 192ul); + + auto &hwInfo = *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[0]->getMutableHardwareInfo(); + + auto &productHelper = pDevice->getProductHelper(); + for (uint8_t revision : {REVISION_A0, REVISION_A1, REVISION_B, REVISION_C}) { + hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(revision, hwInfo); + auto expectedSize = 104ull; + if (productHelper.isAdditionalStateBaseAddressWARequired(hwInfo)) { + expectedSize += sizeof(typename FamilyType::STATE_BASE_ADDRESS); + } + size_t size = EncodeStateBaseAddress::getRequiredSizeForStateBaseAddress(*pDevice, container, false); + EXPECT_EQ(size, expectedSize); + } } HWTEST2_F(DG2CommandEncoderTest, givenInterfaceDescriptorDataWhenForceThreadGroupDispatchSizeVariableIsDefaultThenThreadGroupDispatchSizeIsNotChanged, IsDG2) { 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 46f2af4e14..27b1164a75 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 @@ -158,8 +158,6 @@ DG2TEST_F(ProductHelperTestDg2, givenDg2G10A0OrA1SteppingWhenAskingIfWAIsRequire hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(revision, hwInfo); hwInfo.platform.usDeviceID = deviceId; - productHelper.configureHardwareCustom(&hwInfo, nullptr); - auto expectedValue = DG2::isG10(hwInfo) && revision < REVISION_B; EXPECT_EQ(expectedValue, productHelper.isDefaultEngineTypeAdjustmentRequired(hwInfo)); @@ -169,6 +167,40 @@ DG2TEST_F(ProductHelperTestDg2, givenDg2G10A0OrA1SteppingWhenAskingIfWAIsRequire } } +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.usDeviceID = dg2G10DeviceIds[0]; + + auto expectedValue = revision == REVISION_B; + 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.usDeviceID = dg2G11DeviceIds[0]; + + 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.usDeviceID = dg2G12DeviceIds[0]; + + EXPECT_FALSE(productHelper.isAdditionalStateBaseAddressWARequired(hwInfo)); + } +} + DG2TEST_F(ProductHelperTestDg2, givenProgramExtendedPipeControlPriorToNonPipelinedStateCommandEnabledWhenIsPipeControlPriorToNonPipelinedStateCommandsWARequiredIsCalledOnCcsThenTrueIsReturned) { DebugManagerStateRestore restorer; DebugManager.flags.ProgramExtendedPipeControlPriorToNonPipelinedStateCommand.set(true);