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:
parent
726d1b6dbb
commit
8814b6ac4f
|
@ -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);
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -184,6 +184,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, EnableMultiTileCompression, -1, "-1: default, 0:
|
|||
DECLARE_DEBUG_VARIABLE(int32_t, OverrideGmmResourceUsageField, -1, "-1: default, >=0: gmm.resourceParams.Usage is set to this value")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, OverrideGmmCacheableField, -1, "-1: default, >=0: gmm Flags.Info.Cacheable is set to this value")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, OverrideBufferSuitableForRenderCompression, -1, "-1: default, 0: Disable, 1: Enable")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, OverrideImageSuitableForRenderCompression, -1, "-1: default, 0: Disable, 1: Enable")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, OverrideL1CacheControlInSurfaceState, -1, "-1: feature inactive, >=0 : following L1 cache control value will be programmed in render surface state (for regular buffers)")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, OverrideL1CacheControlInSurfaceStateForScratchSpace, -1, "-1: feature inactive, >=0 : following L1 cache control value will be programmed in render surface state for scratch space")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, OverridePreferredSlmAllocationSizePerDss, -1, "-1: default, >=0: program value for preferred SLM allocation size per dss")
|
||||
|
|
|
@ -258,6 +258,7 @@ class ProductHelper {
|
|||
virtual uint32_t getNumCacheRegions() const = 0;
|
||||
virtual uint64_t getPatIndex(CacheRegion cacheRegion, CachePolicy cachePolicy) const = 0;
|
||||
virtual bool isSharingWith3dOrMediaAllowed() const = 0;
|
||||
virtual bool isImageSuitableForCompression() const = 0;
|
||||
|
||||
virtual ~ProductHelper() = default;
|
||||
|
||||
|
|
|
@ -1005,4 +1005,12 @@ bool ProductHelperHw<gfxProduct>::isEvictionIfNecessaryFlagSupported() const {
|
|||
return true;
|
||||
}
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
bool ProductHelperHw<gfxProduct>::isImageSuitableForCompression() const {
|
||||
if (debugManager.flags.OverrideImageSuitableForRenderCompression.get() != -1) {
|
||||
return !!debugManager.flags.OverrideImageSuitableForRenderCompression.get();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
|
|
@ -199,6 +199,7 @@ class ProductHelperHw : public ProductHelper {
|
|||
uint32_t getNumCacheRegions() const override;
|
||||
uint64_t getPatIndex(CacheRegion cacheRegion, CachePolicy cachePolicy) const override;
|
||||
bool isSharingWith3dOrMediaAllowed() const override;
|
||||
bool isImageSuitableForCompression() const override;
|
||||
|
||||
~ProductHelperHw() override = default;
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/source/memory_manager/allocation_type.h"
|
||||
#include "shared/source/os_interface/linux/product_helper_mtl_and_later.inl"
|
||||
|
@ -13,6 +14,8 @@
|
|||
namespace NEO {
|
||||
template <>
|
||||
int ProductHelperHw<gfxProduct>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) const {
|
||||
enableCompression(hwInfo);
|
||||
|
||||
enableBlitterOperationsSupport(hwInfo);
|
||||
|
||||
auto &kmdNotifyProperties = hwInfo->capabilityTable.kmdNotifyProperties;
|
||||
|
@ -49,4 +52,12 @@ bool ProductHelperHw<gfxProduct>::useGemCreateExtInAllocateMemoryByKMD() const {
|
|||
return true;
|
||||
}
|
||||
|
||||
template <>
|
||||
bool ProductHelperHw<gfxProduct>::isImageSuitableForCompression() const {
|
||||
if (debugManager.flags.OverrideImageSuitableForRenderCompression.get() != -1) {
|
||||
return !!debugManager.flags.OverrideImageSuitableForRenderCompression.get();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
|
|
@ -390,6 +390,7 @@ ProgramWalkerPartitionSelfCleanup = -1
|
|||
WparidRegisterProgramming = -1
|
||||
UsePipeControlAfterPartitionedWalker = -1
|
||||
OverrideBufferSuitableForRenderCompression = -1
|
||||
OverrideImageSuitableForRenderCompression = -1
|
||||
AllowPatchingVfeStateInCommandLists = 0
|
||||
PrintMemoryRegionSizes = 0
|
||||
OverrideDrmRegion = -1
|
||||
|
|
|
@ -1143,3 +1143,17 @@ HWTEST2_F(ProductHelperTest, WhenCheckAssignEngineRoundRobinSupportedThenReturnF
|
|||
auto hwInfo = *defaultHwInfo;
|
||||
EXPECT_EQ(0u, productHelper->getMaxLocalSubRegionSize(hwInfo));
|
||||
}
|
||||
|
||||
HWTEST2_F(ProductHelperTest, givenProductHelperWhenAskedIsImageSuitableForCompressionThenReturnTrue, IsNotXeHpgCore) {
|
||||
EXPECT_TRUE(productHelper->isImageSuitableForCompression());
|
||||
}
|
||||
|
||||
HWTEST_F(ProductHelperTest, givenDebugFlagWhenCheckingIfImageIsSuitableForCompressionThenReturnCorrectValue) {
|
||||
DebugManagerStateRestore restore;
|
||||
|
||||
debugManager.flags.OverrideImageSuitableForRenderCompression.set(0);
|
||||
EXPECT_FALSE(productHelper->isImageSuitableForCompression());
|
||||
|
||||
debugManager.flags.OverrideImageSuitableForRenderCompression.set(1);
|
||||
EXPECT_TRUE(productHelper->isImageSuitableForCompression());
|
||||
}
|
||||
|
|
|
@ -100,12 +100,6 @@ ARLTEST_F(ArlProductHelperLinux, givenBooleanUncachedWhenCallOverridePatIndexThe
|
|||
EXPECT_EQ(3u, productHelper->overridePatIndex(isUncached, patIndex, AllocationType::commandBuffer));
|
||||
}
|
||||
|
||||
ARLTEST_F(ArlProductHelperLinux, givenProductHelperWhenCallConfigureHardwareCustomThenCompressionIsDisabled) {
|
||||
auto hwInfo = *defaultHwInfo;
|
||||
hwInfo.featureTable.flags.ftrE2ECompression = true;
|
||||
|
||||
productHelper->configureHardwareCustom(&hwInfo, nullptr);
|
||||
|
||||
EXPECT_FALSE(hwInfo.capabilityTable.ftrRenderCompressedBuffers);
|
||||
EXPECT_FALSE(hwInfo.capabilityTable.ftrRenderCompressedImages);
|
||||
ARLTEST_F(ArlProductHelperLinux, givenProductHelperWhenAskedIsImageSuitableForCompressionThenReturnFalse) {
|
||||
EXPECT_FALSE(productHelper->isImageSuitableForCompression());
|
||||
}
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
#
|
||||
# Copyright (C) 2025 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
if(WIN32)
|
||||
target_sources(neo_shared_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/product_helper_tests_arl_windows.cpp)
|
||||
endif()
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* Copyright (C) 2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/xe_hpg_core/hw_info_xe_hpg_core.h"
|
||||
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
|
||||
#include "shared/test/unit_test/os_interface/windows/product_helper_win_tests.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using ArlProductHelperWindows = ProductHelperTestWindows;
|
||||
|
||||
ARLTEST_F(ArlProductHelperWindows, givenProductHelperWhenAskedIsImageSuitableForCompressionThenReturnTrue) {
|
||||
EXPECT_TRUE(productHelper->isImageSuitableForCompression());
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2022-2024 Intel Corporation
|
||||
* Copyright (C) 2022-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -845,3 +845,7 @@ DG2TEST_F(ProductHelperTestDg2, givenProductHelperWhenGettingEvictIfNecessaryFla
|
|||
DG2TEST_F(ProductHelperTestDg2, givenProductHelperWhenGettingUseLocalPreferredForCacheableBuffersThenExpectTrue) {
|
||||
EXPECT_TRUE(productHelper->useLocalPreferredForCacheableBuffers());
|
||||
}
|
||||
|
||||
DG2TEST_F(ProductHelperTestDg2, givenProductHelperWhenAskedIsImageSuitableForCompressionThenReturnTrue) {
|
||||
EXPECT_TRUE(productHelper->isImageSuitableForCompression());
|
||||
}
|
||||
|
|
|
@ -74,12 +74,6 @@ MTLTEST_F(MtlProductHelperLinux, givenBooleanUncachedWhenCallOverridePatIndexThe
|
|||
EXPECT_EQ(3u, productHelper->overridePatIndex(isUncached, patIndex, AllocationType::commandBuffer));
|
||||
}
|
||||
|
||||
MTLTEST_F(MtlProductHelperLinux, givenProductHelperWhenCallConfigureHardwareCustomThenCompressionIsDisabled) {
|
||||
auto hwInfo = *defaultHwInfo;
|
||||
hwInfo.featureTable.flags.ftrE2ECompression = true;
|
||||
|
||||
productHelper->configureHardwareCustom(&hwInfo, nullptr);
|
||||
|
||||
EXPECT_FALSE(hwInfo.capabilityTable.ftrRenderCompressedBuffers);
|
||||
EXPECT_FALSE(hwInfo.capabilityTable.ftrRenderCompressedImages);
|
||||
MTLTEST_F(MtlProductHelperLinux, givenProductHelperWhenAskedIsImageSuitableForCompressionThenReturnFalse) {
|
||||
EXPECT_FALSE(productHelper->isImageSuitableForCompression());
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2023-2024 Intel Corporation
|
||||
* Copyright (C) 2023-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -24,3 +24,7 @@ MTLTEST_F(MtlProductHelperWindows, whenCheckingIsTimestampWaitSupportedForEvents
|
|||
MTLTEST_F(MtlProductHelperWindows, givenProductHelperWhenIsStagingBuffersEnabledThenTrueIsReturned) {
|
||||
EXPECT_TRUE(productHelper->isStagingBuffersEnabled());
|
||||
}
|
||||
|
||||
MTLTEST_F(MtlProductHelperWindows, givenProductHelperWhenAskedIsImageSuitableForCompressionThenReturnTrue) {
|
||||
EXPECT_TRUE(productHelper->isImageSuitableForCompression());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue