diff --git a/level_zero/core/test/unit_tests/sources/device/test_device.cpp b/level_zero/core/test/unit_tests/sources/device/test_device.cpp index 539a180295..e69ec5fb60 100644 --- a/level_zero/core/test/unit_tests/sources/device/test_device.cpp +++ b/level_zero/core/test/unit_tests/sources/device/test_device.cpp @@ -640,8 +640,8 @@ TEST_F(DeviceTest, givenCallToDevicePropertiesThenMaximumMemoryToBeAllocatedIsCo } TEST_F(DeviceTest, whenCheckingIfStatelessCompressionIsSupportedThenReturnFalse) { - auto &hwHelper = HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily); - EXPECT_FALSE(hwHelper.allowStatelessCompression(*defaultHwInfo)); + const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily); + EXPECT_FALSE(hwInfoConfig.allowStatelessCompression(*defaultHwInfo)); } struct DeviceHwInfoTest : public ::testing::Test { diff --git a/opencl/source/kernel/kernel.cpp b/opencl/source/kernel/kernel.cpp index a2456a1650..5d80a095da 100644 --- a/opencl/source/kernel/kernel.cpp +++ b/opencl/source/kernel/kernel.cpp @@ -2485,8 +2485,8 @@ void Kernel::fillWithKernelObjsForAuxTranslation(KernelObjsForAuxTranslation &ke } } } - auto &hwHelper = HwHelper::get(getDevice().getHardwareInfo().platform.eRenderCoreFamily); - if (hwHelper.allowStatelessCompression(getDevice().getHardwareInfo())) { + const auto &hwInfoConfig = *HwInfoConfig::get(getDevice().getHardwareInfo().platform.eProductFamily); + if (hwInfoConfig.allowStatelessCompression(getDevice().getHardwareInfo())) { for (auto gfxAllocation : kernelUnifiedMemoryGfxAllocations) { if ((gfxAllocation->getAllocationType() == GraphicsAllocation::AllocationType::BUFFER_COMPRESSED) || (gfxAllocation->getAllocationType() == GraphicsAllocation::AllocationType::SVM_GPU)) { @@ -2806,8 +2806,8 @@ bool Kernel::requiresLimitedWorkgroupSize() const { } void Kernel::updateAuxTranslationRequired() { - auto &hwHelper = HwHelper::get(getDevice().getHardwareInfo().platform.eRenderCoreFamily); - if (hwHelper.allowStatelessCompression(getDevice().getHardwareInfo())) { + const auto &hwInfoConfig = *HwInfoConfig::get(getDevice().getHardwareInfo().platform.eProductFamily); + if (hwInfoConfig.allowStatelessCompression(getDevice().getHardwareInfo())) { if (hasDirectStatelessAccessToHostMemory() || hasIndirectStatelessAccessToHostMemory()) { setAuxTranslationRequired(true); } diff --git a/opencl/source/memory_manager/compression_selector_ocl.cpp b/opencl/source/memory_manager/compression_selector_ocl.cpp index cd0dcaf309..904b09d8f7 100644 --- a/opencl/source/memory_manager/compression_selector_ocl.cpp +++ b/opencl/source/memory_manager/compression_selector_ocl.cpp @@ -5,8 +5,8 @@ * */ -#include "shared/source/helpers/hw_helper.h" #include "shared/source/memory_manager/compression_selector.h" +#include "shared/source/os_interface/hw_info_config.h" namespace NEO { bool CompressionSelector::preferRenderCompressedBuffer(const AllocationProperties &properties, const HardwareInfo &hwInfo) { @@ -17,8 +17,8 @@ bool CompressionSelector::preferRenderCompressedBuffer(const AllocationPropertie case GraphicsAllocation::AllocationType::CONSTANT_SURFACE: case GraphicsAllocation::AllocationType::SVM_GPU: case GraphicsAllocation::AllocationType::PRINTF_SURFACE: { - auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily); - return hwHelper.allowStatelessCompression(hwInfo); + const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily); + return hwInfoConfig.allowStatelessCompression(hwInfo); } default: return false; diff --git a/opencl/source/program/printf_handler.cpp b/opencl/source/program/printf_handler.cpp index decfb445e3..0e3f0af31a 100644 --- a/opencl/source/program/printf_handler.cpp +++ b/opencl/source/program/printf_handler.cpp @@ -12,6 +12,7 @@ #include "shared/source/helpers/hw_helper.h" #include "shared/source/helpers/ptr_math.h" #include "shared/source/memory_manager/memory_manager.h" +#include "shared/source/os_interface/hw_info_config.h" #include "shared/source/program/print_formatter.h" #include "opencl/source/cl_device/cl_device.h" @@ -77,8 +78,8 @@ void PrintfHandler::makeResident(CommandStreamReceiver &commandStreamReceiver) { } void PrintfHandler::printEnqueueOutput() { - auto &helper = HwHelper::get(device.getHardwareInfo().platform.eRenderCoreFamily); - if (helper.allowStatelessCompression(device.getHardwareInfo())) { + const auto &hwInfoConfig = *HwInfoConfig::get(device.getHardwareInfo().platform.eProductFamily); + if (hwInfoConfig.allowStatelessCompression(device.getHardwareInfo())) { auto printOutputSize = static_cast(printfSurface->getUnderlyingBufferSize()); auto printOutputDecompressed = std::make_unique(printOutputSize); auto &bcsEngine = device.getEngine(EngineHelpers::getBcsEngineType(device.getHardwareInfo(), device.getDeviceBitfield(), device.getSelectorCopyEngine(), true), EngineUsage::Regular); diff --git a/opencl/source/xe_hp_core/cl_hw_helper_xe_hp_core.cpp b/opencl/source/xe_hp_core/cl_hw_helper_xe_hp_core.cpp index dfd0abc5a1..9c26cd014c 100644 --- a/opencl/source/xe_hp_core/cl_hw_helper_xe_hp_core.cpp +++ b/opencl/source/xe_hp_core/cl_hw_helper_xe_hp_core.cpp @@ -7,6 +7,7 @@ #include "shared/source/debug_settings/debug_settings_manager.h" #include "shared/source/helpers/populate_factory.h" +#include "shared/source/os_interface/hw_info_config.h" #include "opencl/source/context/context.h" #include "opencl/source/helpers/cl_hw_helper_base.inl" @@ -27,7 +28,7 @@ void populateFactoryTable>() { template <> bool ClHwHelperHw::requiresNonAuxMode(const ArgDescPointer &argAsPtr, const HardwareInfo &hwInfo) const { - if (HwHelperHw::get().allowStatelessCompression(hwInfo)) { + if (HwInfoConfig::get(hwInfo.platform.eProductFamily)->allowStatelessCompression(hwInfo)) { return false; } else { return !argAsPtr.isPureStateful(); @@ -36,7 +37,7 @@ bool ClHwHelperHw::requiresNonAuxMode(const ArgDescPointer &argAsPtr, co template <> bool ClHwHelperHw::requiresAuxResolves(const KernelInfo &kernelInfo, const HardwareInfo &hwInfo) const { - if (HwHelperHw::get().allowStatelessCompression(hwInfo)) { + if (HwInfoConfig::get(hwInfo.platform.eProductFamily)->allowStatelessCompression(hwInfo)) { return false; } else { return hasStatelessAccessToBuffer(kernelInfo); diff --git a/opencl/test/unit_test/helpers/hw_helper_tests.cpp b/opencl/test/unit_test/helpers/hw_helper_tests.cpp index bcd0dd96eb..6370f4ba81 100644 --- a/opencl/test/unit_test/helpers/hw_helper_tests.cpp +++ b/opencl/test/unit_test/helpers/hw_helper_tests.cpp @@ -878,23 +878,6 @@ HWTEST_F(HwHelperTest, givenHwHelperWhenAskingForTilingSupportThenReturnValidVal } } -HWTEST_F(HwHelperTest, WhenAllowStatelessCompressionIsCalledThenReturnCorrectValue) { - DebugManagerStateRestore restore; - - auto &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily); - EXPECT_FALSE(hwHelper.allowStatelessCompression(hardwareInfo)); - - for (auto enable : {-1, 0, 1}) { - DebugManager.flags.EnableStatelessCompression.set(enable); - - if (enable > 0) { - EXPECT_TRUE(hwHelper.allowStatelessCompression(hardwareInfo)); - } else { - EXPECT_FALSE(hwHelper.allowStatelessCompression(hardwareInfo)); - } - } -} - HWTEST_F(HwHelperTest, WhenIsBankOverrideRequiredIsCalledThenFalseIsReturned) { auto &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily); EXPECT_FALSE(hwHelper.isBankOverrideRequired(hardwareInfo)); diff --git a/opencl/test/unit_test/os_interface/hw_info_config_tests.cpp b/opencl/test/unit_test/os_interface/hw_info_config_tests.cpp index ff81f2ec90..9197b7883d 100644 --- a/opencl/test/unit_test/os_interface/hw_info_config_tests.cpp +++ b/opencl/test/unit_test/os_interface/hw_info_config_tests.cpp @@ -225,3 +225,20 @@ HWTEST_F(HwInfoConfigTest, WhenAllowRenderCompressionIsCalledThenTrueIsReturned) const auto &hwInfoConfig = *HwInfoConfig::get(pInHwInfo.platform.eProductFamily); EXPECT_TRUE(hwInfoConfig.allowRenderCompression(pInHwInfo)); } + +HWTEST_F(HwInfoConfigTest, WhenAllowStatelessCompressionIsCalledThenReturnCorrectValue) { + DebugManagerStateRestore restore; + + const auto &hwInfoConfig = *HwInfoConfig::get(pInHwInfo.platform.eProductFamily); + EXPECT_FALSE(hwInfoConfig.allowStatelessCompression(pInHwInfo)); + + for (auto enable : {-1, 0, 1}) { + DebugManager.flags.EnableStatelessCompression.set(enable); + + if (enable > 0) { + EXPECT_TRUE(hwInfoConfig.allowStatelessCompression(pInHwInfo)); + } else { + EXPECT_FALSE(hwInfoConfig.allowStatelessCompression(pInHwInfo)); + } + } +} diff --git a/opencl/test/unit_test/xe_hp_core/hw_helper_tests_xe_hp_core.cpp b/opencl/test/unit_test/xe_hp_core/hw_helper_tests_xe_hp_core.cpp index ea317033cd..afe165528c 100644 --- a/opencl/test/unit_test/xe_hp_core/hw_helper_tests_xe_hp_core.cpp +++ b/opencl/test/unit_test/xe_hp_core/hw_helper_tests_xe_hp_core.cpp @@ -62,49 +62,6 @@ XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, givenXE_HP_COREWhenEnableStatelessComp EXPECT_FALSE(clHwHelper.requiresAuxResolves(kernelInfo, *defaultHwInfo)); } -XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, givenGenHelperWhenRevisionIsAtLeastBThenAllowStatelessCompression) { - DebugManagerStateRestore restore; - DebugManager.flags.CreateMultipleSubDevices.set(1); - - auto &hwHelper = HwHelper::get(renderCoreFamily); - const auto &hwInfoConfig = *HwInfoConfig::get(productFamily); - auto hwInfo = *defaultHwInfo; - - for (auto revision : {REVISION_A0, REVISION_A1, REVISION_B}) { - hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(revision, hwInfo); - if (revision < REVISION_B) { - EXPECT_FALSE(hwHelper.allowStatelessCompression(hwInfo)); - } else { - EXPECT_TRUE(hwHelper.allowStatelessCompression(hwInfo)); - } - } -} - -XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, givenGenHelperWhenCreateMultipleSubDevicesThenDontAllowStatelessCompression) { - DebugManagerStateRestore restore; - DebugManager.flags.CreateMultipleSubDevices.set(2); - - auto &hwHelper = HwHelper::get(renderCoreFamily); - const auto &hwInfoConfig = *HwInfoConfig::get(productFamily); - auto hwInfo = *defaultHwInfo; - - hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_B, hwInfo); - EXPECT_FALSE(hwHelper.allowStatelessCompression(hwInfo)); -} - -XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, givenGenHelperWhenCreateMultipleSubDevicesAndEnableMultitileCompressionThenAllowStatelessCompression) { - DebugManagerStateRestore restore; - DebugManager.flags.CreateMultipleSubDevices.set(4); - DebugManager.flags.EnableMultiTileCompression.set(1); - - auto &hwHelper = HwHelper::get(renderCoreFamily); - const auto &hwInfoConfig = *HwInfoConfig::get(productFamily); - auto hwInfo = *defaultHwInfo; - - hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_B, hwInfo); - EXPECT_TRUE(hwHelper.allowStatelessCompression(hwInfo)); -} - XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, givenDifferentBufferSizesWhenEnableStatelessCompressionThenEveryBufferSizeIsSuitableForRenderCompression) { DebugManagerStateRestore restore; DebugManager.flags.EnableStatelessCompression.set(1); diff --git a/shared/source/helpers/extra_allocation_data_xehp_and_later.inl b/shared/source/helpers/extra_allocation_data_xehp_and_later.inl index 567458d2ec..f7686ce325 100644 --- a/shared/source/helpers/extra_allocation_data_xehp_and_later.inl +++ b/shared/source/helpers/extra_allocation_data_xehp_and_later.inl @@ -7,6 +7,7 @@ #include "shared/source/helpers/hw_helper.h" #include "shared/source/memory_manager/allocation_properties.h" +#include "shared/source/os_interface/hw_info_config.h" namespace NEO { @@ -27,8 +28,8 @@ void HwHelperHw::setExtraAllocationData(AllocationData &allocationData, } } - auto &helper = HwHelper::get(hwInfo.platform.eRenderCoreFamily); - if (helper.allowStatelessCompression(hwInfo)) { + const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily); + if (hwInfoConfig.allowStatelessCompression(hwInfo)) { if (properties.allocationType == GraphicsAllocation::AllocationType::GLOBAL_SURFACE || properties.allocationType == GraphicsAllocation::AllocationType::CONSTANT_SURFACE || properties.allocationType == GraphicsAllocation::AllocationType::PRINTF_SURFACE) { diff --git a/shared/source/helpers/hw_helper.h b/shared/source/helpers/hw_helper.h index 3f80789730..a8abd0bdbf 100644 --- a/shared/source/helpers/hw_helper.h +++ b/shared/source/helpers/hw_helper.h @@ -67,7 +67,6 @@ class HwHelper { virtual bool preferSmallWorkgroupSizeForKernel(const size_t size, const HardwareInfo &hwInfo) const = 0; virtual bool isBufferSizeSuitableForRenderCompression(const size_t size, const HardwareInfo &hwInfo) const = 0; virtual bool checkResourceCompatibility(GraphicsAllocation &graphicsAllocation) = 0; - virtual bool allowStatelessCompression(const HardwareInfo &hwInfo) const = 0; virtual bool isBlitCopyRequiredForLocalMemory(const HardwareInfo &hwInfo, const GraphicsAllocation &allocation) const = 0; virtual LocalMemoryAccessMode getLocalMemoryAccessMode(const HardwareInfo &hwInfo) const = 0; static bool renderCompressedBuffersSupported(const HardwareInfo &hwInfo); @@ -312,8 +311,6 @@ class HwHelperHw : public HwHelper { void setExtraAllocationData(AllocationData &allocationData, const AllocationProperties &properties, const HardwareInfo &hwInfo) const override; - bool allowStatelessCompression(const HardwareInfo &hwInfo) const override; - bool isBlitCopyRequiredForLocalMemory(const HardwareInfo &hwInfo, const GraphicsAllocation &allocation) const override; LocalMemoryAccessMode getLocalMemoryAccessMode(const HardwareInfo &hwInfo) const override; diff --git a/shared/source/helpers/hw_helper_base.inl b/shared/source/helpers/hw_helper_base.inl index 1020975eb6..79f76becf6 100644 --- a/shared/source/helpers/hw_helper_base.inl +++ b/shared/source/helpers/hw_helper_base.inl @@ -413,14 +413,6 @@ inline bool HwHelperHw::isSpecialWorkgroupSizeRequired(const Hardware return false; } -template -inline bool HwHelperHw::allowStatelessCompression(const HardwareInfo &hwInfo) const { - if (DebugManager.flags.EnableStatelessCompression.get() != -1) { - return static_cast(DebugManager.flags.EnableStatelessCompression.get()); - } - return false; -} - template inline bool HwHelperHw::isBlitCopyRequiredForLocalMemory(const HardwareInfo &hwInfo, const GraphicsAllocation &allocation) const { return allocation.isAllocatedInLocalMemoryPool() && diff --git a/shared/source/memory_manager/unified_memory_manager.cpp b/shared/source/memory_manager/unified_memory_manager.cpp index 2440beb529..070c519281 100644 --- a/shared/source/memory_manager/unified_memory_manager.cpp +++ b/shared/source/memory_manager/unified_memory_manager.cpp @@ -10,6 +10,7 @@ #include "shared/source/command_stream/command_stream_receiver.h" #include "shared/source/helpers/aligned_memory.h" #include "shared/source/memory_manager/memory_manager.h" +#include "shared/source/os_interface/hw_info_config.h" #include "opencl/source/mem_obj/mem_obj_helper.h" @@ -504,8 +505,8 @@ GraphicsAllocation::AllocationType SVMAllocsManager::getGraphicsAllocationType(c allocationType = GraphicsAllocation::AllocationType::WRITE_COMBINED; } else { UNRECOVERABLE_IF(nullptr == unifiedMemoryProperties.device); - auto &hwHelper = HwHelper::get(unifiedMemoryProperties.device->getHardwareInfo().platform.eRenderCoreFamily); - if (hwHelper.allowStatelessCompression(unifiedMemoryProperties.device->getHardwareInfo())) { + const auto &hwInfoConfig = *HwInfoConfig::get(unifiedMemoryProperties.device->getHardwareInfo().platform.eProductFamily); + if (hwInfoConfig.allowStatelessCompression(unifiedMemoryProperties.device->getHardwareInfo())) { allocationType = GraphicsAllocation::AllocationType::BUFFER_COMPRESSED; } else { allocationType = GraphicsAllocation::AllocationType::BUFFER; diff --git a/shared/source/os_interface/hw_info_config.h b/shared/source/os_interface/hw_info_config.h index f8f0852b88..ad665e9a86 100644 --- a/shared/source/os_interface/hw_info_config.h +++ b/shared/source/os_interface/hw_info_config.h @@ -55,6 +55,7 @@ class HwInfoConfig { virtual std::string getDeviceMemoryName() const = 0; virtual bool isDisableOverdispatchAvailable(const HardwareInfo &hwInfo) const = 0; virtual bool allowRenderCompression(const HardwareInfo &hwInfo) const = 0; + virtual bool allowStatelessCompression(const HardwareInfo &hwInfo) const = 0; uint32_t threadsPerEu; }; @@ -92,6 +93,7 @@ class HwInfoConfigHw : public HwInfoConfig { std::string getDeviceMemoryName() const override; bool isDisableOverdispatchAvailable(const HardwareInfo &hwInfo) const override; bool allowRenderCompression(const HardwareInfo &hwInfo) const override; + bool allowStatelessCompression(const HardwareInfo &hwInfo) const override; protected: HwInfoConfigHw() = default; diff --git a/shared/source/os_interface/hw_info_config.inl b/shared/source/os_interface/hw_info_config.inl index 72d5f64b7d..c49750c398 100644 --- a/shared/source/os_interface/hw_info_config.inl +++ b/shared/source/os_interface/hw_info_config.inl @@ -6,6 +6,7 @@ */ #include "shared/source/debug_settings/debug_settings_manager.h" +#include "shared/source/helpers/api_specific_config.h" #include "shared/source/helpers/hw_helper.h" #include "shared/source/os_interface/hw_info_config.h" @@ -155,4 +156,15 @@ template bool HwInfoConfigHw::allowRenderCompression(const HardwareInfo &hwInfo) const { return true; } + +template +bool HwInfoConfigHw::allowStatelessCompression(const HardwareInfo &hwInfo) const { + if (!NEO::ApiSpecificConfig::isStatelessCompressionSupported()) { + return false; + } + if (DebugManager.flags.EnableStatelessCompression.get() != -1) { + return static_cast(DebugManager.flags.EnableStatelessCompression.get()); + } + return false; +} } // namespace NEO diff --git a/shared/source/xe_hp_core/command_stream_receiver_hw_xe_hp_core.cpp b/shared/source/xe_hp_core/command_stream_receiver_hw_xe_hp_core.cpp index 50abb337a3..9fb2591d5b 100644 --- a/shared/source/xe_hp_core/command_stream_receiver_hw_xe_hp_core.cpp +++ b/shared/source/xe_hp_core/command_stream_receiver_hw_xe_hp_core.cpp @@ -34,8 +34,8 @@ void populateFactoryTable>() { template <> MemoryCompressionState CommandStreamReceiverHw::getMemoryCompressionState(bool auxTranslationRequired, const HardwareInfo &hwInfo) const { auto memoryCompressionState = MemoryCompressionState::NotApplicable; - auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily); - if (hwHelper.allowStatelessCompression(hwInfo)) { + const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily); + if (hwInfoConfig.allowStatelessCompression(hwInfo)) { memoryCompressionState = auxTranslationRequired ? MemoryCompressionState::Disabled : MemoryCompressionState::Enabled; } return memoryCompressionState; diff --git a/shared/source/xe_hp_core/hw_helper_xe_hp_core.cpp b/shared/source/xe_hp_core/hw_helper_xe_hp_core.cpp index d141bb0df4..64e0c3b0cc 100644 --- a/shared/source/xe_hp_core/hw_helper_xe_hp_core.cpp +++ b/shared/source/xe_hp_core/hw_helper_xe_hp_core.cpp @@ -79,23 +79,6 @@ template <> void HwHelperHw::setL1CachePolicy(bool useL1Cache, typename Family::RENDER_SURFACE_STATE *surfaceState, const HardwareInfo *hwInfo) { } -template <> -inline bool HwHelperHw::allowStatelessCompression(const HardwareInfo &hwInfo) const { - if (!NEO::ApiSpecificConfig::isStatelessCompressionSupported()) { - return false; - } - if (DebugManager.flags.EnableStatelessCompression.get() != -1) { - return static_cast(DebugManager.flags.EnableStatelessCompression.get()); - } - if (HwHelper::getSubDevicesCount(&hwInfo) > 1) { - return DebugManager.flags.EnableMultiTileCompression.get() > 0 ? true : false; - } - if (hwInfo.platform.usRevId < HwInfoConfig::get(hwInfo.platform.eProductFamily)->getHwRevIdFromStepping(REVISION_B, hwInfo)) { - return false; - } - return true; -} - template <> bool HwHelperHw::isBankOverrideRequired(const HardwareInfo &hwInfo) const { @@ -118,7 +101,7 @@ bool HwHelperHw::isBufferSizeSuitableForRenderCompression(const size_t s if (DebugManager.flags.OverrideBufferSuitableForRenderCompression.get() != -1) { return !!DebugManager.flags.OverrideBufferSuitableForRenderCompression.get(); } - if (allowStatelessCompression(hwInfo)) { + if (HwInfoConfig::get(hwInfo.platform.eProductFamily)->allowStatelessCompression(hwInfo)) { return true; } else { return size > KB; diff --git a/shared/source/xe_hp_core/os_agnostic_hw_info_config_xe_hp_core.inl b/shared/source/xe_hp_core/os_agnostic_hw_info_config_xe_hp_core.inl index aeef00dfd6..5480b1b4be 100644 --- a/shared/source/xe_hp_core/os_agnostic_hw_info_config_xe_hp_core.inl +++ b/shared/source/xe_hp_core/os_agnostic_hw_info_config_xe_hp_core.inl @@ -66,3 +66,20 @@ bool HwInfoConfigHw::allowRenderCompression(const HardwareInfo &hwIn } return true; } + +template <> +bool HwInfoConfigHw::allowStatelessCompression(const HardwareInfo &hwInfo) const { + if (!NEO::ApiSpecificConfig::isStatelessCompressionSupported()) { + return false; + } + if (DebugManager.flags.EnableStatelessCompression.get() != -1) { + return static_cast(DebugManager.flags.EnableStatelessCompression.get()); + } + if (HwHelper::getSubDevicesCount(&hwInfo) > 1) { + return DebugManager.flags.EnableMultiTileCompression.get() > 0 ? true : false; + } + if (hwInfo.platform.usRevId < getHwRevIdFromStepping(REVISION_B, hwInfo)) { + return false; + } + return true; +} diff --git a/shared/test/common/xe_hp_core/test_hw_info_config_xe_hp_core.cpp b/shared/test/common/xe_hp_core/test_hw_info_config_xe_hp_core.cpp index ec1fe4b73c..dc8ef172a0 100644 --- a/shared/test/common/xe_hp_core/test_hw_info_config_xe_hp_core.cpp +++ b/shared/test/common/xe_hp_core/test_hw_info_config_xe_hp_core.cpp @@ -8,6 +8,7 @@ #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 "test.h" @@ -29,4 +30,46 @@ XEHPTEST_F(XeHPMaxThreadsTest, givenXEHPWithBSteppingThenMaxThreadsForWorkgroupW hwInfo->platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_B, *hwInfo); auto isWARequired = hwInfoConfig.isMaxThreadsForWorkgroupWARequired(pDevice->getHardwareInfo()); EXPECT_FALSE(isWARequired); -} \ No newline at end of file +} + +using TestXeHPHwInfoConfig = Test; + +XEHPTEST_F(TestXeHPHwInfoConfig, givenHwInfoConfigWhenRevisionIsAtLeastBThenAllowStatelessCompression) { + DebugManagerStateRestore restore; + DebugManager.flags.CreateMultipleSubDevices.set(1); + + const auto &hwInfoConfig = *HwInfoConfig::get(productFamily); + auto hwInfo = *defaultHwInfo; + + for (auto revision : {REVISION_A0, REVISION_A1, REVISION_B}) { + hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(revision, hwInfo); + if (revision < REVISION_B) { + EXPECT_FALSE(hwInfoConfig.allowStatelessCompression(hwInfo)); + } else { + EXPECT_TRUE(hwInfoConfig.allowStatelessCompression(hwInfo)); + } + } +} + +XEHPTEST_F(TestXeHPHwInfoConfig, givenHwInfoConfigWhenCreateMultipleSubDevicesThenDontAllowStatelessCompression) { + DebugManagerStateRestore restore; + DebugManager.flags.CreateMultipleSubDevices.set(2); + + const auto &hwInfoConfig = *HwInfoConfig::get(productFamily); + auto hwInfo = *defaultHwInfo; + + hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_B, hwInfo); + EXPECT_FALSE(hwInfoConfig.allowStatelessCompression(hwInfo)); +} + +XEHPTEST_F(TestXeHPHwInfoConfig, givenHwInfoConfigWhenCreateMultipleSubDevicesAndEnableMultitileCompressionThenAllowStatelessCompression) { + DebugManagerStateRestore restore; + DebugManager.flags.CreateMultipleSubDevices.set(4); + DebugManager.flags.EnableMultiTileCompression.set(1); + + const auto &hwInfoConfig = *HwInfoConfig::get(productFamily); + auto hwInfo = *defaultHwInfo; + + hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_B, hwInfo); + EXPECT_TRUE(hwInfoConfig.allowStatelessCompression(hwInfo)); +} diff --git a/shared/test/unit_test/os_interface/os_agnostic_hw_info_config_tests.cpp b/shared/test/unit_test/os_interface/os_agnostic_hw_info_config_tests.cpp index e018778b04..a7ef6cc1de 100644 --- a/shared/test/unit_test/os_interface/os_agnostic_hw_info_config_tests.cpp +++ b/shared/test/unit_test/os_interface/os_agnostic_hw_info_config_tests.cpp @@ -141,6 +141,11 @@ bool HwInfoConfigHw::allowRenderCompression(const HardwareInfo &hw return false; } +template <> +bool HwInfoConfigHw::allowStatelessCompression(const HardwareInfo &hwInfo) const { + return false; +} + void OsAgnosticHwInfoConfigTest::SetUp() { DeviceFixture::SetUp(); }