fix: respect compression flag in capability table

Related-To: NEO-9465
Signed-off-by: Jaroslaw Warchulski <jaroslaw.warchulski@intel.com>
This commit is contained in:
Jaroslaw Warchulski
2025-04-03 13:20:54 +00:00
committed by Compute-Runtime-Automation
parent f76b6af8d4
commit c010d17842
36 changed files with 236 additions and 168 deletions

View File

@@ -341,10 +341,6 @@ template <>
void ProductHelperHw<IGFX_UNKNOWN>::updateScmCommand(void *const commandPtr, const StateComputeModeProperties &properties) const {
}
template <>
void ProductHelperHw<IGFX_UNKNOWN>::enableCompression(HardwareInfo *hwInfo) const {
}
template <>
bool ProductHelperHw<IGFX_UNKNOWN>::isCooperativeEngineSupported(const HardwareInfo &hwInfo) const {
return false;
@@ -504,6 +500,14 @@ bool ProductHelperHw<IGFX_UNKNOWN>::is48bResourceNeededForRayTracing() const {
return true;
}
template <>
bool ProductHelperHw<IGFX_UNKNOWN>::isCompressionForbidden(const HardwareInfo &hwInfo) const {
return false;
}
template <>
void ProductHelperHw<IGFX_UNKNOWN>::setRenderCompressedFlags(HardwareInfo &hwInfo) const {}
} // namespace NEO
#include "shared/source/os_interface/product_helper.inl"

View File

@@ -33,6 +33,7 @@ using IsBeforeXeHpcCore = IsBeforeGfxCore<IGFX_XE_HPC_CORE>;
using IsAtLeastXe2HpgCore = IsAtLeastGfxCore<IGFX_XE2_HPG_CORE>;
using IsAtMostXe2HpgCore = IsAtMostGfxCore<IGFX_XE2_HPG_CORE>;
using IsBeforeXe2HpgCore = IsBeforeGfxCore<IGFX_XE2_HPG_CORE>;
using IsWithinXeHpCoreAndXe2HpgCore = IsWithinGfxCore<IGFX_XE_HP_CORE, IGFX_XE2_HPG_CORE>;
using IsXeHpcCoreOrXe2HpgCore = IsAnyGfxCores<IGFX_XE_HPC_CORE, IGFX_XE2_HPG_CORE>;
using IsWithinXeHpCoreAndXe3Core = IsWithinGfxCore<IGFX_XE_HP_CORE, IGFX_XE3_CORE>;

View File

