fix: do not prefer image compression on xe_lpg for linux and WSL

Related-To: HSD-18034872015
Signed-off-by: Jaroslaw Warchulski <jaroslaw.warchulski@intel.com>
This commit is contained in:
Jaroslaw Warchulski
2025-02-28 11:39:26 +00:00
committed by Compute-Runtime-Automation
parent 726d1b6dbb
commit 8814b6ac4f
16 changed files with 110 additions and 28 deletions

View File

@@ -211,7 +211,7 @@ Image *Image::create(Context *context,
auto &clGfxCoreHelper = defaultDevice->getRootDeviceEnvironment().getHelper<ClGfxCoreHelper>();
bool preferCompression = MemObjHelper::isSuitableForCompression(!imgInfo.linearStorage, memoryProperties,
*context, true);
*context, defaultProductHelper.isImageSuitableForCompression());
preferCompression &= clGfxCoreHelper.allowImageCompression(surfaceFormat->oclImageFormat);
preferCompression &= !clGfxCoreHelper.isFormatRedescribable(surfaceFormat->oclImageFormat);

View File

@@ -1113,7 +1113,13 @@ HWTEST_F(ImageCompressionTests, givenTiledImageWhenCreatingAllocationThenPreferC
ASSERT_NE(nullptr, image);
EXPECT_EQ(defaultHwInfo->capabilityTable.supportsImages, image->isTiledAllocation());
EXPECT_TRUE(myMemoryManager->mockMethodCalled);
EXPECT_EQ(defaultHwInfo->capabilityTable.supportsImages, myMemoryManager->capturedPreferCompressed);
auto isImageSuitableForCompression = context.getDevice(0)->getProductHelper().isImageSuitableForCompression();
if (isImageSuitableForCompression) {
EXPECT_EQ(defaultHwInfo->capabilityTable.supportsImages, myMemoryManager->capturedPreferCompressed);
} else {
EXPECT_FALSE(myMemoryManager->capturedPreferCompressed);
}
}
TEST_F(ImageCompressionTests, givenNonTiledImageWhenCreatingAllocationThenDontPreferCompression) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2023 Intel Corporation
* Copyright (C) 2021-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -7,12 +7,11 @@
#include "shared/test/common/helpers/unit_test_helper.h"
#include "opencl/source/helpers/cl_gfx_core_helper.h"
#include "opencl/source/helpers/cl_memory_properties_helpers.h"
#include "opencl/source/mem_obj/image.h"
#include "opencl/test/unit_test/mem_obj/image_compression_fixture.h"
XE_HPG_CORETEST_F(ImageCompressionTests, GivenDifferentImageFormatsWhenCreatingImageThenCompressionIsCorrectlySet) {
XE_HPG_CORETEST_F(ImageCompressionTests, givenDifferentImageFormatsWhenCreatingImageThenCompressionIsCorrectlySet) {
imageDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
imageDesc.image_width = 5;
imageDesc.image_height = 5;
@@ -49,11 +48,17 @@ XE_HPG_CORETEST_F(ImageCompressionTests, GivenDifferentImageFormatsWhenCreatingI
ASSERT_NE(nullptr, image);
EXPECT_TRUE(myMemoryManager->mockMethodCalled);
EXPECT_EQ(format.isCompressable, myMemoryManager->capturedPreferCompressed);
auto isImageSuitableForCompression = context.getDevice(0)->getProductHelper().isImageSuitableForCompression();
if (isImageSuitableForCompression) {
EXPECT_EQ(format.isCompressable, myMemoryManager->capturedPreferCompressed);
} else {
EXPECT_FALSE(myMemoryManager->capturedPreferCompressed);
}
}
}
XE_HPG_CORETEST_F(ImageCompressionTests, givenRedescribableFormatWhenCreatingAllocationThenDoNotPreferCompression) {
XE_HPG_CORETEST_F(ImageCompressionTests, givenRedescribableFormatWhenCreatingAllocationThenCompressionIsCorrectlySet) {
MockContext context{};
imageDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
imageDesc.image_width = 5;
@@ -65,7 +70,13 @@ XE_HPG_CORETEST_F(ImageCompressionTests, givenRedescribableFormatWhenCreatingAll
mockContext.get(), ClMemoryPropertiesHelper::createMemoryProperties(flags, 0, 0, &context.getDevice(0)->getDevice()),
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
ASSERT_NE(nullptr, image);
EXPECT_EQ(defaultHwInfo->capabilityTable.supportsImages, myMemoryManager->capturedPreferCompressed);
auto isImageSuitableForCompression = context.getDevice(0)->getProductHelper().isImageSuitableForCompression();
if (isImageSuitableForCompression) {
EXPECT_EQ(defaultHwInfo->capabilityTable.supportsImages, myMemoryManager->capturedPreferCompressed);
} else {
EXPECT_FALSE(myMemoryManager->capturedPreferCompressed);
}
imageFormat.image_channel_order = CL_RG;
surfaceFormat = Image::getSurfaceFormatFromTable(
@@ -74,5 +85,10 @@ XE_HPG_CORETEST_F(ImageCompressionTests, givenRedescribableFormatWhenCreatingAll
mockContext.get(), ClMemoryPropertiesHelper::createMemoryProperties(flags, 0, 0, &context.getDevice(0)->getDevice()),
flags, 0, surfaceFormat, &imageDesc, nullptr, retVal));
ASSERT_NE(nullptr, image);
EXPECT_TRUE(myMemoryManager->capturedPreferCompressed);
}
if (isImageSuitableForCompression) {
EXPECT_TRUE(myMemoryManager->capturedPreferCompressed);
} else {
EXPECT_FALSE(myMemoryManager->capturedPreferCompressed);
}
}