From e7085fdafc2cabd607c6ac55e9f095056527aa68 Mon Sep 17 00:00:00 2001 From: "Milczarek, Slawomir" Date: Fri, 27 Aug 2021 08:39:31 +0000 Subject: [PATCH] Remove helper to get compression format for stateless compression in SBA Signed-off-by: Milczarek, Slawomir --- .../helpers/test_preamble_xehp_and_later.cpp | 33 --------------- .../mem_obj/image_tests_xehp_and_later.cpp | 42 ------------------- opencl/test/unit_test/mocks/mock_hw_helper.h | 9 ---- .../copy_engine_tests_xe_hp_core.cpp | 37 ---------------- .../xe_hp_core/hw_helper_tests_xe_hp_core.cpp | 7 ---- .../command_encoder_xehp_and_later.inl | 5 --- .../compression_params_xehp_and_later.inl | 7 ---- .../blit_commands_helper_xehp_and_later.inl | 12 ------ shared/source/helpers/hw_helper.h | 3 -- shared/source/helpers/hw_helper_base.inl | 5 --- ...st_blit_commands_helper_xehp_and_later.cpp | 25 ----------- 11 files changed, 185 deletions(-) diff --git a/opencl/test/unit_test/helpers/test_preamble_xehp_and_later.cpp b/opencl/test/unit_test/helpers/test_preamble_xehp_and_later.cpp index a0b7131721..e717a3f68d 100644 --- a/opencl/test/unit_test/helpers/test_preamble_xehp_and_later.cpp +++ b/opencl/test/unit_test/helpers/test_preamble_xehp_and_later.cpp @@ -15,8 +15,6 @@ #include "opencl/source/helpers/hardware_commands_helper.h" #include "opencl/source/mem_obj/buffer.h" #include "opencl/test/unit_test/fixtures/ult_command_stream_receiver_fixture.h" -#include "opencl/test/unit_test/helpers/raii_hw_helper.h" -#include "opencl/test/unit_test/mocks/mock_hw_helper.h" #include "opencl/test/unit_test/mocks/mock_kernel.h" #include "reg_configs_common.h" @@ -581,34 +579,3 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, RenderSurfaceStateXeHPAndLaterTests, givenSpecificP EXPECT_EQ(FamilyType::RENDER_SURFACE_STATE::COHERENCY_TYPE_GPU_COHERENT, rssCmd.getCoherencyType()); } - -HWCMDTEST_F(IGFX_XE_HP_CORE, RenderSurfaceStateXeHPAndLaterTests, givenEncodeBufferWhenStatelessCompressionIsEnabledThenApplyFormatForStatelessCompression) { - DebugManagerStateRestore dbgRestore; - DebugManager.flags.EnableStatelessCompression.set(1); - - auto raiiFactory = RAIIHwHelperFactory>(defaultHwInfo->platform.eRenderCoreFamily); - - auto memoryManager = pDevice->getExecutionEnvironment()->memoryManager.get(); - size_t allocationSize = MemoryConstants::pageSize; - AllocationProperties properties(pDevice->getRootDeviceIndex(), allocationSize, GraphicsAllocation::AllocationType::BUFFER_COMPRESSED, pDevice->getDeviceBitfield()); - auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties); - allocation->setDefaultGmm(new Gmm(pClDevice->getRootDeviceEnvironment().getGmmClientContext(), allocation->getUnderlyingBuffer(), allocation->getUnderlyingBufferSize(), 0, false)); - allocation->getDefaultGmm()->isCompressionEnabled = true; - - auto rssCmd = FamilyType::cmdInitRenderSurfaceState; - - MockContext context(pClDevice); - auto multiGraphicsAllocation = MultiGraphicsAllocation(pClDevice->getRootDeviceIndex()); - multiGraphicsAllocation.addAllocation(allocation); - - std::unique_ptr> buffer(static_cast *>( - BufferHw::create(&context, {}, 0, 0, allocationSize, nullptr, nullptr, multiGraphicsAllocation, false, false, false))); - - raiiFactory.mockHwHelper.compressionFormat = 0xF; - - EncodeSurfaceState::encodeBuffer(&rssCmd, allocation->getGpuAddress(), allocation->getUnderlyingBufferSize(), - buffer->getMocsValue(false, false, pClDevice->getRootDeviceIndex()), false, false, false, - pClDevice->getNumAvailableDevices(), allocation, pClDevice->getGmmHelper(), false, 1u); - - EXPECT_EQ(static_cast(0xF), rssCmd.getCompressionFormat()); -} diff --git a/opencl/test/unit_test/mem_obj/image_tests_xehp_and_later.cpp b/opencl/test/unit_test/mem_obj/image_tests_xehp_and_later.cpp index 9b71bfc4c7..1520d7940c 100644 --- a/opencl/test/unit_test/mem_obj/image_tests_xehp_and_later.cpp +++ b/opencl/test/unit_test/mem_obj/image_tests_xehp_and_later.cpp @@ -14,11 +14,9 @@ #include "shared/test/common/helpers/variable_backup.h" #include "opencl/test/unit_test/fixtures/image_fixture.h" -#include "opencl/test/unit_test/helpers/raii_hw_helper.h" #include "opencl/test/unit_test/mocks/mock_allocation_properties.h" #include "opencl/test/unit_test/mocks/mock_context.h" #include "opencl/test/unit_test/mocks/mock_gmm.h" -#include "opencl/test/unit_test/mocks/mock_hw_helper.h" #include "opencl/test/unit_test/mocks/mock_platform.h" #include "test.h" @@ -661,43 +659,3 @@ HWTEST2_F(XeHPAndLaterImageHelperTests, givenNotMediaCompressedImageWhenAppendin EXPECT_EQ(expectedGetSurfaceStateCompressionFormatCalled, gmmClientContext->getSurfaceStateCompressionFormatCalled); EXPECT_EQ(expectedGetMediaSurfaceStateCompressionFormatCalled, gmmClientContext->getMediaSurfaceStateCompressionFormatCalled); } - -HWTEST2_F(XeHPAndLaterImageHelperTests, givenMediaCompressedImageWhenImageFromBufferIsCreatedAndForceBufferCompressionFormatIsSpecifiedThenApplyFormatCorrectly, CompressionParamsSupportedMatcher) { - DebugManagerStateRestore restorer; - DebugManager.flags.ForceBufferCompressionFormat.set(0x2); - - auto raiiFactory = RAIIHwHelperFactory>(defaultHwInfo->platform.eRenderCoreFamily); - - using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE; - RENDER_SURFACE_STATE rss{}; - platformsImpl->clear(); - rss.setMemoryCompressionEnable(true); - mockGmmResourceInfo->getResourceFlags()->Info.MediaCompressed = true; - gmmClientContext->compressionFormatToReturn = mockCompressionFormat; - - EncodeSurfaceState::appendImageCompressionParams(&rss, image->getMultiGraphicsAllocation().getDefaultGraphicsAllocation(), - context->getDevice(0)->getGmmHelper(), true); - - EXPECT_EQ(static_cast(0x2), rss.getCompressionFormat()); -} - -HWTEST2_F(XeHPAndLaterImageHelperTests, givenNotMediaCompressedImageWhenStatelessCompressionIsEnabledThenApplyFormatForStatelessCompression, CompressionParamsSupportedMatcher) { - DebugManagerStateRestore restorer; - DebugManager.flags.EnableStatelessCompression.set(1); - - auto raiiFactory = RAIIHwHelperFactory>(defaultHwInfo->platform.eRenderCoreFamily); - - using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE; - RENDER_SURFACE_STATE rss{}; - platformsImpl->clear(); - rss.setMemoryCompressionEnable(true); - mockGmmResourceInfo->getResourceFlags()->Info.MediaCompressed = false; - gmmClientContext->compressionFormatToReturn = mockCompressionFormat; - - raiiFactory.mockHwHelper.compressionFormat = 0xF; - - EncodeSurfaceState::appendImageCompressionParams(&rss, image->getMultiGraphicsAllocation().getDefaultGraphicsAllocation(), - context->getDevice(0)->getGmmHelper(), true); - - EXPECT_EQ(static_cast(0xF), rss.getCompressionFormat()); -} diff --git a/opencl/test/unit_test/mocks/mock_hw_helper.h b/opencl/test/unit_test/mocks/mock_hw_helper.h index 78e0bb66c0..063e74e174 100644 --- a/opencl/test/unit_test/mocks/mock_hw_helper.h +++ b/opencl/test/unit_test/mocks/mock_hw_helper.h @@ -26,13 +26,4 @@ class MockHwHelperWithLocalMemory : public HwHelperHw { return true; } }; - -template -class MockHwHelperWithCompressionFormat : public HwHelperHw { - public: - uint32_t getFormatForStatelessCompression(const uint32_t format) const override { - return compressionFormat; - } - uint32_t compressionFormat = 0; -}; } // namespace NEO diff --git a/opencl/test/unit_test/xe_hp_core/copy_engine_tests_xe_hp_core.cpp b/opencl/test/unit_test/xe_hp_core/copy_engine_tests_xe_hp_core.cpp index 89ebeaaf6d..2d90148255 100644 --- a/opencl/test/unit_test/xe_hp_core/copy_engine_tests_xe_hp_core.cpp +++ b/opencl/test/unit_test/xe_hp_core/copy_engine_tests_xe_hp_core.cpp @@ -16,12 +16,10 @@ #include "shared/test/unit_test/utilities/base_object_utils.h" #include "opencl/source/command_queue/command_queue_hw.h" -#include "opencl/test/unit_test/helpers/raii_hw_helper.h" #include "opencl/test/unit_test/libult/ult_command_stream_receiver.h" #include "opencl/test/unit_test/mocks/mock_cl_device.h" #include "opencl/test/unit_test/mocks/mock_context.h" #include "opencl/test/unit_test/mocks/mock_gmm.h" -#include "opencl/test/unit_test/mocks/mock_hw_helper.h" #include "test.h" using namespace NEO; @@ -712,38 +710,3 @@ XE_HP_CORE_TEST_F(BlitXE_HP_CORETests, givenCommandQueueWhenAskingForCacheFlushO EXPECT_TRUE(pHwQ->isCacheFlushForBcsRequired()); } - -XE_HP_CORE_TEST_F(BlitXE_HP_CORETests, givenAppendBlitCommandsForBufferWhenStatelessCompressionIsEnabledThenApplyFormatForStatelessCompression) { - using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT; - - DebugManager.flags.EnableStatelessCompression.set(1); - - auto raiiFactory = RAIIHwHelperFactory>(defaultHwInfo->platform.eRenderCoreFamily); - - char buff[1024] = {0}; - LinearStream stream(buff, 1024); - MockGraphicsAllocation clearColorAlloc; - MockContext context(clDevice.get()); - cl_int retVal = CL_SUCCESS; - - auto buffer = clUniquePtr(Buffer::create(&context, {}, MemoryConstants::pageSize64k, nullptr, retVal)); - EXPECT_EQ(CL_SUCCESS, retVal); - - auto allocation = buffer->getGraphicsAllocation(clDevice->getRootDeviceIndex()); - EXPECT_TRUE(!MemoryPool::isSystemMemoryPool(allocation->getMemoryPool())); - - auto blitProperties = BlitProperties::constructPropertiesForCopy(allocation, allocation, - 0, 0, {BlitterConstants::maxBlitWidth - 1, 1, 1}, 0, 0, 0, 0, &clearColorAlloc); - auto bltCmd = stream.getSpaceForCmd(); - *bltCmd = FamilyType::cmdInitXyCopyBlt; - - platformsImpl->clear(); - EXPECT_EQ(platform(), nullptr); - - raiiFactory.mockHwHelper.compressionFormat = 0xF; - - BlitCommandsHelper::appendBlitCommandsForBuffer(blitProperties, *bltCmd, clDevice->getRootDeviceEnvironment()); - - EXPECT_EQ(static_cast(0xF), bltCmd->getSourceCompressionFormat()); - EXPECT_EQ(static_cast(0xF), bltCmd->getDestinationCompressionFormat()); -} 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 7059da6c5f..e52b582949 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 @@ -79,13 +79,6 @@ XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, givenGenHelperWhenRevisionIsAtLeastBTh } } -XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, givenHwHelperWhenGettingFormatForStatelessCompressionThenCorrectValueIsReturned) { - auto &hwHelper = HwHelper::get(pDevice->getHardwareInfo().platform.eRenderCoreFamily); - uint32_t format = 0x2; - - EXPECT_EQ(format, hwHelper.getFormatForStatelessCompression(format)); -} - XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, givenGenHelperWhenCreateMultipleSubDevicesThenDontAllowStatelessCompression) { DebugManagerStateRestore restore; DebugManager.flags.CreateMultipleSubDevices.set(2); 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 bb2db00806..6de165b6e7 100644 --- a/shared/source/command_container/command_encoder_xehp_and_later.inl +++ b/shared/source/command_container/command_encoder_xehp_and_later.inl @@ -631,11 +631,6 @@ void EncodeSurfaceState::encodeExtraBufferParams(R_SURFACE_STATE *sur auto resourceFormat = gmm->gmmResourceInfo->getResourceFormat(); compressionFormat = gmmHelper->getClientContext()->getSurfaceStateCompressionFormat(resourceFormat); - auto &hwHelper = HwHelper::get(gmmHelper->getHardwareInfo()->platform.eRenderCoreFamily); - if (hwHelper.allowStatelessCompression(*gmmHelper->getHardwareInfo())) { - compressionFormat = hwHelper.getFormatForStatelessCompression(compressionFormat); - } - if (DebugManager.flags.ForceBufferCompressionFormat.get() != -1) { compressionFormat = DebugManager.flags.ForceBufferCompressionFormat.get(); } diff --git a/shared/source/command_container/image_surface_state/compression_params_xehp_and_later.inl b/shared/source/command_container/image_surface_state/compression_params_xehp_and_later.inl index ff9e0a9ef3..da39f49c4c 100644 --- a/shared/source/command_container/image_surface_state/compression_params_xehp_and_later.inl +++ b/shared/source/command_container/image_surface_state/compression_params_xehp_and_later.inl @@ -23,13 +23,6 @@ void EncodeSurfaceState::appendImageCompressionParams(R_SURFACE_STATE *s } if (imageFromBuffer) { - if (!gmmResourceInfo->getResourceFlags()->Info.MediaCompressed) { - auto &hwHelper = HwHelper::get(gmmHelper->getHardwareInfo()->platform.eRenderCoreFamily); - if (hwHelper.allowStatelessCompression(*gmmHelper->getHardwareInfo())) { - compressionFormat = hwHelper.getFormatForStatelessCompression(compressionFormat); - } - } - if (DebugManager.flags.ForceBufferCompressionFormat.get() != -1) { compressionFormat = DebugManager.flags.ForceBufferCompressionFormat.get(); } diff --git a/shared/source/helpers/blit_commands_helper_xehp_and_later.inl b/shared/source/helpers/blit_commands_helper_xehp_and_later.inl index 6c552b3301..42e439b1fe 100644 --- a/shared/source/helpers/blit_commands_helper_xehp_and_later.inl +++ b/shared/source/helpers/blit_commands_helper_xehp_and_later.inl @@ -47,12 +47,6 @@ void BlitCommandsHelper::appendBlitCommandsForBuffer(const BlitProper appendClearColor(blitProperties, blitCmd); uint32_t compressionFormat = rootDeviceEnvironment.getGmmClientContext()->getSurfaceStateCompressionFormat(GMM_RESOURCE_FORMAT::GMM_FORMAT_GENERIC_8BIT); - - auto &hwHelper = HwHelper::get(rootDeviceEnvironment.getHardwareInfo()->platform.eRenderCoreFamily); - if (hwHelper.allowStatelessCompression(*rootDeviceEnvironment.getHardwareInfo())) { - compressionFormat = hwHelper.getFormatForStatelessCompression(compressionFormat); - } - if (DebugManager.flags.ForceBufferCompressionFormat.get() != -1) { compressionFormat = DebugManager.flags.ForceBufferCompressionFormat.get(); } @@ -138,12 +132,6 @@ void BlitCommandsHelper::appendBlitCommandsForFillBuffer(NEO::Graphic bool dstAllocationisCompressionEnabled = dstAlloc->getDefaultGmm() && dstAlloc->getDefaultGmm()->isCompressionEnabled; uint32_t compressionFormat = rootDeviceEnvironment.getGmmClientContext()->getSurfaceStateCompressionFormat(GMM_RESOURCE_FORMAT::GMM_FORMAT_GENERIC_8BIT); - - auto &hwHelper = HwHelper::get(rootDeviceEnvironment.getHardwareInfo()->platform.eRenderCoreFamily); - if (hwHelper.allowStatelessCompression(*rootDeviceEnvironment.getHardwareInfo())) { - compressionFormat = hwHelper.getFormatForStatelessCompression(compressionFormat); - } - if (DebugManager.flags.ForceBufferCompressionFormat.get() != -1) { compressionFormat = DebugManager.flags.ForceBufferCompressionFormat.get(); } diff --git a/shared/source/helpers/hw_helper.h b/shared/source/helpers/hw_helper.h index bd0e402311..b1a09c4cfe 100644 --- a/shared/source/helpers/hw_helper.h +++ b/shared/source/helpers/hw_helper.h @@ -69,7 +69,6 @@ class HwHelper { virtual bool checkResourceCompatibility(GraphicsAllocation &graphicsAllocation) = 0; virtual bool allowRenderCompression(const HardwareInfo &hwInfo) const = 0; virtual bool allowStatelessCompression(const HardwareInfo &hwInfo) const = 0; - virtual uint32_t getFormatForStatelessCompression(const uint32_t format) 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); @@ -319,8 +318,6 @@ class HwHelperHw : public HwHelper { bool allowStatelessCompression(const HardwareInfo &hwInfo) const override; - uint32_t getFormatForStatelessCompression(const uint32_t format) 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 fb292005d8..199ddffff2 100644 --- a/shared/source/helpers/hw_helper_base.inl +++ b/shared/source/helpers/hw_helper_base.inl @@ -450,11 +450,6 @@ inline bool HwHelperHw::allowStatelessCompression(const HardwareInfo return false; } -template -inline uint32_t HwHelperHw::getFormatForStatelessCompression(const uint32_t format) const { - return format; -} - template inline bool HwHelperHw::isBlitCopyRequiredForLocalMemory(const HardwareInfo &hwInfo, const GraphicsAllocation &allocation) const { return allocation.isAllocatedInLocalMemoryPool() && diff --git a/shared/test/common/helpers/test_blit_commands_helper_xehp_and_later.cpp b/shared/test/common/helpers/test_blit_commands_helper_xehp_and_later.cpp index 7233f6664d..d57e3a2f59 100644 --- a/shared/test/common/helpers/test_blit_commands_helper_xehp_and_later.cpp +++ b/shared/test/common/helpers/test_blit_commands_helper_xehp_and_later.cpp @@ -13,9 +13,7 @@ #include "shared/test/common/mocks/ult_device_factory.h" #include "opencl/test/unit_test/fixtures/cl_device_fixture.h" -#include "opencl/test/unit_test/helpers/raii_hw_helper.h" #include "opencl/test/unit_test/mocks/mock_gmm.h" -#include "opencl/test/unit_test/mocks/mock_hw_helper.h" #include "gtest/gtest.h" #include "test_traits_common.h" @@ -898,29 +896,6 @@ HWTEST2_F(BlitTests, givenMemorySizeTwiceBiggerThanMaxWidthWhenFillPatternWithBl } } -HWTEST2_F(BlitTests, givenAppendBlitCommandsForFillBufferWhenStatelessCompressionIsEnabledThenApplyApplyFormatForStatelessCompression, BlitPlatforms) { - using XY_COLOR_BLT = typename FamilyType::XY_COLOR_BLT; - - DebugManagerStateRestore dbgRestore; - DebugManager.flags.EnableStatelessCompression.set(1); - - auto raiiFactory = RAIIHwHelperFactory>(defaultHwInfo->platform.eRenderCoreFamily); - - auto blitCmd = FamilyType::cmdInitXyColorBlt; - auto gmm = std::make_unique(); - gmm->isCompressionEnabled = true; - MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY, - reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), - MemoryPool::System4KBPages, mockMaxOsContextCount); - mockAllocation.setGmm(gmm.get(), 0); - - raiiFactory.mockHwHelper.compressionFormat = 0xF; - - BlitCommandsHelper::appendBlitCommandsForFillBuffer(&mockAllocation, blitCmd, *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]); - - EXPECT_EQ(static_cast(0xF), blitCmd.getDestinationCompressionFormat()); -} - using IsXeHPOrAbove = IsAtLeastProduct; HWTEST2_F(BlitTests, givenEnabledGlobalCacheInvalidationWhenProgrammingGlobalSequencerFlushThenCommandsAreProgrammed, IsXeHPOrAbove) {