@@ -1,14 +1,11 @@
/*
* Copyright (C) 2019-2023 Intel Corporation
* Copyright (C) 2019-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/gen12lp/hw_info_gen12lp.h"
#include "shared/source/os_interface/os_interface.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/libult/gen12lp/special_ult_helper_gen12lp.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"
@@ -17,20 +14,6 @@ using namespace NEO;
using Gen12lpProductHelperWindows = ProductHelperTestWindows;
GEN12LPTEST_F(Gen12lpProductHelperWindows, givenE2ECSetByKmdWhenConfiguringHwThenAdjustInternalImageFlag) {
FeatureTable &localFeatureTable = outHwInfo.featureTable;
localFeatureTable.flags.ftrE2ECompression = true;
productHelper->configureHardwareCustom(&outHwInfo, nullptr);
EXPECT_TRUE(outHwInfo.capabilityTable.ftrRenderCompressedBuffers);
EXPECT_TRUE(outHwInfo.capabilityTable.ftrRenderCompressedImages);
localFeatureTable.flags.ftrE2ECompression = false;
productHelper->configureHardwareCustom(&outHwInfo, nullptr);
EXPECT_FALSE(outHwInfo.capabilityTable.ftrRenderCompressedBuffers);
EXPECT_FALSE(outHwInfo.capabilityTable.ftrRenderCompressedImages);
}
GEN12LPTEST_F(Gen12lpProductHelperWindows, givenGen12LpProductWhenAdjustPlatformForProductFamilyCalledThenOverrideWithCorrectFamily) {
PLATFORM *testPlatform = &outHwInfo.platform;

View File

@@ -9,8 +9,6 @@
#include "shared/source/gmm_helper/resource_info.h"
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/source/helpers/hw_info.h"
#include "shared/source/os_interface/product_helper.h"
#include "shared/source/release_helper/release_helper.h"
#include "shared/test/common/fixtures/device_fixture.h"
#include "shared/test/common/fixtures/mock_execution_environment_gmm_fixture.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
@@ -18,7 +16,6 @@
#include "shared/test/common/helpers/gtest_helpers.h"
#include "shared/test/common/mocks/mock_execution_environment.h"
#include "shared/test/common/mocks/mock_gmm.h"
#include "shared/test/common/mocks/mock_gmm_resource_info.h"
#include "shared/test/common/test_macros/hw_test.h"
#include "shared/test/common/test_macros/test.h"
#include "shared/test/unit_test/os_interface/product_helper_tests.h"
@@ -61,22 +58,6 @@ struct GmmAdditionalCompressionSettingsTests : public MockExecutionEnvironmentGm
using ProductHelperAtLeastXe2Tests = ::Test<DeviceFixture>;
HWTEST2_F(ProductHelperAtLeastXe2Tests, givenFtrXe2CompressionIsTrueWhenEnableCompressionThenSetCompression, IsAtLeastXe2HpgCore) {
auto &productHelper = getHelper<ProductHelper>();
auto hwInfo = this->hardwareInfo;
hwInfo.featureTable.flags.ftrE2ECompression = true;
hwInfo.featureTable.flags.ftrXe2Compression = false;
productHelper.configureHardwareCustom(&hwInfo, nullptr);
EXPECT_FALSE(hwInfo.capabilityTable.ftrRenderCompressedImages);
EXPECT_FALSE(hwInfo.capabilityTable.ftrRenderCompressedBuffers);
hwInfo.featureTable.flags.ftrE2ECompression = false;
hwInfo.featureTable.flags.ftrXe2Compression = true;
productHelper.configureHardwareCustom(&hwInfo, nullptr);
EXPECT_TRUE(hwInfo.capabilityTable.ftrRenderCompressedImages);
EXPECT_TRUE(hwInfo.capabilityTable.ftrRenderCompressedBuffers);
}
HWTEST2_F(GmmAdditionalCompressionSettingsTests, whenApplyAdditionalCompressionSettingsThenSetNotCompressed, IsAtLeastXe2HpgCore) {
auto gmm = std::make_unique<MockGmm>(getGmmHelper());
gmm->resourceParams.Flags.Info.NotCompressed = 0;

View File

@@ -9,20 +9,16 @@
#include "shared/source/command_stream/preemption_mode.h"
#include "shared/source/helpers/compiler_product_helper.h"
#include "shared/source/helpers/constants.h"
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/source/os_interface/linux/i915.h"
#include "shared/source/os_interface/os_interface.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/helpers/gfx_core_helper_tests.h"
#include "shared/test/common/helpers/mock_product_helper_hw.h"
#include "shared/test/common/helpers/raii_product_helper.h"
#include "shared/test/common/helpers/unit_test_helper.h"
#include "shared/test/common/helpers/variable_backup.h"
#include "shared/test/common/mocks/mock_execution_environment.h"
#include "shared/test/common/test_macros/hw_test.h"
#include <cstring>
#include "shared/test/common/test_macros/test.h"
using namespace NEO;
@@ -273,15 +269,6 @@ TEST_F(MockProductHelperTestLinux, GivenConfigPreemptionDrmEnabledAllPreemptionD
EXPECT_TRUE(drm->isPreemptionSupported());
}
TEST_F(MockProductHelperTestLinux, givenPlatformEnabledFtrCompressionWhenInitializingThenFlagsAreSet) {
pInHwInfo.capabilityTable.ftrRenderCompressedImages = true;
pInHwInfo.capabilityTable.ftrRenderCompressedBuffers = true;
int ret = mockProductHelper->configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
EXPECT_EQ(0, ret);
EXPECT_TRUE(outHwInfo.capabilityTable.ftrRenderCompressedImages);
EXPECT_TRUE(outHwInfo.capabilityTable.ftrRenderCompressedBuffers);
}
TEST_F(MockProductHelperTestLinux, givenPointerToHwInfoWhenConfigureHwInfoCalledThenRequiedSurfaceSizeIsSettedProperly) {
EXPECT_EQ(MemoryConstants::pageSize, pInHwInfo.capabilityTable.requiredPreemptionSurfaceSize);
int ret = mockProductHelper->configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
@@ -335,6 +322,7 @@ TEST_F(MockProductHelperTestLinux, givenFailingGttSizeIoctlWhenInitializingHwInf
EXPECT_NE(0u, outHwInfo.capabilityTable.gpuAddressSpace);
EXPECT_EQ(pInHwInfo.capabilityTable.gpuAddressSpace, outHwInfo.capabilityTable.gpuAddressSpace);
}
using HwConfigLinux = ::testing::Test;
HWTEST2_F(HwConfigLinux, givenPlatformWithPlatformQuerySupportedWhenItIsCalledThenReturnTrue, IsAtLeastMtl) {
@@ -352,3 +340,31 @@ HWTEST2_F(ProductHelperTest, givenProductHelperWhenIsPlatformQueryNotSupportedTh
HWTEST2_F(ProductHelperTest, givenProductHelperWhenAskedIsDisableScratchPagesSupportedThenReturnTrue, IsAtLeastXeHpcCore) {
EXPECT_TRUE(productHelper->isDisableScratchPagesSupported());
}
HWTEST2_F(ProductHelperTestLinux, givenE2ECompressionWhenConfiguringHwInfoDrmThenCompressionFlagsAreCorrectlySet, IsBeforeXe2HpgCore) {
pInHwInfo.featureTable.flags.ftrE2ECompression = true;
int ret = productHelper->configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
EXPECT_EQ(0, ret);
EXPECT_TRUE(outHwInfo.capabilityTable.ftrRenderCompressedBuffers);
EXPECT_TRUE(outHwInfo.capabilityTable.ftrRenderCompressedImages);
pInHwInfo.featureTable.flags.ftrE2ECompression = false;
ret = productHelper->configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
EXPECT_EQ(0, ret);
EXPECT_FALSE(outHwInfo.capabilityTable.ftrRenderCompressedBuffers);
EXPECT_FALSE(outHwInfo.capabilityTable.ftrRenderCompressedImages);
}
HWTEST2_F(ProductHelperTestLinux, givenXe2CompressionWhenConfiguringHwInfoDrmThenCompressionFlagsAreCorrectlySet, IsAtLeastXe2HpgCore) {
pInHwInfo.featureTable.flags.ftrXe2Compression = true;
int ret = productHelper->configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
EXPECT_EQ(0, ret);
EXPECT_TRUE(outHwInfo.capabilityTable.ftrRenderCompressedBuffers);
EXPECT_TRUE(outHwInfo.capabilityTable.ftrRenderCompressedImages);
pInHwInfo.featureTable.flags.ftrXe2Compression = false;
ret = productHelper->configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
EXPECT_EQ(0, ret);
EXPECT_FALSE(outHwInfo.capabilityTable.ftrRenderCompressedBuffers);
EXPECT_FALSE(outHwInfo.capabilityTable.ftrRenderCompressedImages);
}

View File

@@ -1140,3 +1140,22 @@ HWTEST2_F(ProductHelperTest, givenProductHelperWhenGetMaxLocalSubRegionSizeCalle
auto hwInfo = *defaultHwInfo;
EXPECT_EQ(0u, productHelper->getMaxLocalSubRegionSize(hwInfo));
}
HWTEST_F(ProductHelperTest, givenProductHelperWhenCheckingIsCompressionForbiddenThenCorrectValueIsReturned) {
DebugManagerStateRestore restore;
auto hwInfo = *defaultHwInfo;
debugManager.flags.RenderCompressedImagesEnabled.set(0);
debugManager.flags.RenderCompressedBuffersEnabled.set(0);
EXPECT_TRUE(productHelper->isCompressionForbidden(hwInfo));
debugManager.flags.RenderCompressedImagesEnabled.set(1);
EXPECT_FALSE(productHelper->isCompressionForbidden(hwInfo));
debugManager.flags.RenderCompressedImagesEnabled.set(0);
debugManager.flags.RenderCompressedBuffersEnabled.set(1);
EXPECT_FALSE(productHelper->isCompressionForbidden(hwInfo));
debugManager.flags.RenderCompressedImagesEnabled.set(1);
EXPECT_FALSE(productHelper->isCompressionForbidden(hwInfo));
}

View File

@@ -12,7 +12,6 @@
#include "shared/source/os_interface/os_interface.h"
#include "shared/source/os_interface/product_helper.h"
#include "shared/source/os_interface/windows/wddm/wddm.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/mocks/mock_execution_environment.h"
#include "shared/test/common/test_macros/hw_test.h"
@@ -97,4 +96,33 @@ HWTEST_F(ProductHelperTestWindows, givenFtrIaCoherencyFlagWhenConfiguringHwInfoT
HWTEST2_F(ProductHelperTestWindows, givenProductHelperWhenAskedIfPlatformSupportsSvmHeapReservationThenReturnFalseForMTL, IsMTL) {
EXPECT_FALSE(productHelper->isSvmHeapReservationSupported());
}
HWTEST2_F(ProductHelperTestWindows, givenE2ECompressionWhenConfiguringHwInfoWddmThenCompressionFlagsAreCorrectlySet, IsBeforeXe2HpgCore) {
HardwareInfo initialHwInfo = *defaultHwInfo;
outHwInfo.featureTable.flags.ftrE2ECompression = true;
productHelper->configureHwInfoWddm(&initialHwInfo, &outHwInfo, *rootDeviceEnvironment.get());
EXPECT_TRUE(outHwInfo.capabilityTable.ftrRenderCompressedBuffers);
EXPECT_TRUE(outHwInfo.capabilityTable.ftrRenderCompressedImages);
outHwInfo.featureTable.flags.ftrE2ECompression = false;
productHelper->configureHwInfoWddm(&initialHwInfo, &outHwInfo, *rootDeviceEnvironment.get());
EXPECT_FALSE(outHwInfo.capabilityTable.ftrRenderCompressedBuffers);
EXPECT_FALSE(outHwInfo.capabilityTable.ftrRenderCompressedImages);
}
HWTEST2_F(ProductHelperTestWindows, givenE2ECompressionWhenConfiguringHwInfoWddmThenCompressionFlagsAreCorrectlySet, IsAtLeastXe2HpgCore) {
HardwareInfo initialHwInfo = *defaultHwInfo;
outHwInfo.featureTable.flags.ftrXe2Compression = true;
productHelper->configureHwInfoWddm(&initialHwInfo, &outHwInfo, *rootDeviceEnvironment.get());
EXPECT_TRUE(outHwInfo.capabilityTable.ftrRenderCompressedBuffers);
EXPECT_TRUE(outHwInfo.capabilityTable.ftrRenderCompressedImages);
outHwInfo.featureTable.flags.ftrXe2Compression = false;
productHelper->configureHwInfoWddm(&initialHwInfo, &outHwInfo, *rootDeviceEnvironment.get());
EXPECT_FALSE(outHwInfo.capabilityTable.ftrRenderCompressedBuffers);
EXPECT_FALSE(outHwInfo.capabilityTable.ftrRenderCompressedImages);
}
} // namespace NEO

View File

@@ -10,10 +10,9 @@
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/helpers/gtest_helpers.h"
#include "shared/test/common/os_interface/linux/drm_mock_extended.h"
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
#include "shared/test/unit_test/os_interface/linux/product_helper_linux_tests.h"
#include "per_product_test_definitions.h"
using namespace NEO;
struct ArlProductHelperLinux : ProductHelperTestLinux {
@@ -100,12 +99,7 @@ ARLTEST_F(ArlProductHelperLinux, givenBooleanUncachedWhenCallOverridePatIndexThe
EXPECT_EQ(3u, productHelper->overridePatIndex(isUncached, patIndex, AllocationType::commandBuffer));
}
ARLTEST_F(ArlProductHelperLinux, givenProductHelperWhenCallConfigureHardwareCustomThenCompressionIsDisabled) {
ARLTEST_F(ArlProductHelperLinux, givenProductHelperThenCompressionIsNotAllowed) {
auto hwInfo = *defaultHwInfo;
hwInfo.featureTable.flags.ftrE2ECompression = true;
productHelper->configureHardwareCustom(&hwInfo, nullptr);
EXPECT_FALSE(hwInfo.capabilityTable.ftrRenderCompressedBuffers);
EXPECT_FALSE(hwInfo.capabilityTable.ftrRenderCompressedImages);
EXPECT_TRUE(productHelper->isCompressionForbidden(hwInfo));
}

View File

@@ -74,12 +74,7 @@ MTLTEST_F(MtlProductHelperLinux, givenBooleanUncachedWhenCallOverridePatIndexThe
EXPECT_EQ(3u, productHelper->overridePatIndex(isUncached, patIndex, AllocationType::commandBuffer));
}
MTLTEST_F(MtlProductHelperLinux, givenProductHelperWhenCallConfigureHardwareCustomThenCompressionIsDisabled) {
MTLTEST_F(MtlProductHelperLinux, givenProductHelperThenCompressionIsNotAllowed) {
auto hwInfo = *defaultHwInfo;
hwInfo.featureTable.flags.ftrE2ECompression = true;
productHelper->configureHardwareCustom(&hwInfo, nullptr);
EXPECT_FALSE(hwInfo.capabilityTable.ftrRenderCompressedBuffers);
EXPECT_FALSE(hwInfo.capabilityTable.ftrRenderCompressedImages);
EXPECT_TRUE(productHelper->isCompressionForbidden(hwInfo));
}