mirror of
https://github.com/intel/compute-runtime.git
synced 2025-11-10 05:49:51 +08:00
Remove helper to get compression format for stateless compression in SBA
Signed-off-by: Milczarek, Slawomir <slawomir.milczarek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
323c4d8f6c
commit
e7085fdafc
@@ -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<MockHwHelperWithCompressionFormat<FamilyType>>(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<BufferHw<FamilyType>> buffer(static_cast<BufferHw<FamilyType> *>(
|
||||
BufferHw<FamilyType>::create(&context, {}, 0, 0, allocationSize, nullptr, nullptr, multiGraphicsAllocation, false, false, false)));
|
||||
|
||||
raiiFactory.mockHwHelper.compressionFormat = 0xF;
|
||||
|
||||
EncodeSurfaceState<FamilyType>::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<uint32_t>(0xF), rssCmd.getCompressionFormat());
|
||||
}
|
||||
|
||||
@@ -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<MockHwHelperWithCompressionFormat<FamilyType>>(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<FamilyType>::appendImageCompressionParams(&rss, image->getMultiGraphicsAllocation().getDefaultGraphicsAllocation(),
|
||||
context->getDevice(0)->getGmmHelper(), true);
|
||||
|
||||
EXPECT_EQ(static_cast<uint32_t>(0x2), rss.getCompressionFormat());
|
||||
}
|
||||
|
||||
HWTEST2_F(XeHPAndLaterImageHelperTests, givenNotMediaCompressedImageWhenStatelessCompressionIsEnabledThenApplyFormatForStatelessCompression, CompressionParamsSupportedMatcher) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.EnableStatelessCompression.set(1);
|
||||
|
||||
auto raiiFactory = RAIIHwHelperFactory<MockHwHelperWithCompressionFormat<FamilyType>>(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<FamilyType>::appendImageCompressionParams(&rss, image->getMultiGraphicsAllocation().getDefaultGraphicsAllocation(),
|
||||
context->getDevice(0)->getGmmHelper(), true);
|
||||
|
||||
EXPECT_EQ(static_cast<uint32_t>(0xF), rss.getCompressionFormat());
|
||||
}
|
||||
|
||||
@@ -26,13 +26,4 @@ class MockHwHelperWithLocalMemory : public HwHelperHw<GfxFamily> {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename GfxFamily>
|
||||
class MockHwHelperWithCompressionFormat : public HwHelperHw<GfxFamily> {
|
||||
public:
|
||||
uint32_t getFormatForStatelessCompression(const uint32_t format) const override {
|
||||
return compressionFormat;
|
||||
}
|
||||
uint32_t compressionFormat = 0;
|
||||
};
|
||||
} // namespace NEO
|
||||
|
||||
@@ -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<MockHwHelperWithCompressionFormat<FamilyType>>(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>(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<XY_COPY_BLT>();
|
||||
*bltCmd = FamilyType::cmdInitXyCopyBlt;
|
||||
|
||||
platformsImpl->clear();
|
||||
EXPECT_EQ(platform(), nullptr);
|
||||
|
||||
raiiFactory.mockHwHelper.compressionFormat = 0xF;
|
||||
|
||||
BlitCommandsHelper<FamilyType>::appendBlitCommandsForBuffer(blitProperties, *bltCmd, clDevice->getRootDeviceEnvironment());
|
||||
|
||||
EXPECT_EQ(static_cast<uint32_t>(0xF), bltCmd->getSourceCompressionFormat());
|
||||
EXPECT_EQ(static_cast<uint32_t>(0xF), bltCmd->getDestinationCompressionFormat());
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user