diff --git a/level_zero/core/source/cmdlist/cmdlist_hw.inl b/level_zero/core/source/cmdlist/cmdlist_hw.inl index 0afc9b72f1..a7ab14af2e 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw.inl @@ -2402,7 +2402,7 @@ inline bool getFusedEuDisabled(Kernel &kernel, Device *device, const ze_group_co bool fusedEuDisabled = kernelAttributes.flags.requiresDisabledEUFusion; auto &productHelper = device->getProductHelper(); - if (productHelper.isCalculationForDisablingEuFusionWithDpasNeeded()) { + if (productHelper.isCalculationForDisablingEuFusionWithDpasNeeded(device->getHwInfo())) { if (threadGroupDimensions) { uint32_t *groupCountPtr = nullptr; uint32_t groupCount[3] = {}; @@ -2412,7 +2412,7 @@ inline bool getFusedEuDisabled(Kernel &kernel, Device *device, const ze_group_co groupCount[2] = threadGroupDimensions->groupCountZ; groupCountPtr = groupCount; } - fusedEuDisabled |= productHelper.isFusedEuDisabledForDpas(kernelAttributes.flags.usesSystolicPipelineSelectMode, kernel.getGroupSize(), groupCountPtr); + fusedEuDisabled |= productHelper.isFusedEuDisabledForDpas(kernelAttributes.flags.usesSystolicPipelineSelectMode, kernel.getGroupSize(), groupCountPtr, device->getHwInfo()); } } return fusedEuDisabled; diff --git a/opencl/source/command_queue/enqueue_common.h b/opencl/source/command_queue/enqueue_common.h index 4e156107ef..1e8b128473 100644 --- a/opencl/source/command_queue/enqueue_common.h +++ b/opencl/source/command_queue/enqueue_common.h @@ -857,7 +857,7 @@ CompletionStamp CommandQueueHw::enqueueNonBlocked( uint32_t lws[3] = {static_cast(multiDispatchInfo.begin()->getLocalWorkgroupSize().x), static_cast(multiDispatchInfo.begin()->getLocalWorkgroupSize().y), static_cast(multiDispatchInfo.begin()->getLocalWorkgroupSize().z)}; uint32_t groupCount[3] = {static_cast(multiDispatchInfo.begin()->getNumberOfWorkgroups().x), static_cast(multiDispatchInfo.begin()->getNumberOfWorkgroups().y), static_cast(multiDispatchInfo.begin()->getNumberOfWorkgroups().z)}; dispatchFlags.disableEUFusion = kernel->getKernelInfo().kernelDescriptor.kernelAttributes.flags.requiresDisabledEUFusion || - device->getProductHelper().isFusedEuDisabledForDpas(systolicPipelineSelectMode, lws, groupCount); + device->getProductHelper().isFusedEuDisabledForDpas(systolicPipelineSelectMode, lws, groupCount, this->getDevice().getHardwareInfo()); const bool isHandlingBarrier = isStallingCommandsOnNextFlushRequired(); diff --git a/shared/source/os_interface/hw_info_config.h b/shared/source/os_interface/hw_info_config.h index dceead91fa..fb649662b5 100644 --- a/shared/source/os_interface/hw_info_config.h +++ b/shared/source/os_interface/hw_info_config.h @@ -197,8 +197,8 @@ class ProductHelper { virtual uint32_t getDefaultRevisionId() const = 0; virtual bool isMultiContextResourceDeferDeletionSupported() const = 0; - virtual bool isFusedEuDisabledForDpas(bool kernelHasDpasInstructions, const uint32_t *lws, const uint32_t *groupCount) const = 0; - virtual bool isCalculationForDisablingEuFusionWithDpasNeeded() const = 0; + virtual bool isFusedEuDisabledForDpas(bool kernelHasDpasInstructions, const uint32_t *lws, const uint32_t *groupCount, const HardwareInfo &hwInfo) const = 0; + virtual bool isCalculationForDisablingEuFusionWithDpasNeeded(const HardwareInfo &hwInfo) const = 0; virtual uint32_t getNumberOfPartsInTileForConcurrentKernel() const = 0; virtual bool is48bResourceNeededForRayTracing() const = 0; diff --git a/shared/source/os_interface/hw_info_config.inl b/shared/source/os_interface/hw_info_config.inl index df7d2fd9e2..9bfb1a2295 100644 --- a/shared/source/os_interface/hw_info_config.inl +++ b/shared/source/os_interface/hw_info_config.inl @@ -725,12 +725,12 @@ bool ProductHelperHw::isMultiContextResourceDeferDeletionSupported() } template -bool ProductHelperHw::isFusedEuDisabledForDpas(bool kernelHasDpasInstructions, const uint32_t *lws, const uint32_t *groupCount) const { +bool ProductHelperHw::isFusedEuDisabledForDpas(bool kernelHasDpasInstructions, const uint32_t *lws, const uint32_t *groupCount, const HardwareInfo &hwInfo) const { return false; } template -bool ProductHelperHw::isCalculationForDisablingEuFusionWithDpasNeeded() const { +bool ProductHelperHw::isCalculationForDisablingEuFusionWithDpasNeeded(const HardwareInfo &hwInfo) const { return false; } diff --git a/shared/source/os_interface/product_helper_hw.h b/shared/source/os_interface/product_helper_hw.h index 5ecb2de3ae..8a6edc0d70 100644 --- a/shared/source/os_interface/product_helper_hw.h +++ b/shared/source/os_interface/product_helper_hw.h @@ -157,8 +157,8 @@ class ProductHelperHw : public ProductHelper { uint32_t getDefaultRevisionId() const override; bool isMultiContextResourceDeferDeletionSupported() const override; - bool isFusedEuDisabledForDpas(bool kernelHasDpasInstructions, const uint32_t *lws, const uint32_t *groupCount) const override; - bool isCalculationForDisablingEuFusionWithDpasNeeded() const override; + bool isFusedEuDisabledForDpas(bool kernelHasDpasInstructions, const uint32_t *lws, const uint32_t *groupCount, const HardwareInfo &hwInfo) const override; + bool isCalculationForDisablingEuFusionWithDpasNeeded(const HardwareInfo &hwInfo) const override; bool is48bResourceNeededForRayTracing() const override; ~ProductHelperHw() override = default; diff --git a/shared/source/xe_hpg_core/dg2/os_agnostic_product_helper_dg2.inl b/shared/source/xe_hpg_core/dg2/os_agnostic_product_helper_dg2.inl index 5128551391..97c075315a 100644 --- a/shared/source/xe_hpg_core/dg2/os_agnostic_product_helper_dg2.inl +++ b/shared/source/xe_hpg_core/dg2/os_agnostic_product_helper_dg2.inl @@ -233,8 +233,9 @@ std::optional ProductHelperHw::getAubStre return aub_stream::ProductFamily::Dg2; }; template <> -bool ProductHelperHw::isFusedEuDisabledForDpas(bool kernelHasDpasInstructions, const uint32_t *lws, const uint32_t *groupCount) const { - if (!kernelHasDpasInstructions) { +bool ProductHelperHw::isFusedEuDisabledForDpas(bool kernelHasDpasInstructions, const uint32_t *lws, const uint32_t *groupCount, const HardwareInfo &hwInfo) const { + auto isAcm = DG2::isG10(hwInfo) || DG2::isG11(hwInfo) || DG2::isG12(hwInfo); + if (!kernelHasDpasInstructions || !isAcm) { return false; } else if (lws == nullptr) { return true; @@ -250,8 +251,8 @@ bool ProductHelperHw::isFusedEuDisabledForDpas(bool kernelHasDpasIns } template <> -bool ProductHelperHw::isCalculationForDisablingEuFusionWithDpasNeeded() const { - return true; +bool ProductHelperHw::isCalculationForDisablingEuFusionWithDpasNeeded(const HardwareInfo &hwInfo) const { + return DG2::isG10(hwInfo) || DG2::isG11(hwInfo) || DG2::isG12(hwInfo); } template <> bool ProductHelperHw::isDummyBlitWaRequired() const { diff --git a/shared/test/unit_test/helpers/gfx_core_helper_tests.cpp b/shared/test/unit_test/helpers/gfx_core_helper_tests.cpp index 9a2cfa7102..8b5729c1c5 100644 --- a/shared/test/unit_test/helpers/gfx_core_helper_tests.cpp +++ b/shared/test/unit_test/helpers/gfx_core_helper_tests.cpp @@ -1468,12 +1468,14 @@ HWTEST_F(ProductHelperCommonTest, givenPatIndexAndAllocationTypeWhenCallOverride EXPECT_EQ(patIndex, gfxCoreHelper.overridePatIndex(allocationType, patIndex)); } HWTEST_F(ProductHelperCommonTest, givenHwHelperWhenIsFusedEuDisabledForDpasCalledThenFalseReturned) { + auto hwInfo = *defaultHwInfo; auto &gfxCoreHelper = getHelper(); - EXPECT_FALSE(gfxCoreHelper.isFusedEuDisabledForDpas(true, nullptr, nullptr)); + EXPECT_FALSE(gfxCoreHelper.isFusedEuDisabledForDpas(true, nullptr, nullptr, hwInfo)); } HWTEST_F(ProductHelperCommonTest, givenProductHelperWhenCallingIsCalculationForDisablingEuFusionWithDpasNeededThenFalseReturned) { + auto hwInfo = *defaultHwInfo; auto &gfxCoreHelper = getHelper(); - EXPECT_FALSE(gfxCoreHelper.isCalculationForDisablingEuFusionWithDpasNeeded()); + EXPECT_FALSE(gfxCoreHelper.isCalculationForDisablingEuFusionWithDpasNeeded(hwInfo)); } HWTEST_F(GfxCoreHelperTest, GivenCooperativeEngineSupportedAndNotUsedWhenAdjustMaxWorkGroupCountIsCalledThenSmallerValueIsReturned) { diff --git a/shared/test/unit_test/xe_hpg_core/dg2/product_config_helper_tests_dg2.cpp b/shared/test/unit_test/xe_hpg_core/dg2/product_config_helper_tests_dg2.cpp index 08f486ee31..24ca1e0555 100644 --- a/shared/test/unit_test/xe_hpg_core/dg2/product_config_helper_tests_dg2.cpp +++ b/shared/test/unit_test/xe_hpg_core/dg2/product_config_helper_tests_dg2.cpp @@ -42,51 +42,105 @@ DG2TEST_F(ProductConfigHelperDg2Tests, givenXeHpgReleaseWhenSearchForDeviceAcron EXPECT_TRUE(std::any_of(aotInfos.begin(), aotInfos.end(), ProductConfigHelper::findDeviceAcronymForRelease(AOT::XE_HPG_RELEASE))); } DG2TEST_F(ProductHelperTestDg2, givenNoDpasInstructionInKernelHelperWhenCheckingIfEuFusionShouldBeDisabledThenFalseReturned) { + HardwareInfo hwInfo = *defaultHwInfo; const uint32_t lws[3] = {1, 1, 1}; const uint32_t groupCount[3] = {5, 3, 1}; bool dpasInstruction = false; - EXPECT_FALSE(productHelper->isFusedEuDisabledForDpas(dpasInstruction, lws, groupCount)); + EXPECT_FALSE(productHelper->isFusedEuDisabledForDpas(dpasInstruction, lws, groupCount, hwInfo)); } -DG2TEST_F(ProductHelperTestDg2, givenDpasInstructionLwsAndGroupCountIsNullPtrInKernelHelperWhenCheckingIfEuFusionShouldBeDisabledThenTrueReturned) { - bool dpasInstruction = true; - EXPECT_TRUE(productHelper->isFusedEuDisabledForDpas(dpasInstruction, nullptr, nullptr)); -} -DG2TEST_F(ProductHelperTestDg2, givenDpasInstructionLwsIsNullPtrInKernelHelperWhenCheckingIfEuFusionShouldBeDisabledThenTrueReturned) { + +DG2TEST_F(ProductHelperTestDg2, givenDpasInstructionAndG10Dg2DeviceWhenCheckingIfEuFusionShouldBeDisabledThenTrueReturned) { + HardwareInfo hwInfo = *defaultHwInfo; + hwInfo.platform.usDeviceID = *dg2G10DeviceIds.begin(); bool dpasInstruction = true; const uint32_t groupCount[3] = {5, 3, 1}; - EXPECT_TRUE(productHelper->isFusedEuDisabledForDpas(dpasInstruction, nullptr, groupCount)); + EXPECT_TRUE(productHelper->isFusedEuDisabledForDpas(dpasInstruction, nullptr, groupCount, hwInfo)); +} +DG2TEST_F(ProductHelperTestDg2, givenDpasInstructionAndG11Dg2DeviceWhenCheckingIfEuFusionShouldBeDisabledThenTrueReturned) { + HardwareInfo hwInfo = *defaultHwInfo; + hwInfo.platform.usDeviceID = *dg2G11DeviceIds.begin(); + bool dpasInstruction = true; + const uint32_t groupCount[3] = {5, 3, 1}; + EXPECT_TRUE(productHelper->isFusedEuDisabledForDpas(dpasInstruction, nullptr, groupCount, hwInfo)); +} +DG2TEST_F(ProductHelperTestDg2, givenDpasInstructionAndG12Dg2DeviceWhenCheckingIfEuFusionShouldBeDisabledThenTrueReturned) { + HardwareInfo hwInfo = *defaultHwInfo; + hwInfo.platform.usDeviceID = *dg2G12DeviceIds.begin(); + bool dpasInstruction = true; + const uint32_t groupCount[3] = {5, 3, 1}; + EXPECT_TRUE(productHelper->isFusedEuDisabledForDpas(dpasInstruction, nullptr, groupCount, hwInfo)); +} +DG2TEST_F(ProductHelperTestDg2, givenDpasInstructionAndNotAcmDeviceWhenCheckingIfEuFusionShouldBeDisabledThenFalseReturned) { + HardwareInfo hwInfo = *defaultHwInfo; + hwInfo.platform.usDeviceID = 0x1234; + bool dpasInstruction = true; + const uint32_t groupCount[3] = {5, 3, 1}; + EXPECT_FALSE(productHelper->isFusedEuDisabledForDpas(dpasInstruction, nullptr, groupCount, hwInfo)); +} +DG2TEST_F(ProductHelperTestDg2, givenDpasInstructionLwsAndGroupCountIsNullPtrInKernelHelperWhenCheckingIfEuFusionShouldBeDisabledThenTrueReturned) { + HardwareInfo hwInfo = *defaultHwInfo; + bool dpasInstruction = true; + EXPECT_TRUE(productHelper->isFusedEuDisabledForDpas(dpasInstruction, nullptr, nullptr, hwInfo)); +} +DG2TEST_F(ProductHelperTestDg2, givenDpasInstructionLwsIsNullPtrInKernelHelperWhenCheckingIfEuFusionShouldBeDisabledThenTrueReturned) { + HardwareInfo hwInfo = *defaultHwInfo; + bool dpasInstruction = true; + const uint32_t groupCount[3] = {5, 3, 1}; + EXPECT_TRUE(productHelper->isFusedEuDisabledForDpas(dpasInstruction, nullptr, groupCount, hwInfo)); } DG2TEST_F(ProductHelperTestDg2, givenDpasInstructionGroupCountIsNullPtrInKernelHelperWhenCheckingIfEuFusionShouldBeDisabledThenTrueReturned) { + HardwareInfo hwInfo = *defaultHwInfo; bool dpasInstruction = true; const uint32_t lws[3] = {1, 1, 1}; - EXPECT_TRUE(productHelper->isFusedEuDisabledForDpas(dpasInstruction, lws, nullptr)); + EXPECT_TRUE(productHelper->isFusedEuDisabledForDpas(dpasInstruction, lws, nullptr, hwInfo)); } DG2TEST_F(ProductHelperTestDg2, givenDpasInstructionLwsAndLwsIsOddWhenCheckingIfEuFusionShouldBeDisabledThenTrueReturned) { + HardwareInfo hwInfo = *defaultHwInfo; const uint32_t lws[3] = {7, 3, 1}; const uint32_t groupCount[3] = {2, 1, 1}; bool dpasInstruction = true; - EXPECT_TRUE(productHelper->isFusedEuDisabledForDpas(dpasInstruction, lws, groupCount)); + EXPECT_TRUE(productHelper->isFusedEuDisabledForDpas(dpasInstruction, lws, groupCount, hwInfo)); } DG2TEST_F(ProductHelperTestDg2, givenDpasInstructionLwsAndLwsIsNoOddWhenCheckingIfEuFusionShouldBeDisabledThenFalseReturned) { + HardwareInfo hwInfo = *defaultHwInfo; const uint32_t lws[3] = {8, 3, 1}; const uint32_t groupCount[3] = {2, 1, 1}; bool dpasInstruction = true; - EXPECT_FALSE(productHelper->isFusedEuDisabledForDpas(dpasInstruction, lws, groupCount)); + EXPECT_FALSE(productHelper->isFusedEuDisabledForDpas(dpasInstruction, lws, groupCount, hwInfo)); } DG2TEST_F(ProductHelperTestDg2, givenDpasInstructionLwsAndLwsIsOneAndXGroupCountIsOddWhenCheckingIfEuFusionShouldBeDisabledThenFalseReturned) { + HardwareInfo hwInfo = *defaultHwInfo; const uint32_t lws[3] = {1, 1, 1}; const uint32_t groupCount[3] = {5, 1, 1}; bool dpasInstruction = true; - EXPECT_TRUE(productHelper->isFusedEuDisabledForDpas(dpasInstruction, lws, groupCount)); + EXPECT_TRUE(productHelper->isFusedEuDisabledForDpas(dpasInstruction, lws, groupCount, hwInfo)); } DG2TEST_F(ProductHelperTestDg2, givenDpasInstructionLwsAndLwsIsOneAndXGroupCountIsNoOddWhenCheckingIfEuFusionShouldBeDisabledThenFalseReturned) { + HardwareInfo hwInfo = *defaultHwInfo; const uint32_t lws[3] = {1, 1, 1}; const uint32_t groupCount[3] = {4, 1, 1}; bool dpasInstruction = true; - EXPECT_FALSE(productHelper->isFusedEuDisabledForDpas(dpasInstruction, lws, groupCount)); + EXPECT_FALSE(productHelper->isFusedEuDisabledForDpas(dpasInstruction, lws, groupCount, hwInfo)); } -DG2TEST_F(ProductHelperTestDg2, givenDg2ProductHelperWhenCallingIsCalculationForDisablingEuFusionWithDpasNeededThenTrueReturned) { - EXPECT_TRUE(productHelper->isCalculationForDisablingEuFusionWithDpasNeeded()); +DG2TEST_F(ProductHelperTestDg2, givenG10Dg2ProductHelperWhenCallingIsCalculationForDisablingEuFusionWithDpasNeededThenTrueReturned) { + HardwareInfo hwInfo = *defaultHwInfo; + hwInfo.platform.usDeviceID = *dg2G10DeviceIds.begin(); + EXPECT_TRUE(productHelper->isCalculationForDisablingEuFusionWithDpasNeeded(hwInfo)); +} +DG2TEST_F(ProductHelperTestDg2, givenG11Dg2ProductHelperWhenCallingIsCalculationForDisablingEuFusionWithDpasNeededThenTrueReturned) { + HardwareInfo hwInfo = *defaultHwInfo; + hwInfo.platform.usDeviceID = *dg2G11DeviceIds.begin(); + EXPECT_TRUE(productHelper->isCalculationForDisablingEuFusionWithDpasNeeded(hwInfo)); +} +DG2TEST_F(ProductHelperTestDg2, givenG12Dg2ProductHelperWhenCallingIsCalculationForDisablingEuFusionWithDpasNeededThenTrueReturned) { + HardwareInfo hwInfo = *defaultHwInfo; + hwInfo.platform.usDeviceID = *dg2G12DeviceIds.begin(); + EXPECT_TRUE(productHelper->isCalculationForDisablingEuFusionWithDpasNeeded(hwInfo)); +} +DG2TEST_F(ProductHelperTestDg2, givenNotACMProductHelperWhenCallingIsCalculationForDisablingEuFusionWithDpasNeededThenFalseReturned) { + HardwareInfo hwInfo = *defaultHwInfo; + hwInfo.platform.usDeviceID = 0x1234; + EXPECT_FALSE(productHelper->isCalculationForDisablingEuFusionWithDpasNeeded(hwInfo)); } DG2TEST_F(ProductHelperTestDg2, whenGettingAubstreamProductFamilyThenProperEnumValueIsReturned) {