From 0461af492d4126430f1e7e8d997a5b1e79f3b563 Mon Sep 17 00:00:00 2001 From: "Naklicki, Mateusz" Date: Fri, 22 Sep 2023 16:06:50 +0000 Subject: [PATCH] fix: unify path for getting number of grfs per thread Related-To: NEO-8043 Signed-off-by: Naklicki, Mateusz --- .../gfx_core_helpers/l0_gfx_core_helper.h | 2 -- .../l0_gfx_core_helper_skl_to_tgllp.inl | 5 ----- .../l0_gfx_core_helper_xehp_and_later.inl | 5 ----- .../helper/l0_gfx_core_helper_tests.cpp | 18 ------------------ .../helpers/hardware_commands_helper_base.inl | 2 +- .../source/command_container/command_encoder.h | 2 +- .../command_encoder_bdw_and_later.inl | 4 ++-- .../command_encoder_xehp_and_later.inl | 4 ++-- shared/source/os_interface/product_helper.h | 1 + shared/source/os_interface/product_helper.inl | 8 ++++++++ shared/source/os_interface/product_helper_hw.h | 1 + shared/source/release_helper/release_helper.h | 4 ++++ .../release_helper/release_helper_base.inl | 5 +++++ .../common/helpers/mock_product_helper_hw.h | 1 + .../common/helpers/mock_product_helper_hw.inl | 10 ++++++++++ .../test/common/mocks/mock_product_helper.cpp | 9 +++++++++ shared/test/common/mocks/mock_release_helper.h | 1 + .../os_interface/product_helper_tests.cpp | 9 +++++++++ .../release_helper_12_55_tests.cpp | 6 +++++- .../release_helper_12_56_tests.cpp | 6 +++++- .../release_helper_12_57_tests.cpp | 6 +++++- .../release_helper_12_70_tests.cpp | 4 ++++ .../release_helper_12_71_tests.cpp | 4 ++++ .../release_helper_tests_base.cpp | 14 ++++++++++++-- .../release_helper/release_helper_tests_base.h | 1 + 25 files changed, 91 insertions(+), 41 deletions(-) diff --git a/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper.h b/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper.h index 163554f44d..bf347c9f5d 100644 --- a/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper.h +++ b/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper.h @@ -84,7 +84,6 @@ class L0GfxCoreHelper : public NEO::ApiGfxCoreHelper { virtual uint32_t getEventMaxKernelCount(const NEO::HardwareInfo &hwInfo) const = 0; virtual uint32_t getEventBaseMaxPacketCount(const NEO::RootDeviceEnvironment &rootDeviceEnvironment) const = 0; virtual NEO::HeapAddressModel getPlatformHeapAddressModel() const = 0; - virtual std::vector getSupportedNumGrfs() const = 0; virtual ze_rtas_format_exp_t getSupportedRTASFormat() const = 0; virtual bool platformSupportsImmediateComputeFlushTask() const = 0; virtual zet_debug_regset_type_intel_gpu_t getRegsetTypeForLargeGrfDetection() const = 0; @@ -123,7 +122,6 @@ class L0GfxCoreHelperHw : public L0GfxCoreHelper { uint32_t getEventMaxKernelCount(const NEO::HardwareInfo &hwInfo) const override; uint32_t getEventBaseMaxPacketCount(const NEO::RootDeviceEnvironment &rootDeviceEnvironment) const override; NEO::HeapAddressModel getPlatformHeapAddressModel() const override; - std::vector getSupportedNumGrfs() const override; ze_rtas_format_exp_t getSupportedRTASFormat() const override; bool platformSupportsImmediateComputeFlushTask() const override; zet_debug_regset_type_intel_gpu_t getRegsetTypeForLargeGrfDetection() const override; diff --git a/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper_skl_to_tgllp.inl b/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper_skl_to_tgllp.inl index 7b5d729e20..bcb3865d52 100644 --- a/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper_skl_to_tgllp.inl +++ b/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper_skl_to_tgllp.inl @@ -59,11 +59,6 @@ NEO::HeapAddressModel L0GfxCoreHelperHw::getPlatformHeapAddressModel() c return NEO::HeapAddressModel::PrivateHeaps; } -template -std::vector L0GfxCoreHelperHw::getSupportedNumGrfs() const { - return {128u}; -} - template ze_rtas_format_exp_t L0GfxCoreHelperHw::getSupportedRTASFormat() const { return ZE_RTAS_FORMAT_EXP_INVALID; diff --git a/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper_xehp_and_later.inl b/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper_xehp_and_later.inl index 66efe5ff5a..83e5110c58 100644 --- a/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper_xehp_and_later.inl +++ b/level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper_xehp_and_later.inl @@ -72,11 +72,6 @@ NEO::HeapAddressModel L0GfxCoreHelperHw::getPlatformHeapAddressModel() c return NEO::HeapAddressModel::PrivateHeaps; } -template -std::vector L0GfxCoreHelperHw::getSupportedNumGrfs() const { - return {128u, 256u}; -} - template ze_rtas_format_exp_t L0GfxCoreHelperHw::getSupportedRTASFormat() const { return static_cast(ZE_RTAS_DEVICE_FORMAT_EXP_VERSION_1); diff --git a/level_zero/core/test/unit_tests/sources/helper/l0_gfx_core_helper_tests.cpp b/level_zero/core/test/unit_tests/sources/helper/l0_gfx_core_helper_tests.cpp index 33299c1f34..4101641fa9 100644 --- a/level_zero/core/test/unit_tests/sources/helper/l0_gfx_core_helper_tests.cpp +++ b/level_zero/core/test/unit_tests/sources/helper/l0_gfx_core_helper_tests.cpp @@ -839,24 +839,6 @@ TEST_F(L0GfxCoreHelperTest, givenL0GfxCoreHelperUsingOverrideDebugKeyWhenGetting EXPECT_EQ(NEO::HeapAddressModel::GlobalBindful, L0GfxCoreHelper::getHeapAddressModel(rootDeviceEnvironment)); } -HWTEST2_F(L0GfxCoreHelperTest, givenL0GfxCoreHelperWhenGettingSupportedNumGrfsThenCorrectValueIsReturned, IsBeforeXeHpCore) { - MockExecutionEnvironment executionEnvironment; - const auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0].get(); - const auto &l0GfxCoreHelper = rootDeviceEnvironment.getHelper(); - const std::vector expectedValues{128u}; - - EXPECT_EQ(expectedValues, l0GfxCoreHelper.getSupportedNumGrfs()); -} - -HWTEST2_F(L0GfxCoreHelperTest, givenL0GfxCoreHelperWhenGettingSupportedNumGrfsThenCorrectValueIsReturned, IsAtLeastXeHpCore) { - MockExecutionEnvironment executionEnvironment; - const auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0].get(); - const auto &l0GfxCoreHelper = rootDeviceEnvironment.getHelper(); - const std::vector expectedValues{128u, 256u}; - - EXPECT_EQ(expectedValues, l0GfxCoreHelper.getSupportedNumGrfs()); -} - TEST_F(L0GfxCoreHelperTest, givenL0GfxCoreHelperUsingOverrideDebugKeyWhenGettingDispatchCmdListCmdBufferPrimaryThenUseDbgKeyValue) { DebugManagerStateRestore restorer; MockExecutionEnvironment executionEnvironment; diff --git a/opencl/source/helpers/hardware_commands_helper_base.inl b/opencl/source/helpers/hardware_commands_helper_base.inl index 9b8653433c..8b2b2bbbbe 100644 --- a/opencl/source/helpers/hardware_commands_helper_base.inl +++ b/opencl/source/helpers/hardware_commands_helper_base.inl @@ -153,7 +153,7 @@ size_t HardwareCommandsHelper::sendInterfaceDescriptorData( auto slmTotalSize = kernel.getSlmTotalSize(); EncodeDispatchKernel::setGrfInfo(&interfaceDescriptor, kernelDescriptor.kernelAttributes.numGrfRequired, - sizeCrossThreadData, sizePerThreadData, hardwareInfo); + sizeCrossThreadData, sizePerThreadData, device.getRootDeviceEnvironment()); auto &productHelper = device.getProductHelper(); productHelper.updateIddCommand(&interfaceDescriptor, kernelDescriptor.kernelAttributes.numGrfRequired, kernelDescriptor.kernelAttributes.threadArbitrationPolicy); diff --git a/shared/source/command_container/command_encoder.h b/shared/source/command_container/command_encoder.h index f56444035c..51a9bbf99b 100644 --- a/shared/source/command_container/command_encoder.h +++ b/shared/source/command_container/command_encoder.h @@ -102,7 +102,7 @@ struct EncodeDispatchKernel { const uint32_t threadsPerThreadGroup, uint32_t slmTotalSize, SlmPolicy slmPolicy); static void setGrfInfo(INTERFACE_DESCRIPTOR_DATA *pInterfaceDescriptor, uint32_t numGrf, const size_t &sizeCrossThreadData, - const size_t &sizePerThreadData, const HardwareInfo &hwInfo); + const size_t &sizePerThreadData, const RootDeviceEnvironment &rootDeviceEnvironment); static void *getInterfaceDescriptor(CommandContainer &container, IndirectHeap *childDsh, uint32_t &iddOffset); diff --git a/shared/source/command_container/command_encoder_bdw_and_later.inl b/shared/source/command_container/command_encoder_bdw_and_later.inl index de8350bd8c..d34453a93a 100644 --- a/shared/source/command_container/command_encoder_bdw_and_later.inl +++ b/shared/source/command_container/command_encoder_bdw_and_later.inl @@ -31,7 +31,7 @@ namespace NEO { template void EncodeDispatchKernel::setGrfInfo(INTERFACE_DESCRIPTOR_DATA *pInterfaceDescriptor, uint32_t numGrf, const size_t &sizeCrossThreadData, const size_t &sizePerThreadData, - const HardwareInfo &hwInfo) { + const RootDeviceEnvironment &rootDeviceEnvironment) { auto grfSize = sizeof(typename Family::GRF); DEBUG_BREAK_IF((sizeCrossThreadData % grfSize) != 0); auto numGrfCrossThreadData = static_cast(sizeCrossThreadData / grfSize); @@ -163,7 +163,7 @@ void EncodeDispatchKernel::encode(CommandContainer &container, EncodeDis } EncodeDispatchKernel::setGrfInfo(&idd, kernelDescriptor.kernelAttributes.numGrfRequired, sizeCrossThreadData, - sizePerThreadData, hwInfo); + sizePerThreadData, rootDeviceEnvironment); uint32_t sizeThreadData = sizePerThreadDataForWholeGroup + sizeCrossThreadData; bool isHwLocalIdGeneration = false; diff --git a/shared/source/command_container/command_encoder_xehp_and_later.inl b/shared/source/command_container/command_encoder_xehp_and_later.inl index 645ed92f2d..8823eb65d3 100644 --- a/shared/source/command_container/command_encoder_xehp_and_later.inl +++ b/shared/source/command_container/command_encoder_xehp_and_later.inl @@ -39,7 +39,7 @@ constexpr size_t ImmWriteDestinationAddressAlignment = 8; template void EncodeDispatchKernel::setGrfInfo(INTERFACE_DESCRIPTOR_DATA *pInterfaceDescriptor, uint32_t numGrf, const size_t &sizeCrossThreadData, const size_t &sizePerThreadData, - const HardwareInfo &hwInfo) { + const RootDeviceEnvironment &rootDeviceEnvironment) { } template @@ -76,7 +76,7 @@ void EncodeDispatchKernel::encode(CommandContainer &container, EncodeDis auto &idd = walkerCmd.getInterfaceDescriptor(); EncodeDispatchKernel::setGrfInfo(&idd, kernelDescriptor.kernelAttributes.numGrfRequired, sizeCrossThreadData, - sizePerThreadData, hwInfo); + sizePerThreadData, rootDeviceEnvironment); auto &productHelper = args.device->getProductHelper(); productHelper.updateIddCommand(&idd, kernelDescriptor.kernelAttributes.numGrfRequired, kernelDescriptor.kernelAttributes.threadArbitrationPolicy); diff --git a/shared/source/os_interface/product_helper.h b/shared/source/os_interface/product_helper.h index 49744e6ccd..9aa316f11c 100644 --- a/shared/source/os_interface/product_helper.h +++ b/shared/source/os_interface/product_helper.h @@ -206,6 +206,7 @@ class ProductHelper { virtual bool getMediaFrequencyTileIndex(const ReleaseHelper *releaseHelper, uint32_t &tileIndex) const = 0; virtual bool isResolvingSubDeviceIDNeeded(const ReleaseHelper *releaseHelper) const = 0; virtual uint64_t overridePatIndex(bool isUncachedType, uint64_t patIndex) const = 0; + virtual std::vector getSupportedNumGrfs(const ReleaseHelper *releaseHelper) const = 0; virtual ~ProductHelper() = default; diff --git a/shared/source/os_interface/product_helper.inl b/shared/source/os_interface/product_helper.inl index e02b59845b..058b1221c6 100644 --- a/shared/source/os_interface/product_helper.inl +++ b/shared/source/os_interface/product_helper.inl @@ -806,4 +806,12 @@ uint64_t ProductHelperHw::overridePatIndex(bool isUncachedType, uint return patIndex; } +template +std::vector ProductHelperHw::getSupportedNumGrfs(const ReleaseHelper *releaseHelper) const { + if (releaseHelper) { + return releaseHelper->getSupportedNumGrfs(); + } + return {128u}; +} + } // namespace NEO diff --git a/shared/source/os_interface/product_helper_hw.h b/shared/source/os_interface/product_helper_hw.h index 7472c78d37..d649ad0f6b 100644 --- a/shared/source/os_interface/product_helper_hw.h +++ b/shared/source/os_interface/product_helper_hw.h @@ -159,6 +159,7 @@ class ProductHelperHw : public ProductHelper { bool getMediaFrequencyTileIndex(const ReleaseHelper *releaseHelper, uint32_t &tileIndex) const override; bool isResolvingSubDeviceIDNeeded(const ReleaseHelper *releaseHelper) const override; uint64_t overridePatIndex(bool isUncachedType, uint64_t patIndex) const override; + std::vector getSupportedNumGrfs(const ReleaseHelper *releaseHelper) const override; ~ProductHelperHw() override = default; diff --git a/shared/source/release_helper/release_helper.h b/shared/source/release_helper/release_helper.h index 606618ad8a..0e3e60e29a 100644 --- a/shared/source/release_helper/release_helper.h +++ b/shared/source/release_helper/release_helper.h @@ -11,6 +11,8 @@ #include #include +#include + namespace NEO { class ReleaseHelper; @@ -43,6 +45,7 @@ class ReleaseHelper { virtual bool isDirectSubmissionSupported() const = 0; virtual bool isRcsExposureDisabled() const = 0; virtual std::optional getPreferredAllocationMethod(AllocationType allocationType) const = 0; + virtual std::vector getSupportedNumGrfs() const = 0; protected: ReleaseHelper(HardwareIpVersion hardwareIpVersion) : hardwareIpVersion(hardwareIpVersion) {} @@ -72,6 +75,7 @@ class ReleaseHelperHw : public ReleaseHelper { bool isDirectSubmissionSupported() const override; bool isRcsExposureDisabled() const override; std::optional getPreferredAllocationMethod(AllocationType allocationType) const override; + std::vector getSupportedNumGrfs() const override; protected: ReleaseHelperHw(HardwareIpVersion hardwareIpVersion) : ReleaseHelper(hardwareIpVersion) {} diff --git a/shared/source/release_helper/release_helper_base.inl b/shared/source/release_helper/release_helper_base.inl index 0ef3cbba3c..e74af74c9a 100644 --- a/shared/source/release_helper/release_helper_base.inl +++ b/shared/source/release_helper/release_helper_base.inl @@ -87,4 +87,9 @@ template bool ReleaseHelperHw::isRcsExposureDisabled() const { return false; } + +template +std::vector ReleaseHelperHw::getSupportedNumGrfs() const { + return {128u, 256u}; +} } // namespace NEO diff --git a/shared/test/common/helpers/mock_product_helper_hw.h b/shared/test/common/helpers/mock_product_helper_hw.h index 10f35c72b9..f446e9da72 100644 --- a/shared/test/common/helpers/mock_product_helper_hw.h +++ b/shared/test/common/helpers/mock_product_helper_hw.h @@ -24,6 +24,7 @@ struct MockProductHelperHw : NEO::ProductHelperHw { uint32_t getDeviceMemoryMaxClkRate(const HardwareInfo &hwInfo, const OSInterface *osIface, uint32_t subDeviceIndex) const override; uint32_t getL1CachePolicy(bool isDebuggerActive) const override; bool isUnlockingLockedPtrNecessary(const HardwareInfo &hwInfo) const override; + std::vector getSupportedNumGrfs(const ReleaseHelper *releaseHelper) const override; bool use128MbEdram = false; bool enableMidThreadPreemption = false; diff --git a/shared/test/common/helpers/mock_product_helper_hw.inl b/shared/test/common/helpers/mock_product_helper_hw.inl index f21870031e..69ffa7fd15 100644 --- a/shared/test/common/helpers/mock_product_helper_hw.inl +++ b/shared/test/common/helpers/mock_product_helper_hw.inl @@ -5,6 +5,9 @@ * */ +#pragma once +#include "shared/source/release_helper/release_helper.h" + namespace NEO { template <> @@ -72,4 +75,11 @@ bool MockProductHelperHw::isUnlockingLockedPtrNecessary(const Hardwa return this->returnedIsUnlockingLockedPtrNecessary; } +template <> +std::vector MockProductHelperHw::getSupportedNumGrfs(const ReleaseHelper *releaseHelper) const { + if (releaseHelper) { + return releaseHelper->getSupportedNumGrfs(); + } + return {128u}; +} } // namespace NEO diff --git a/shared/test/common/mocks/mock_product_helper.cpp b/shared/test/common/mocks/mock_product_helper.cpp index d77b3019b8..0ee44df6bb 100644 --- a/shared/test/common/mocks/mock_product_helper.cpp +++ b/shared/test/common/mocks/mock_product_helper.cpp @@ -13,6 +13,7 @@ #include "shared/source/helpers/local_memory_access_modes.h" #include "shared/source/os_interface/product_helper.h" #include "shared/source/os_interface/product_helper_hw.h" +#include "shared/source/release_helper/release_helper.h" namespace NEO { @@ -381,6 +382,14 @@ uint32_t L1CachePolicyHelper::getUncachedL1CachePolicy() { return 1u; } +template <> +std::vector ProductHelperHw::getSupportedNumGrfs(const ReleaseHelper *releaseHelper) const { + if (releaseHelper) { + return releaseHelper->getSupportedNumGrfs(); + } + return {}; +} + struct UnknownProduct { struct FrontEndStateSupport { static constexpr bool scratchSize = false; diff --git a/shared/test/common/mocks/mock_release_helper.h b/shared/test/common/mocks/mock_release_helper.h index c1bbba0878..2de8fea3d1 100644 --- a/shared/test/common/mocks/mock_release_helper.h +++ b/shared/test/common/mocks/mock_release_helper.h @@ -29,5 +29,6 @@ class MockReleaseHelper : public ReleaseHelper { ADDMETHOD_CONST_NOBASE(isDirectSubmissionSupported, bool, false, ()); ADDMETHOD_CONST_NOBASE(isRcsExposureDisabled, bool, false, ()); ADDMETHOD_CONST_NOBASE(getPreferredAllocationMethod, std::optional, std::nullopt, (AllocationType allocationType)); + ADDMETHOD_CONST_NOBASE(getSupportedNumGrfs, std::vector, {128}, ()); }; } // namespace NEO 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 8d3978786b..7834dd694d 100644 --- a/shared/test/unit_test/os_interface/product_helper_tests.cpp +++ b/shared/test/unit_test/os_interface/product_helper_tests.cpp @@ -828,3 +828,12 @@ HWTEST_F(ProductHelperTest, givenBooleanUncachedWhenCallOverridePatIndexThenProp isUncached = false; EXPECT_EQ(patIndex, productHelper->overridePatIndex(isUncached, patIndex)); } + +HWTEST_F(ProductHelperTest, givenProductHelperWhenGettingSupportedNumGrfsThenCorrectValueIsReturned) { + if (releaseHelper) { + EXPECT_EQ(releaseHelper->getSupportedNumGrfs(), productHelper->getSupportedNumGrfs(releaseHelper)); + } else { + const std::vector expectedValues{128u}; + EXPECT_EQ(expectedValues, productHelper->getSupportedNumGrfs(releaseHelper)); + } +} diff --git a/shared/test/unit_test/release_helper/release_helper_12_55_tests.cpp b/shared/test/unit_test/release_helper/release_helper_12_55_tests.cpp index 4f57ab502b..894697952b 100644 --- a/shared/test/unit_test/release_helper/release_helper_12_55_tests.cpp +++ b/shared/test/unit_test/release_helper/release_helper_12_55_tests.cpp @@ -52,4 +52,8 @@ TEST_F(ReleaseHelper1255Tests, whenGettingPreferredAllocationMethodThenNoPrefere TEST_F(ReleaseHelper1255Tests, whenShouldAdjustCalledThenFalseReturned) { whenShouldAdjustCalledThenFalseReturned(); -} \ No newline at end of file +} + +TEST_F(ReleaseHelper1255Tests, whenGettingSupportedNumGrfsThenCorrectValuesAreReturned) { + whenGettingSupportedNumGrfsThenValues128And256Returned(); +} diff --git a/shared/test/unit_test/release_helper/release_helper_12_56_tests.cpp b/shared/test/unit_test/release_helper/release_helper_12_56_tests.cpp index 541e6ad467..0f8687232e 100644 --- a/shared/test/unit_test/release_helper/release_helper_12_56_tests.cpp +++ b/shared/test/unit_test/release_helper/release_helper_12_56_tests.cpp @@ -52,4 +52,8 @@ TEST_F(ReleaseHelper1256Tests, whenGettingPreferredAllocationMethodThenNoPrefere TEST_F(ReleaseHelper1256Tests, whenShouldAdjustCalledThenFalseReturned) { whenShouldAdjustCalledThenFalseReturned(); -} \ No newline at end of file +} + +TEST_F(ReleaseHelper1256Tests, whenGettingSupportedNumGrfsThenCorrectValuesAreReturned) { + whenGettingSupportedNumGrfsThenValues128And256Returned(); +} diff --git a/shared/test/unit_test/release_helper/release_helper_12_57_tests.cpp b/shared/test/unit_test/release_helper/release_helper_12_57_tests.cpp index f4737f2233..c823bee990 100644 --- a/shared/test/unit_test/release_helper/release_helper_12_57_tests.cpp +++ b/shared/test/unit_test/release_helper/release_helper_12_57_tests.cpp @@ -52,4 +52,8 @@ TEST_F(ReleaseHelper1257Tests, whenGettingPreferredAllocationMethodThenNoPrefere TEST_F(ReleaseHelper1257Tests, whenShouldAdjustCalledThenFalseReturned) { whenShouldAdjustCalledThenFalseReturned(); -} \ No newline at end of file +} + +TEST_F(ReleaseHelper1257Tests, whenGettingSupportedNumGrfsThenCorrectValuesAreReturned) { + whenGettingSupportedNumGrfsThenValues128And256Returned(); +} diff --git a/shared/test/unit_test/release_helper/release_helper_12_70_tests.cpp b/shared/test/unit_test/release_helper/release_helper_12_70_tests.cpp index 2e7d0a1dc8..b9b5b2a17e 100644 --- a/shared/test/unit_test/release_helper/release_helper_12_70_tests.cpp +++ b/shared/test/unit_test/release_helper/release_helper_12_70_tests.cpp @@ -68,3 +68,7 @@ TEST_F(ReleaseHelper1270Tests, whenGettingMediaFrequencyTileIndexThenOneIsReturn TEST_F(ReleaseHelper1270Tests, whenCheckPreferredAllocationMethodThenAllocateByKmdIsReturnedExceptTagBufferAndTimestapPacketTagBuffer) { whenCheckPreferredAllocationMethodThenAllocateByKmdIsReturnedExceptTagBufferAndTimestampPacketTagBufferAndCommandBuffer(); } + +TEST_F(ReleaseHelper1270Tests, whenGettingSupportedNumGrfsThenCorrectValuesAreReturned) { + whenGettingSupportedNumGrfsThenValues128And256Returned(); +} 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 af7604e1a5..54b2c2a38b 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 @@ -69,3 +69,7 @@ TEST_F(ReleaseHelper1271Tests, whenGettingMediaFrequencyTileIndexThenOneIsReturn TEST_F(ReleaseHelper1271Tests, whenCheckPreferredAllocationMethodThenAllocateByKmdIsReturnedExceptTagBufferAndTimestapPacketTagBuffer) { whenCheckPreferredAllocationMethodThenAllocateByKmdIsReturnedExceptTagBufferAndTimestampPacketTagBufferAndCommandBuffer(); } + +TEST_F(ReleaseHelper1271Tests, whenGettingSupportedNumGrfsThenCorrectValuesAreReturned) { + whenGettingSupportedNumGrfsThenValues128And256Returned(); +} diff --git a/shared/test/unit_test/release_helper/release_helper_tests_base.cpp b/shared/test/unit_test/release_helper/release_helper_tests_base.cpp index d948748f41..6eb5ee35d0 100644 --- a/shared/test/unit_test/release_helper/release_helper_tests_base.cpp +++ b/shared/test/unit_test/release_helper/release_helper_tests_base.cpp @@ -118,12 +118,22 @@ void ReleaseHelperTestsBase::whenShouldAdjustCalledThenTrueReturned() { EXPECT_TRUE(releaseHelper->shouldAdjustDepth()); } } + void ReleaseHelperTestsBase::whenShouldAdjustCalledThenFalseReturned() { for (auto &revision : getRevisions()) { ipVersion.revision = revision; releaseHelper = ReleaseHelper::create(ipVersion); ASSERT_NE(nullptr, releaseHelper); - EXPECT_FALSE(releaseHelper->shouldAdjustDepth()); } -} \ No newline at end of file +} + +void ReleaseHelperTestsBase::whenGettingSupportedNumGrfsThenValues128And256Returned() { + std::vector expectedValues{128u, 256u}; + for (auto &revision : getRevisions()) { + ipVersion.revision = revision; + releaseHelper = ReleaseHelper::create(ipVersion); + ASSERT_NE(nullptr, releaseHelper); + EXPECT_EQ(expectedValues, releaseHelper->getSupportedNumGrfs()); + } +} diff --git a/shared/test/unit_test/release_helper/release_helper_tests_base.h b/shared/test/unit_test/release_helper/release_helper_tests_base.h index c8a315bcc5..a881a48a31 100644 --- a/shared/test/unit_test/release_helper/release_helper_tests_base.h +++ b/shared/test/unit_test/release_helper/release_helper_tests_base.h @@ -29,6 +29,7 @@ struct ReleaseHelperTestsBase : public ::testing::Test { void whenCheckPreferredAllocationMethodThenAllocateByKmdIsReturnedExceptTagBufferAndTimestampPacketTagBufferAndCommandBuffer(); void whenShouldAdjustCalledThenTrueReturned(); void whenShouldAdjustCalledThenFalseReturned(); + void whenGettingSupportedNumGrfsThenValues128And256Returned(); virtual std::vector getRevisions() = 0;