Link build option with L1 cache policy helper

Related-To: NEO-7003

Add L1CachePolicyHelper struct.
This struct is resposible for L1 cache policy
in build option, Surface State and stateless
caching. Currently default option for all
platforms is WBP (write by-pass)


Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
Szymon Morek
2022-06-27 14:58:29 +00:00
committed by Compute-Runtime-Automation
parent 8e027a305d
commit 76e023b941
26 changed files with 207 additions and 52 deletions

View File

@@ -2306,6 +2306,28 @@ HWTEST_F(ModuleTranslationUnitTest, givenInternalOptionsThenLSCCachePolicyIsSet)
}
}
HWTEST2_F(ModuleTranslationUnitTest, givenDebugFlagSetToWbWhenGetInternalOptionsThenCorrectBuildOptionIsSet, IsAtLeastXeHpgCore) {
DebugManagerStateRestore restorer;
DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.set(2);
auto pMockCompilerInterface = new MockCompilerInterface;
auto &rootDeviceEnvironment = this->neoDevice->executionEnvironment->rootDeviceEnvironments[this->neoDevice->getRootDeviceIndex()];
rootDeviceEnvironment->compilerInterface.reset(pMockCompilerInterface);
MockModuleTranslationUnit moduleTu(this->device);
auto ret = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr);
EXPECT_TRUE(ret);
EXPECT_NE(pMockCompilerInterface->inputInternalOptions.find("-cl-store-cache-default=7 -cl-load-cache-default=4"), std::string::npos);
}
HWTEST2_F(ModuleTranslationUnitTest, givenAtLeastDG2WhenGetInternalOptionsThenCorrectBuildOptionIsSet, IsAtLeastXeHpgCore) {
auto pMockCompilerInterface = new MockCompilerInterface;
auto &rootDeviceEnvironment = this->neoDevice->executionEnvironment->rootDeviceEnvironments[this->neoDevice->getRootDeviceIndex()];
rootDeviceEnvironment->compilerInterface.reset(pMockCompilerInterface);
MockModuleTranslationUnit moduleTu(this->device);
auto ret = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr);
EXPECT_TRUE(ret);
EXPECT_NE(pMockCompilerInterface->inputInternalOptions.find("-cl-store-cache-default=2 -cl-load-cache-default=4"), std::string::npos);
}
HWTEST_F(ModuleTranslationUnitTest, givenForceToStatelessRequiredWhenBuildingModuleThen4GbBuffersAreRequired) {
auto mockCompilerInterface = new MockCompilerInterface;
auto &rootDeviceEnvironment = neoDevice->executionEnvironment->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()];

View File

