From f5045348ad5b764791732ad134d427f2a0bc1480 Mon Sep 17 00:00:00 2001 From: Aravind Gopalakrishnan Date: Tue, 19 Dec 2023 06:28:01 +0000 Subject: [PATCH] fix: Report correct DP support for platforms Related-To: NEO-9702 - Remove older interfaces and add new release helper Signed-off-by: Aravind Gopalakrishnan --- level_zero/core/source/device/device_imp.cpp | 6 ++++-- .../gen12lp/test_device_gen12lp.cpp | 2 +- .../source/helpers/compiler_product_helper.h | 2 ++ .../helpers/compiler_product_helper_base.inl | 9 +++++++++ shared/source/os_interface/product_helper.h | 2 -- shared/source/os_interface/product_helper.inl | 10 ---------- .../source/os_interface/product_helper_hw.h | 2 -- shared/source/release_helper/release_helper.h | 2 ++ .../release_helper/release_helper_1270.cpp | 5 +++++ .../release_helper/release_helper_1271.cpp | 5 +++++ .../release_helper/release_helper_base.inl | 4 ++++ ...os_agnostic_product_helper_xe_hpc_core.inl | 10 ---------- .../os_agnostic_product_helper_xe_lpg.inl | 10 ---------- .../test/common/mocks/mock_product_helper.cpp | 10 ---------- .../test/common/mocks/mock_release_helper.h | 1 + .../helpers/compiler_product_helper_tests.cpp | 19 +++++++++++++++++++ .../os_interface/product_helper_tests.cpp | 6 ------ .../release_helper_12_71_tests.cpp | 1 + .../gfx_core_helper_xe_hpc_core_tests.cpp | 10 ---------- ...s_agnostic_product_helper_xe_lpg_tests.cpp | 8 -------- 20 files changed, 53 insertions(+), 71 deletions(-) diff --git a/level_zero/core/source/device/device_imp.cpp b/level_zero/core/source/device/device_imp.cpp index af89ab1bfa..aef9ce7037 100644 --- a/level_zero/core/source/device/device_imp.cpp +++ b/level_zero/core/source/device/device_imp.cpp @@ -828,11 +828,13 @@ ze_result_t DeviceImp::getKernelProperties(ze_device_module_properties_t *pKerne ze_intel_device_module_dp_exp_properties_t *dpProperties = reinterpret_cast(extendedProperties); dpProperties->flags = 0u; - if (productHelper.isPlatformDp4aSupported()) { + if (compilerProductHelper.isDotAccumulateSupported()) { dpProperties->flags |= ZE_INTEL_DEVICE_MODULE_EXP_FLAG_DP4A; } - if (productHelper.isPlatformDpasSupported()) { + auto &rootDeviceEnvironment = neoDevice->getRootDeviceEnvironment(); + auto releaseHelper = rootDeviceEnvironment.getReleaseHelper(); + if (compilerProductHelper.isDotProductAccumulateSystolicSupported(releaseHelper)) { dpProperties->flags |= ZE_INTEL_DEVICE_MODULE_EXP_FLAG_DPAS; } } diff --git a/level_zero/core/test/unit_tests/gen12lp/test_device_gen12lp.cpp b/level_zero/core/test/unit_tests/gen12lp/test_device_gen12lp.cpp index 0eb5e75f73..7829f5585a 100644 --- a/level_zero/core/test/unit_tests/gen12lp/test_device_gen12lp.cpp +++ b/level_zero/core/test/unit_tests/gen12lp/test_device_gen12lp.cpp @@ -40,7 +40,7 @@ HWTEST2_F(DeviceFixtureGen12LP, GivenTargetGen12LPWhenGettingDpSupportThenReturn bool dp4a = moduleDpProps.flags & ZE_INTEL_DEVICE_MODULE_EXP_FLAG_DP4A; bool dpas = moduleDpProps.flags & ZE_INTEL_DEVICE_MODULE_EXP_FLAG_DPAS; EXPECT_TRUE(dp4a); - EXPECT_TRUE(dpas); + EXPECT_FALSE(dpas); } using CommandQueueGroupTest = Test; diff --git a/shared/source/helpers/compiler_product_helper.h b/shared/source/helpers/compiler_product_helper.h index 03b3f9e78f..d301f4fc27 100644 --- a/shared/source/helpers/compiler_product_helper.h +++ b/shared/source/helpers/compiler_product_helper.h @@ -60,6 +60,7 @@ class CompilerProductHelper { virtual bool isBFloat16ConversionSupported(const ReleaseHelper *releaseHelper) const = 0; virtual bool isSubgroupLocalBlockIoSupported() const = 0; virtual bool isDotAccumulateSupported() const = 0; + virtual bool isDotProductAccumulateSystolicSupported(const ReleaseHelper *releaseHelper) const = 0; virtual bool isCreateBufferWithPropertiesSupported() const = 0; virtual bool isSubgroupNamedBarrierSupported() const = 0; virtual bool isSubgroupExtendedBlockReadSupported() const = 0; @@ -101,6 +102,7 @@ class CompilerProductHelperHw : public CompilerProductHelper { bool isBFloat16ConversionSupported(const ReleaseHelper *releaseHelper) const override; bool isSubgroupLocalBlockIoSupported() const override; bool isDotAccumulateSupported() const override; + bool isDotProductAccumulateSystolicSupported(const ReleaseHelper *releaseHelper) const override; bool isCreateBufferWithPropertiesSupported() const override; bool isSubgroupNamedBarrierSupported() const override; bool isSubgroupExtendedBlockReadSupported() const override; diff --git a/shared/source/helpers/compiler_product_helper_base.inl b/shared/source/helpers/compiler_product_helper_base.inl index 564cafce4c..415713cf13 100644 --- a/shared/source/helpers/compiler_product_helper_base.inl +++ b/shared/source/helpers/compiler_product_helper_base.inl @@ -248,6 +248,15 @@ bool CompilerProductHelperHw::isMatrixMultiplyAccumulateSupported(co return false; } +template +bool CompilerProductHelperHw::isDotProductAccumulateSystolicSupported(const ReleaseHelper *releaseHelper) const { + if (releaseHelper) { + return releaseHelper->isDotProductAccumulateSystolicSupported(); + } + + return false; +} + template bool CompilerProductHelperHw::isSplitMatrixMultiplyAccumulateSupported(const ReleaseHelper *releaseHelper) const { if (releaseHelper) { diff --git a/shared/source/os_interface/product_helper.h b/shared/source/os_interface/product_helper.h index 56fb2e526f..86cbae4a14 100644 --- a/shared/source/os_interface/product_helper.h +++ b/shared/source/os_interface/product_helper.h @@ -167,8 +167,6 @@ class ProductHelper { virtual uint32_t getMaxNumSamplers() const = 0; virtual uint32_t getCommandBuffersPreallocatedPerCommandQueue() const = 0; virtual uint32_t getInternalHeapsPreallocated() const = 0; - virtual bool isPlatformDpasSupported() const = 0; - virtual bool isPlatformDp4aSupported() const = 0; virtual bool overrideAllocationCacheable(const AllocationData &allocationData) const = 0; virtual bool getFrontEndPropertyScratchSizeSupport() const = 0; diff --git a/shared/source/os_interface/product_helper.inl b/shared/source/os_interface/product_helper.inl index 41d3d0a164..421f938b53 100644 --- a/shared/source/os_interface/product_helper.inl +++ b/shared/source/os_interface/product_helper.inl @@ -166,16 +166,6 @@ uint64_t ProductHelperHw::getDeviceMemoryMaxBandWidthInBytesPerSecon return 0; } -template -bool ProductHelperHw::isPlatformDpasSupported() const { - return false; -} - -template -bool ProductHelperHw::isPlatformDp4aSupported() const { - return false; -} - template bool ProductHelperHw::overrideAllocationCacheable(const AllocationData &allocationData) const { return false; diff --git a/shared/source/os_interface/product_helper_hw.h b/shared/source/os_interface/product_helper_hw.h index 565d23158b..4158581fe7 100644 --- a/shared/source/os_interface/product_helper_hw.h +++ b/shared/source/os_interface/product_helper_hw.h @@ -120,8 +120,6 @@ class ProductHelperHw : public ProductHelper { uint32_t getMaxNumSamplers() const override; uint32_t getCommandBuffersPreallocatedPerCommandQueue() const override; uint32_t getInternalHeapsPreallocated() const override; - bool isPlatformDpasSupported() const override; - bool isPlatformDp4aSupported() const override; bool overrideAllocationCacheable(const AllocationData &allocationData) const override; bool getFrontEndPropertyScratchSizeSupport() const override; diff --git a/shared/source/release_helper/release_helper.h b/shared/source/release_helper/release_helper.h index d3313816fc..6bb9aec9b8 100644 --- a/shared/source/release_helper/release_helper.h +++ b/shared/source/release_helper/release_helper.h @@ -34,6 +34,7 @@ class ReleaseHelper { virtual bool isAdjustWalkOrderAvailable() const = 0; virtual bool isMatrixMultiplyAccumulateSupported() const = 0; + virtual bool isDotProductAccumulateSystolicSupported() const = 0; virtual bool isPipeControlPriorToNonPipelinedStateCommandsWARequired() const = 0; virtual bool isPipeControlPriorToPipelineSelectWaRequired() const = 0; virtual bool isProgramAllStateComputeCommandFieldsWARequired() const = 0; @@ -68,6 +69,7 @@ class ReleaseHelperHw : public ReleaseHelper { bool isAdjustWalkOrderAvailable() const override; bool isMatrixMultiplyAccumulateSupported() const override; + bool isDotProductAccumulateSystolicSupported() const override; bool isPipeControlPriorToNonPipelinedStateCommandsWARequired() const override; bool isPipeControlPriorToPipelineSelectWaRequired() const override; bool isProgramAllStateComputeCommandFieldsWARequired() const override; diff --git a/shared/source/release_helper/release_helper_1270.cpp b/shared/source/release_helper/release_helper_1270.cpp index e15023d5a8..ba44b75f9c 100644 --- a/shared/source/release_helper/release_helper_1270.cpp +++ b/shared/source/release_helper/release_helper_1270.cpp @@ -32,6 +32,11 @@ inline bool ReleaseHelperHw::isAuxSurfaceModeOverrideRequired() const { return true; } +template <> +inline bool ReleaseHelperHw::isDotProductAccumulateSystolicSupported() const { + return false; +} + template <> int ReleaseHelperHw::getProductMaxPreferredSlmSize(int preferredEnumValue) const { using PREFERRED_SLM_ALLOCATION_SIZE = typename XeHpgCoreFamily::INTERFACE_DESCRIPTOR_DATA::PREFERRED_SLM_ALLOCATION_SIZE; diff --git a/shared/source/release_helper/release_helper_1271.cpp b/shared/source/release_helper/release_helper_1271.cpp index effe1e0280..e35f5ea09d 100644 --- a/shared/source/release_helper/release_helper_1271.cpp +++ b/shared/source/release_helper/release_helper_1271.cpp @@ -44,6 +44,11 @@ bool ReleaseHelperHw::getMediaFrequencyTileIndex(uint32_t &tileIndex) c return true; } +template <> +inline bool ReleaseHelperHw::isDotProductAccumulateSystolicSupported() const { + return false; +} + } // namespace NEO #include "shared/source/release_helper/release_helper_common_xe_lpg.inl" diff --git a/shared/source/release_helper/release_helper_base.inl b/shared/source/release_helper/release_helper_base.inl index a3cbde4d07..2d9c852bea 100644 --- a/shared/source/release_helper/release_helper_base.inl +++ b/shared/source/release_helper/release_helper_base.inl @@ -14,6 +14,10 @@ bool ReleaseHelperHw::isMatrixMultiplyAccumulateSupported() const { return true; } template +bool ReleaseHelperHw::isDotProductAccumulateSystolicSupported() const { + return true; +} +template bool ReleaseHelperHw::isAdjustWalkOrderAvailable() const { return false; } diff --git a/shared/source/xe_hpc_core/os_agnostic_product_helper_xe_hpc_core.inl b/shared/source/xe_hpc_core/os_agnostic_product_helper_xe_hpc_core.inl index f40b5f5187..68352101a6 100644 --- a/shared/source/xe_hpc_core/os_agnostic_product_helper_xe_hpc_core.inl +++ b/shared/source/xe_hpc_core/os_agnostic_product_helper_xe_hpc_core.inl @@ -51,14 +51,4 @@ uint32_t ProductHelperHw::getMaxNumSamplers() const { return 0u; } -template <> -bool ProductHelperHw::isPlatformDpasSupported() const { - return true; -} - -template <> -bool ProductHelperHw::isPlatformDp4aSupported() const { - return true; -} - } // namespace NEO diff --git a/shared/source/xe_hpg_core/xe_lpg/os_agnostic_product_helper_xe_lpg.inl b/shared/source/xe_hpg_core/xe_lpg/os_agnostic_product_helper_xe_lpg.inl index 36ff39d504..f61705d273 100644 --- a/shared/source/xe_hpg_core/xe_lpg/os_agnostic_product_helper_xe_lpg.inl +++ b/shared/source/xe_hpg_core/xe_lpg/os_agnostic_product_helper_xe_lpg.inl @@ -82,16 +82,6 @@ uint64_t ProductHelperHw::overridePatIndex(bool isUncachedType, uint return patIndex; } -template <> -bool ProductHelperHw::isPlatformDpasSupported() const { - return true; -} - -template <> -bool ProductHelperHw::isPlatformDp4aSupported() const { - return true; -} - template <> bool ProductHelperHw::overrideAllocationCacheable(const AllocationData &allocationData) const { return allocationData.type == AllocationType::commandBuffer; diff --git a/shared/test/common/mocks/mock_product_helper.cpp b/shared/test/common/mocks/mock_product_helper.cpp index b3526f4764..e8a033f777 100644 --- a/shared/test/common/mocks/mock_product_helper.cpp +++ b/shared/test/common/mocks/mock_product_helper.cpp @@ -333,16 +333,6 @@ bool ProductHelperHw::isTimestampWaitSupportedForEvents() const { return false; } -template <> -bool ProductHelperHw::isPlatformDpasSupported() const { - return false; -} - -template <> -bool ProductHelperHw::isPlatformDp4aSupported() const { - return false; -} - template <> uint64_t ProductHelperHw::getHostMemCapabilitiesValue() const { return 0; diff --git a/shared/test/common/mocks/mock_release_helper.h b/shared/test/common/mocks/mock_release_helper.h index 85a9ed6ce6..b8229dcea4 100644 --- a/shared/test/common/mocks/mock_release_helper.h +++ b/shared/test/common/mocks/mock_release_helper.h @@ -15,6 +15,7 @@ class MockReleaseHelper : public ReleaseHelper { MockReleaseHelper() : ReleaseHelper(0) {} ADDMETHOD_CONST_NOBASE(isAdjustWalkOrderAvailable, bool, false, ()); ADDMETHOD_CONST_NOBASE(isMatrixMultiplyAccumulateSupported, bool, false, ()); + ADDMETHOD_CONST_NOBASE(isDotProductAccumulateSystolicSupported, bool, false, ()); ADDMETHOD_CONST_NOBASE(isPipeControlPriorToNonPipelinedStateCommandsWARequired, bool, false, ()); ADDMETHOD_CONST_NOBASE(isPipeControlPriorToPipelineSelectWaRequired, bool, false, ()); ADDMETHOD_CONST_NOBASE(isProgramAllStateComputeCommandFieldsWARequired, bool, false, ()); diff --git a/shared/test/unit_test/helpers/compiler_product_helper_tests.cpp b/shared/test/unit_test/helpers/compiler_product_helper_tests.cpp index 0280461ef4..6bf43a74a0 100644 --- a/shared/test/unit_test/helpers/compiler_product_helper_tests.cpp +++ b/shared/test/unit_test/helpers/compiler_product_helper_tests.cpp @@ -142,6 +142,18 @@ HWTEST2_F(CompilerProductHelperFixture, GivenReleaseHelperThenMatrixMultiplyAccu } } +HWTEST2_F(CompilerProductHelperFixture, GivenReleaseHelperThenDotProductAccumulateSystolicIsSupportedBasedOnReleaseHelper, IsNotXeHpcCore) { + auto &compilerProductHelper = pDevice->getCompilerProductHelper(); + auto releaseHelper = pDevice->getReleaseHelper(); + + if (releaseHelper) { + + EXPECT_EQ(releaseHelper->isDotProductAccumulateSystolicSupported(), compilerProductHelper.isDotProductAccumulateSystolicSupported(releaseHelper)); + } else { + EXPECT_FALSE(compilerProductHelper.isDotProductAccumulateSystolicSupported(releaseHelper)); + } +} + HWTEST2_F(CompilerProductHelperFixture, GivenReleaseHelperThenMatrixMultiplyAccumulateIsSupported, IsXeHpcCore) { auto &compilerProductHelper = pDevice->getCompilerProductHelper(); auto releaseHelper = pDevice->getReleaseHelper(); @@ -149,6 +161,13 @@ HWTEST2_F(CompilerProductHelperFixture, GivenReleaseHelperThenMatrixMultiplyAccu EXPECT_TRUE(compilerProductHelper.isMatrixMultiplyAccumulateSupported(releaseHelper)); } +HWTEST2_F(CompilerProductHelperFixture, GivenReleaseHelperThenDotProductAccumulateSystolicIsSupported, IsXeHpcCore) { + auto &compilerProductHelper = pDevice->getCompilerProductHelper(); + auto releaseHelper = pDevice->getReleaseHelper(); + + EXPECT_TRUE(compilerProductHelper.isDotProductAccumulateSystolicSupported(releaseHelper)); +} + HWTEST2_F(CompilerProductHelperFixture, GivenReleaseHelperThenSplitMatrixMultiplyAccumulateIsSupportedBasedOnReleaseHelper, IsNotXeHpcCore) { auto &compilerProductHelper = pDevice->getCompilerProductHelper(); auto releaseHelper = pDevice->getReleaseHelper(); diff --git a/shared/test/unit_test/os_interface/product_helper_tests.cpp b/shared/test/unit_test/os_interface/product_helper_tests.cpp index 7302b5689e..8c612625cd 100644 --- a/shared/test/unit_test/os_interface/product_helper_tests.cpp +++ b/shared/test/unit_test/os_interface/product_helper_tests.cpp @@ -380,12 +380,6 @@ HWTEST2_F(ProductHelperTest, givenProductHelperWhenSettingCapabilityCoherencyFla EXPECT_TRUE(coherency); } -HWTEST2_F(ProductHelperTest, givenProductHelperWhenDotProductSupportThenReturnsFalse, IsAtMostGen11) { - - EXPECT_FALSE(productHelper->isPlatformDp4aSupported()); - EXPECT_FALSE(productHelper->isPlatformDpasSupported()); -} - HWTEST_F(ProductHelperTest, givenProductHelperWhenAskedIfAdditionalMediaSamplerProgrammingIsRequiredThenFalseIsReturned) { EXPECT_FALSE(productHelper->isAdditionalMediaSamplerProgrammingRequired()); diff --git a/shared/test/unit_test/release_helper/release_helper_12_71_tests.cpp b/shared/test/unit_test/release_helper/release_helper_12_71_tests.cpp index d11384b822..3dc4f66723 100644 --- a/shared/test/unit_test/release_helper/release_helper_12_71_tests.cpp +++ b/shared/test/unit_test/release_helper/release_helper_12_71_tests.cpp @@ -26,6 +26,7 @@ TEST_F(ReleaseHelper1271Tests, whenGettingCapabilitiesThenCorrectPropertiesAreRe EXPECT_FALSE(releaseHelper->isAdjustWalkOrderAvailable()); EXPECT_FALSE(releaseHelper->isMatrixMultiplyAccumulateSupported()); + EXPECT_FALSE(releaseHelper->isDotProductAccumulateSystolicSupported()); EXPECT_EQ(revision == 0, releaseHelper->isPipeControlPriorToNonPipelinedStateCommandsWARequired()); EXPECT_FALSE(releaseHelper->isPipeControlPriorToPipelineSelectWaRequired()); EXPECT_EQ(revision == 0, releaseHelper->isProgramAllStateComputeCommandFieldsWARequired()); diff --git a/shared/test/unit_test/xe_hpc_core/gfx_core_helper_xe_hpc_core_tests.cpp b/shared/test/unit_test/xe_hpc_core/gfx_core_helper_xe_hpc_core_tests.cpp index 7013132b28..be12f8318c 100644 --- a/shared/test/unit_test/xe_hpc_core/gfx_core_helper_xe_hpc_core_tests.cpp +++ b/shared/test/unit_test/xe_hpc_core/gfx_core_helper_xe_hpc_core_tests.cpp @@ -74,16 +74,6 @@ XE_HPC_CORETEST_F(ProductHelperTestXeHpcCore, givenProductHelperWhenCheckTimesta EXPECT_TRUE(helper.isTimestampWaitSupportedForEvents()); } -XE_HPC_CORETEST_F(ProductHelperTestXeHpcCore, givenProductHelperWhenCheckDpasSupportThenReturnTrue) { - auto &helper = getHelper(); - EXPECT_TRUE(helper.isPlatformDpasSupported()); -} - -XE_HPC_CORETEST_F(ProductHelperTestXeHpcCore, givenProductHelperWhenCheckDp4aSupportThenReturnTrue) { - auto &helper = getHelper(); - EXPECT_TRUE(helper.isPlatformDp4aSupported()); -} - XE_HPC_CORETEST_F(GfxCoreHelperTest, givenGfxCoreHelperWhenCallCopyThroughLockedPtrEnabledThenReturnTrue) { const auto &gfxCoreHelper = getHelper(); const auto &productHelper = getHelper(); diff --git a/shared/test/unit_test/xe_hpg_core/os_agnostic_product_helper_xe_lpg_tests.cpp b/shared/test/unit_test/xe_hpg_core/os_agnostic_product_helper_xe_lpg_tests.cpp index b547fe13ce..6c3cf0c200 100644 --- a/shared/test/unit_test/xe_hpg_core/os_agnostic_product_helper_xe_lpg_tests.cpp +++ b/shared/test/unit_test/xe_hpg_core/os_agnostic_product_helper_xe_lpg_tests.cpp @@ -209,14 +209,6 @@ HWTEST2_F(XeLpgProductHelperTests, givenProductHelperWhenCheckBlitEnqueueAllowed EXPECT_FALSE(productHelper->blitEnqueueAllowed()); } -HWTEST2_F(XeLpgProductHelperTests, givenProductHelperWhenCheckDpasSupportedThenReturnTrue, IsXeLpg) { - EXPECT_TRUE(productHelper->isPlatformDpasSupported()); -} - -HWTEST2_F(XeLpgProductHelperTests, givenProductHelperWhenCheckDp4aSupportedThenReturnTrue, IsXeLpg) { - EXPECT_TRUE(productHelper->isPlatformDp4aSupported()); -} - HWTEST2_F(XeLpgProductHelperTests, givenProductHelperWhenGetCommandsStreamPropertiesSupportThenExpectCorrectValues, IsXeLpg) { EXPECT_FALSE(productHelper->getScmPropertyThreadArbitrationPolicySupport());