@@ -1752,6 +1752,20 @@ TEST_F(ProgramTests, whenGetInternalOptionsThenLSCPolicyIsSet) {
}
}
HWTEST2_F(ProgramTests, givenDebugFlagSetToWbWhenGetInternalOptionsThenCorrectBuildOptionIsSet, IsAtLeastXeHpgCore) {
DebugManagerStateRestore restorer;
DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.set(2);
MockProgram program(pContext, false, toClDeviceVector(*pClDevice));
auto internalOptions = program.getInternalOptions();
EXPECT_TRUE(CompilerOptions::contains(internalOptions, "-cl-store-cache-default=7 -cl-load-cache-default=4"));
}
HWTEST2_F(ProgramTests, givenAtLeastDG2WhenGetInternalOptionsThenCorrectBuildOptionIsSet, IsAtLeastXeHpgCore) {
MockProgram program(pContext, false, toClDeviceVector(*pClDevice));
auto internalOptions = program.getInternalOptions();
EXPECT_TRUE(CompilerOptions::contains(internalOptions, "-cl-store-cache-default=2 -cl-load-cache-default=4"));
}
TEST_F(ProgramTests, WhenCreatingProgramThenBindlessIsEnabledOnlyIfDebugFlagIsEnabled) {
using namespace testing;
DebugManagerStateRestore restorer;

View File

@@ -38,6 +38,9 @@ set(CLOC_LIB_SRCS_LIB
${NEO_SHARED_DIRECTORY}/helpers/compiler_hw_info_config_bdw_and_later.inl
${NEO_SHARED_DIRECTORY}/helpers/compiler_options_parser.cpp
${NEO_SHARED_DIRECTORY}/helpers/compiler_options_parser.h
${NEO_SHARED_DIRECTORY}/helpers/cache_policy.h
${NEO_SHARED_DIRECTORY}/helpers/cache_policy_bdw_and_later.inl
${NEO_SHARED_DIRECTORY}/helpers/cache_policy_dg2_and_later.inl
${NEO_SHARED_DIRECTORY}/helpers/debug_helpers.cpp
${NEO_SHARED_DIRECTORY}/helpers/file_io.cpp
${NEO_SHARED_DIRECTORY}/helpers/hw_info.cpp

View File

@@ -16,10 +16,10 @@
#include "shared/source/device/device.h"
#include "shared/source/direct_submission/direct_submission_controller.h"
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/gmm_helper/cache_settings_helper.h"
#include "shared/source/gmm_helper/page_table_mngr.h"
#include "shared/source/helpers/api_specific_config.h"
#include "shared/source/helpers/array_count.h"
#include "shared/source/helpers/cache_policy.h"
#include "shared/source/helpers/flush_stamp.h"
#include "shared/source/helpers/hw_helper.h"
#include "shared/source/helpers/logical_state_helper.h"

View File

@@ -6,6 +6,7 @@
*/
#include "shared/source/gen11/hw_cmds.h"
#include "shared/source/helpers/cache_policy_bdw_and_later.inl"
#include "shared/source/helpers/compiler_aot_config_bdw_and_later.inl"
#include "shared/source/helpers/compiler_hw_info_config_base.inl"
#include "shared/source/helpers/compiler_hw_info_config_bdw_and_later.inl"

View File

@@ -6,6 +6,7 @@
*/
#include "shared/source/gen12lp/hw_cmds.h"
#include "shared/source/helpers/cache_policy_bdw_and_later.inl"
#include "shared/source/helpers/compiler_aot_config_bdw_and_later.inl"
#include "shared/source/helpers/compiler_hw_info_config_base.inl"
#include "shared/source/helpers/compiler_hw_info_config_bdw_and_later.inl"

View File

@@ -6,6 +6,7 @@
*/
#include "shared/source/gen8/hw_cmds.h"
#include "shared/source/helpers/cache_policy_bdw_and_later.inl"
#include "shared/source/helpers/compiler_aot_config_bdw_and_later.inl"
#include "shared/source/helpers/compiler_hw_info_config_base.inl"
#include "shared/source/helpers/compiler_hw_info_config_bdw_and_later.inl"

View File

@@ -6,6 +6,7 @@
*/
#include "shared/source/gen9/hw_cmds.h"
#include "shared/source/helpers/cache_policy_bdw_and_later.inl"
#include "shared/source/helpers/compiler_aot_config_bdw_and_later.inl"
#include "shared/source/helpers/compiler_hw_info_config_base.inl"
#include "shared/source/helpers/compiler_hw_info_config_bdw_and_later.inl"

View File

@@ -8,6 +8,10 @@
#pragma once
#include "shared/source/gmm_helper/gmm_lib.h"
namespace CacheSettings {
constexpr uint32_t unknownMocs = GMM_RESOURCE_USAGE_UNKNOWN;
} // namespace CacheSettings
namespace NEO {
enum class AllocationType;
struct HardwareInfo;

View File

@@ -29,6 +29,7 @@ set(NEO_CORE_HELPERS
${CMAKE_CURRENT_SOURCE_DIR}/cache_flush.inl
${CMAKE_CURRENT_SOURCE_DIR}/cache_policy.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cache_policy.h
${CMAKE_CURRENT_SOURCE_DIR}/cache_policy_bdw_and_later.inl
${CMAKE_CURRENT_SOURCE_DIR}/casts.h
${CMAKE_CURRENT_SOURCE_DIR}/common_types.h
${CMAKE_CURRENT_SOURCE_DIR}/compiler_hw_info_config.h
@@ -152,6 +153,7 @@ endif()
if(SUPPORT_DG2_AND_LATER)
list(APPEND NEO_CORE_HELPERS
${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_dg2_and_later.inl
${CMAKE_CURRENT_SOURCE_DIR}/cache_policy_dg2_and_later.inl
)
endif()

View File

@@ -1,19 +1,38 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/gmm_helper/gmm_lib.h"
#include "shared/source/debug_settings/debug_settings_manager.h"
namespace CacheSettings {
constexpr uint32_t unknownMocs = GMM_RESOURCE_USAGE_UNKNOWN;
} // namespace CacheSettings
#include "igfxfmid.h"
#include <cstdint>
#include <stddef.h>
namespace NEO {
class GraphicsAllocation;
bool isL3Capable(void *ptr, size_t size);
bool isL3Capable(const GraphicsAllocation &graphicsAllocation);
template <PRODUCT_FAMILY gfxProduct>
struct L1CachePolicyHelper {
static const char *getCachingPolicyOptions();
static uint32_t getDefaultL1CachePolicy() {
return 0;
}
static uint32_t getL1CachePolicy() {
if (DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.get() != -1) {
return DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.get();
}
return L1CachePolicyHelper<gfxProduct>::getDefaultL1CachePolicy();
}
};
} // namespace NEO

View File

@@ -0,0 +1,17 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/cache_policy.h"
namespace NEO {
template <PRODUCT_FAMILY gfxProduct>
const char *L1CachePolicyHelper<gfxProduct>::getCachingPolicyOptions() {
return nullptr;
}
} // namespace NEO

View File

@@ -0,0 +1,30 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/cache_policy.h"
#include "shared/source/helpers/hw_info.h"
namespace NEO {
template <PRODUCT_FAMILY gfxProduct>
const char *L1CachePolicyHelper<gfxProduct>::getCachingPolicyOptions() {
using GfxFamily = typename HwMapper<gfxProduct>::GfxFamily;
static constexpr const char *writeBackCachingPolicy = "-cl-store-cache-default=7 -cl-load-cache-default=4";
static constexpr const char *writeByPassCachingPolicy = "-cl-store-cache-default=2 -cl-load-cache-default=4";
switch (L1CachePolicyHelper<gfxProduct>::getL1CachePolicy()) {
case GfxFamily::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP:
return writeByPassCachingPolicy;
case GfxFamily::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WB:
return writeBackCachingPolicy;
default:
return nullptr;
}
}
} // namespace NEO

View File

@@ -7,6 +7,7 @@
#pragma once
#include "shared/source/helpers/cache_policy.h"
#include "shared/source/helpers/compiler_hw_info_config.h"
namespace NEO {
@@ -26,7 +27,7 @@ void CompilerHwInfoConfigHw<gfxProduct>::adjustHwInfoForIgc(HardwareInfo &hwInfo
template <PRODUCT_FAMILY gfxProduct>
const char *CompilerHwInfoConfigHw<gfxProduct>::getCachingPolicyOptions() const {
return nullptr;
return L1CachePolicyHelper<gfxProduct>::getCachingPolicyOptions();
};
} // namespace NEO

View File

@@ -119,7 +119,6 @@ class HwInfoConfig {
virtual bool isCpuCopyNecessary(const void *ptr, MemoryManager *memoryManager) const = 0;
virtual bool isAdjustWalkOrderAvailable(const HardwareInfo &hwInfo) const = 0;
virtual bool isAssignEngineRoundRobinSupported() const = 0;
virtual uint32_t getDefaultL1CachePolicy() const = 0;
virtual uint32_t getL1CachePolicy() const = 0;
MOCKABLE_VIRTUAL ~HwInfoConfig() = default;
@@ -218,7 +217,6 @@ class HwInfoConfigHw : public HwInfoConfig {
bool isCpuCopyNecessary(const void *ptr, MemoryManager *memoryManager) const override;
bool isAdjustWalkOrderAvailable(const HardwareInfo &hwInfo) const override;
bool isAssignEngineRoundRobinSupported() const override;
uint32_t getDefaultL1CachePolicy() const override;
uint32_t getL1CachePolicy() const override;
protected:

View File

@@ -7,6 +7,7 @@
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/helpers/api_specific_config.h"
#include "shared/source/helpers/cache_policy.h"
#include "shared/source/helpers/constants.h"
#include "shared/source/helpers/driver_model_type.h"
#include "shared/source/helpers/hw_helper.h"
@@ -427,17 +428,9 @@ bool HwInfoConfigHw<gfxProduct>::isCpuCopyNecessary(const void *ptr, MemoryManag
template <PRODUCT_FAMILY gfxProduct>
bool HwInfoConfigHw<gfxProduct>::isAdjustWalkOrderAvailable(const HardwareInfo &hwInfo) const { return false; }
template <PRODUCT_FAMILY gfxProduct>
uint32_t HwInfoConfigHw<gfxProduct>::getDefaultL1CachePolicy() const {
return 0;
}
template <PRODUCT_FAMILY gfxProduct>
uint32_t HwInfoConfigHw<gfxProduct>::getL1CachePolicy() const {
if (DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.get() != -1) {
return DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.get();
}
return getDefaultL1CachePolicy();
return L1CachePolicyHelper<gfxProduct>::getL1CachePolicy();
}
} // namespace NEO

View File

@@ -5,6 +5,7 @@
*
*/
#include "shared/source/helpers/cache_policy_bdw_and_later.inl"
#include "shared/source/helpers/compiler_aot_config_bdw_and_later.inl"
#include "shared/source/helpers/compiler_hw_info_config_base.inl"
#include "shared/source/helpers/compiler_hw_info_config_bdw_and_later.inl"

View File

@@ -5,6 +5,7 @@
*
*/
#include "shared/source/helpers/cache_policy_dg2_and_later.inl"
#include "shared/source/helpers/compiler_aot_config_bdw_and_later.inl"
#include "shared/source/helpers/compiler_hw_info_config_base.inl"
#include "shared/source/helpers/compiler_hw_info_config_bdw_and_later.inl"

View File

@@ -53,8 +53,3 @@ void HwInfoConfigHw<gfxProduct>::getKernelExtendedProperties(uint32_t *fp16, uin
*fp32 = (FP_ATOMIC_EXT_FLAG_GLOBAL_LOAD_STORE | FP_ATOMIC_EXT_FLAG_GLOBAL_ADD | FP_ATOMIC_EXT_FLAG_GLOBAL_MIN_MAX);
*fp64 = (FP_ATOMIC_EXT_FLAG_GLOBAL_LOAD_STORE | FP_ATOMIC_EXT_FLAG_GLOBAL_ADD | FP_ATOMIC_EXT_FLAG_GLOBAL_MIN_MAX);
}
template <>
uint32_t HwInfoConfigHw<gfxProduct>::getDefaultL1CachePolicy() const {
return XE_HPC_COREFamily::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP;
}

View File

@@ -1,12 +0,0 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
template <>
const char *CompilerHwInfoConfigHw<IGFX_DG2>::getCachingPolicyOptions() const {
static constexpr const char *cachingPolicy = "-cl-store-cache-default=7 -cl-load-cache-default=4";
return cachingPolicy;
};

View File

@@ -210,8 +210,3 @@ bool HwInfoConfigHw<gfxProduct>::isStorageInfoAdjustmentRequired() const {
return false;
}
}
template <>
uint32_t HwInfoConfigHw<gfxProduct>::getDefaultL1CachePolicy() const {
return XE_HPG_COREFamily::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP;
}

View File

@@ -5,6 +5,7 @@
*
*/
#include "shared/source/helpers/cache_policy_dg2_and_later.inl"
#include "shared/source/helpers/compiler_aot_config_bdw_and_later.inl"
#include "shared/source/helpers/compiler_hw_info_config_base.inl"
#include "shared/source/helpers/compiler_hw_info_config_bdw_and_later.inl"
@@ -14,9 +15,14 @@
namespace NEO {
#ifdef SUPPORT_DG2
static EnableGfxProductHw<IGFX_DG2> enableGfxProductHwDG2;
#include "shared/source/xe_hpg_core/compiler_hw_info_config_dg2.inl"
template <>
uint32_t L1CachePolicyHelper<IGFX_DG2>::getDefaultL1CachePolicy() {
using GfxFamily = HwMapper<IGFX_DG2>::GfxFamily;
return GfxFamily::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP;
}
static EnableGfxProductHw<IGFX_DG2> enableGfxProductHwDG2;
static EnableCompilerHwInfoConfig<IGFX_DG2> enableCompilerHwInfoConfigDG2;
#endif
} // namespace NEO

View File

@@ -16,7 +16,6 @@ using TestDg2HwInfoConfig = Test<DeviceFixture>;
HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTestWindows, givenHardwareInfoWhenCallingIsAdditionalStateBaseAddressWARequiredThenFalseIsReturned, IGFX_DG2);
HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTestWindows, givenHardwareInfoWhenCallingIsMaxThreadsForWorkgroupWARequiredThenFalseIsReturned, IGFX_DG2);
HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, givenCompilerHwInfoConfigWhengetCachingPolicyOptionsThenReturnNullptr, IGFX_DG2);
DG2TEST_F(TestDg2HwInfoConfig, givenDG2WithCSteppingThenAdditionalStateBaseAddressWAIsNotRequired) {
const auto &hwInfoConfig = *HwInfoConfig::get(productFamily);
@@ -69,10 +68,3 @@ DG2TEST_F(TestDg2HwInfoConfig, givenDG2HwInfoConfigWhenCheckDirectSubmissionSupp
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
EXPECT_TRUE(hwInfoConfig.isDirectSubmissionSupported(hwInfo));
}
DG2TEST_F(TestDg2HwInfoConfig, givenDG2CompilerHwInfoConfigWhengetCachingPolicyOptionsThenReturnCorrectPolicies) {
auto hwInfo = *defaultHwInfo;
auto compilerHwInfoConfig = CompilerHwInfoConfig::get(hwInfo.platform.eProductFamily);
const char *expectedStr = "-cl-store-cache-default=7 -cl-load-cache-default=4";
EXPECT_EQ(0, memcmp(compilerHwInfoConfig->getCachingPolicyOptions(), expectedStr, strlen(expectedStr)));
}

View File

@@ -29,6 +29,7 @@ set(SHARED_SRCS_tests_helpers
${CMAKE_CURRENT_SOURCE_DIR}/static_size3.h
${CMAKE_CURRENT_SOURCE_DIR}/test_debug_variables.inl
${CMAKE_CURRENT_SOURCE_DIR}/test_hw_info_config.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cache_policy_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/timestamp_packet_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ult_limits.h
)

View File

@@ -0,0 +1,46 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/cache_policy.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/test_macros/test.h"
#include "shared/test/unit_test/os_interface/hw_info_config_tests.h"
using namespace NEO;
HWTEST2_F(HwInfoConfigTest, givenL1CachePolicyHelperWhenUnsupportedL1PoliciesAndGetDefaultL1CachePolicyThenReturnZero, IsAtMostXeHpCore) {
EXPECT_EQ(L1CachePolicyHelper<productFamily>::getL1CachePolicy(), 0u);
}
HWTEST2_F(HwInfoConfigTest, givenAtLeastDG2WhenGetL1CachePolicyThenReturnCorrectValue, IsAtLeastXeHpgCore) {
using GfxFamily = typename HwMapper<productFamily>::GfxFamily;
EXPECT_EQ(L1CachePolicyHelper<productFamily>::getL1CachePolicy(), GfxFamily::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP);
}
HWTEST2_F(HwInfoConfigTest, givenAtLeastDG2AndWriteBackPolicyWhenGetL1CachePolicyThenReturnCorrectValue, IsAtLeastXeHpgCore) {
DebugManagerStateRestore restorer;
DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.set(2);
const char *expectedStr = "-cl-store-cache-default=7 -cl-load-cache-default=4";
EXPECT_EQ(0, memcmp(L1CachePolicyHelper<productFamily>::getCachingPolicyOptions(), expectedStr, strlen(expectedStr)));
}
HWTEST2_F(HwInfoConfigTest, givenL1CachePolicyHelperWhenDebugFlagSetAndGetL1CachePolicyThenReturnCorrectValue, MatchAny) {
DebugManagerStateRestore restorer;
DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.set(0);
EXPECT_EQ(L1CachePolicyHelper<productFamily>::getL1CachePolicy(), 0u);
DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.set(2);
EXPECT_EQ(L1CachePolicyHelper<productFamily>::getL1CachePolicy(), 2u);
DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.set(3);
EXPECT_EQ(L1CachePolicyHelper<productFamily>::getL1CachePolicy(), 3u);
DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.set(4);
EXPECT_EQ(L1CachePolicyHelper<productFamily>::getL1CachePolicy(), 4u);
}

View File

@@ -106,11 +106,34 @@ HWTEST_F(HwInfoConfigTest, givenHwInfoConfigWhenIsAdjustWalkOrderAvailableCallTh
EXPECT_FALSE(hwInfoConfig.isAdjustWalkOrderAvailable(*defaultHwInfo));
}
HWTEST_F(HwInfoConfigTest, givenCompilerHwInfoConfigWhengetCachingPolicyOptionsThenReturnNullptr) {
HWTEST2_F(HwInfoConfigTest, givenAtMostXeHPWhenGetCachingPolicyOptionsThenReturnNullptr, IsAtMostXeHpCore) {
auto compilerHwInfoConfig = CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
EXPECT_EQ(compilerHwInfoConfig->getCachingPolicyOptions(), nullptr);
}
HWTEST2_F(HwInfoConfigTest, givenAtLeastDG2WhenGetCachingPolicyOptionsThenReturnWriteByPassPolicyOption, IsAtLeastXeHpgCore) {
auto compilerHwInfoConfig = CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
const char *expectedStr = "-cl-store-cache-default=2 -cl-load-cache-default=4";
EXPECT_EQ(0, memcmp(compilerHwInfoConfig->getCachingPolicyOptions(), expectedStr, strlen(expectedStr)));
}
HWTEST2_F(HwInfoConfigTest, givenAtLeastDG2WhenGetCachingPolicyOptionsThenReturnWriteBackPolicyOption, IsAtLeastXeHpgCore) {
DebugManagerStateRestore restorer;
DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.set(2);
auto compilerHwInfoConfig = CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
const char *expectedStr = "-cl-store-cache-default=7 -cl-load-cache-default=4";
EXPECT_EQ(0, memcmp(compilerHwInfoConfig->getCachingPolicyOptions(), expectedStr, strlen(expectedStr)));
}
HWTEST2_F(HwInfoConfigTest, givenCachePolicyWithoutCorrespondingBuildOptionWhenGetCachingPolicyOptionsThenReturnNullptr, IsAtLeastXeHpgCore) {
DebugManagerStateRestore restorer;
DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.set(1);
auto compilerHwInfoConfig = CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
EXPECT_EQ(nullptr, compilerHwInfoConfig->getCachingPolicyOptions());
}
HWTEST2_F(HwInfoConfigTest, givenHwInfoConfigAndDebugFlagWhenGetL1CachePolicyThenReturnCorrectPolicy, IsAtLeastXeHpgCore) {
DebugManagerStateRestore restorer;
auto hwInfo = *defaultHwInfo;
@@ -141,4 +164,4 @@ HWTEST2_F(HwInfoConfigTest, givenPlatformWithUnsupportedL1CachePoliciesWhenGetL1
auto hwInfoConfig = HwInfoConfig::get(hwInfo.platform.eProductFamily);
EXPECT_EQ(0u, hwInfoConfig->getL1CachePolicy());
}
}