mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-22 10:17:01 +08:00
Respect ForceAllResourcesUncached flag
Respect debug flag ForceAllResourcesUncached even when Override L1 Policy flags are also set Related-To: NEO-7003 Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
025c3dd7a1
commit
aa3a4765b9
@@ -2280,7 +2280,20 @@ HWTEST2_F(ModuleTranslationUnitTest, givenDebugFlagSetToWbWhenGetInternalOptions
|
||||
EXPECT_NE(pMockCompilerInterface->inputInternalOptions.find("-cl-store-cache-default=7 -cl-load-cache-default=4"), std::string::npos);
|
||||
}
|
||||
|
||||
HWTEST2_F(ModuleTranslationUnitTest, givenAtLeastDG2WhenGetInternalOptionsThenCorrectBuildOptionIsSet, IsAtLeastXeHpgCore) {
|
||||
HWTEST2_F(ModuleTranslationUnitTest, givenDebugFlagSetForceAllResourcesUncachedWhenGetInternalOptionsThenCorrectBuildOptionIsSet, IsAtLeastXeHpgCore) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.set(2);
|
||||
DebugManager.flags.ForceAllResourcesUncached.set(true);
|
||||
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=1 -cl-load-cache-default=1"), std::string::npos);
|
||||
}
|
||||
|
||||
HWTEST2_F(ModuleTranslationUnitTest, givenAtLeastXeHpgCoreWhenGetInternalOptionsThenCorrectBuildOptionIsSet, IsAtLeastXeHpgCore) {
|
||||
auto pMockCompilerInterface = new MockCompilerInterface;
|
||||
auto &rootDeviceEnvironment = this->neoDevice->executionEnvironment->rootDeviceEnvironments[this->neoDevice->getRootDeviceIndex()];
|
||||
rootDeviceEnvironment->compilerInterface.reset(pMockCompilerInterface);
|
||||
|
||||
@@ -1760,7 +1760,16 @@ HWTEST2_F(ProgramTests, givenDebugFlagSetToWbWhenGetInternalOptionsThenCorrectBu
|
||||
EXPECT_TRUE(CompilerOptions::contains(internalOptions, "-cl-store-cache-default=7 -cl-load-cache-default=4"));
|
||||
}
|
||||
|
||||
HWTEST2_F(ProgramTests, givenAtLeastDG2WhenGetInternalOptionsThenCorrectBuildOptionIsSet, IsAtLeastXeHpgCore) {
|
||||
HWTEST2_F(ProgramTests, givenDebugFlagSetForceAllResourcesUncachedWhenGetInternalOptionsThenCorrectBuildOptionIsSet, IsAtLeastXeHpgCore) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.set(2);
|
||||
DebugManager.flags.ForceAllResourcesUncached.set(true);
|
||||
MockProgram program(pContext, false, toClDeviceVector(*pClDevice));
|
||||
auto internalOptions = program.getInternalOptions();
|
||||
EXPECT_TRUE(CompilerOptions::contains(internalOptions, "-cl-store-cache-default=1 -cl-load-cache-default=1"));
|
||||
}
|
||||
|
||||
HWTEST2_F(ProgramTests, givenAtLeastXeHpgCoreWhenGetInternalOptionsThenCorrectBuildOptionIsSet, 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"));
|
||||
|
||||
@@ -110,7 +110,13 @@ XE_HPC_CORETEST_F(CmdsProgrammingTestsXeHpcCore, givenL1CachingOverrideWhenState
|
||||
|
||||
EXPECT_EQ(0u, sbaCmd.getL1CachePolicyL1CacheControl());
|
||||
|
||||
DebugManager.flags.ForceStatelessL1CachingPolicy.set(1u);
|
||||
DebugManager.flags.ForceStatelessL1CachingPolicy.set(2u);
|
||||
|
||||
StateBaseAddressHelper<FamilyType>::appendStateBaseAddressParameters(args, true);
|
||||
|
||||
EXPECT_EQ(2u, sbaCmd.getL1CachePolicyL1CacheControl());
|
||||
|
||||
DebugManager.flags.ForceAllResourcesUncached.set(true);
|
||||
|
||||
StateBaseAddressHelper<FamilyType>::appendStateBaseAddressParameters(args, true);
|
||||
|
||||
|
||||
@@ -110,7 +110,13 @@ DG2TEST_F(CmdsProgrammingTestsDg2, givenL1CachingOverrideWhenStateBaseAddressIsP
|
||||
|
||||
EXPECT_EQ(0u, sbaCmd.getL1CachePolicyL1CacheControl());
|
||||
|
||||
DebugManager.flags.ForceStatelessL1CachingPolicy.set(1u);
|
||||
DebugManager.flags.ForceStatelessL1CachingPolicy.set(2u);
|
||||
|
||||
StateBaseAddressHelper<FamilyType>::appendStateBaseAddressParameters(args, true);
|
||||
|
||||
EXPECT_EQ(2u, sbaCmd.getL1CachePolicyL1CacheControl());
|
||||
|
||||
DebugManager.flags.ForceAllResourcesUncached.set(true);
|
||||
|
||||
StateBaseAddressHelper<FamilyType>::appendStateBaseAddressParameters(args, true);
|
||||
|
||||
|
||||
@@ -110,7 +110,13 @@ XE_HPG_CORETEST_F(CmdsProgrammingTestsXeHpgCore, givenL1CachingOverrideWhenState
|
||||
|
||||
EXPECT_EQ(0u, sbaCmd.getL1CachePolicyL1CacheControl());
|
||||
|
||||
DebugManager.flags.ForceStatelessL1CachingPolicy.set(1u);
|
||||
DebugManager.flags.ForceStatelessL1CachingPolicy.set(2u);
|
||||
|
||||
StateBaseAddressHelper<FamilyType>::appendStateBaseAddressParameters(args, true);
|
||||
|
||||
EXPECT_EQ(2u, sbaCmd.getL1CachePolicyL1CacheControl());
|
||||
|
||||
DebugManager.flags.ForceAllResourcesUncached.set(true);
|
||||
|
||||
StateBaseAddressHelper<FamilyType>::appendStateBaseAddressParameters(args, true);
|
||||
|
||||
|
||||
@@ -19,7 +19,8 @@ void EncodeSurfaceState<Family>::encodeExtraCacheSettings(R_SURFACE_STATE *surfa
|
||||
auto cachePolicy = static_cast<L1_CACHE_POLICY>(hwInfoConfig->getL1CachePolicy());
|
||||
surfaceState->setL1CachePolicyL1CacheControl(cachePolicy);
|
||||
|
||||
if (DebugManager.flags.OverrideL1CacheControlInSurfaceState.get() != -1) {
|
||||
if (DebugManager.flags.OverrideL1CacheControlInSurfaceState.get() != -1 &&
|
||||
DebugManager.flags.ForceAllResourcesUncached.get() == false) {
|
||||
surfaceState->setL1CachePolicyL1CacheControl(static_cast<L1_CACHE_POLICY>(DebugManager.flags.OverrideL1CacheControlInSurfaceState.get()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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_base.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cache_policy_bdw_and_later.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/casts.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/common_types.h
|
||||
|
||||
@@ -23,16 +23,11 @@ struct L1CachePolicyHelper {
|
||||
|
||||
static const char *getCachingPolicyOptions();
|
||||
|
||||
static uint32_t getDefaultL1CachePolicy() {
|
||||
return 0u;
|
||||
}
|
||||
static uint32_t getDefaultL1CachePolicy();
|
||||
|
||||
static uint32_t getL1CachePolicy() {
|
||||
if (DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.get() != -1) {
|
||||
return DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.get();
|
||||
}
|
||||
return L1CachePolicyHelper<gfxProduct>::getDefaultL1CachePolicy();
|
||||
}
|
||||
static uint32_t getUncachedL1CachePolicy();
|
||||
|
||||
static uint32_t getL1CachePolicy();
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
25
shared/source/helpers/cache_policy_base.inl
Normal file
25
shared/source/helpers/cache_policy_base.inl
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/cache_policy.h"
|
||||
#include "shared/source/os_interface/hw_info_config.h"
|
||||
#include "shared/source/xe_hpg_core/hw_cmds.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
uint32_t L1CachePolicyHelper<gfxProduct>::getL1CachePolicy() {
|
||||
if (DebugManager.flags.ForceAllResourcesUncached.get()) {
|
||||
return L1CachePolicyHelper<gfxProduct>::getUncachedL1CachePolicy();
|
||||
}
|
||||
if (DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.get() != -1) {
|
||||
return DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.get();
|
||||
}
|
||||
return L1CachePolicyHelper<gfxProduct>::getDefaultL1CachePolicy();
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/cache_policy.h"
|
||||
#include "shared/source/helpers/cache_policy_base.inl"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
@@ -14,4 +15,14 @@ const char *L1CachePolicyHelper<gfxProduct>::getCachingPolicyOptions() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
uint32_t L1CachePolicyHelper<gfxProduct>::getDefaultL1CachePolicy() {
|
||||
return 0u;
|
||||
}
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
uint32_t L1CachePolicyHelper<gfxProduct>::getUncachedL1CachePolicy() {
|
||||
return 1u;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/cache_policy.h"
|
||||
#include "shared/source/helpers/cache_policy_base.inl"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
|
||||
namespace NEO {
|
||||
@@ -16,15 +17,30 @@ const char *L1CachePolicyHelper<gfxProduct>::getCachingPolicyOptions() {
|
||||
|
||||
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";
|
||||
static constexpr const char *uncachedCachingPolicy = "-cl-store-cache-default=1 -cl-load-cache-default=1";
|
||||
|
||||
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;
|
||||
case GfxFamily::STATE_BASE_ADDRESS::L1_CACHE_POLICY_UC:
|
||||
return uncachedCachingPolicy;
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
uint32_t L1CachePolicyHelper<gfxProduct>::getDefaultL1CachePolicy() {
|
||||
using GfxFamily = typename HwMapper<gfxProduct>::GfxFamily;
|
||||
return GfxFamily::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP;
|
||||
}
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
uint32_t L1CachePolicyHelper<gfxProduct>::getUncachedL1CachePolicy() {
|
||||
using GfxFamily = typename HwMapper<gfxProduct>::GfxFamily;
|
||||
return GfxFamily::STATE_BASE_ADDRESS::L1_CACHE_POLICY_UC;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -11,7 +11,8 @@ void StateBaseAddressHelper<GfxFamily>::appendExtraCacheSettings(STATE_BASE_ADDR
|
||||
auto cachePolicy = hwInfoConfig->getL1CachePolicy();
|
||||
stateBaseAddress->setL1CachePolicyL1CacheControl(static_cast<typename STATE_BASE_ADDRESS::L1_CACHE_POLICY>(cachePolicy));
|
||||
|
||||
if (DebugManager.flags.ForceStatelessL1CachingPolicy.get() != -1) {
|
||||
if (DebugManager.flags.ForceStatelessL1CachingPolicy.get() != -1 &&
|
||||
DebugManager.flags.ForceAllResourcesUncached.get() == false) {
|
||||
stateBaseAddress->setL1CachePolicyL1CacheControl(static_cast<typename STATE_BASE_ADDRESS::L1_CACHE_POLICY>(DebugManager.flags.ForceStatelessL1CachingPolicy.get()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -411,6 +411,16 @@ bool HwInfoConfigHw<IGFX_UNKNOWN>::isPrefetcherDisablingInDirectSubmissionRequir
|
||||
return true;
|
||||
}
|
||||
|
||||
template <>
|
||||
uint32_t L1CachePolicyHelper<IGFX_UNKNOWN>::getL1CachePolicy() {
|
||||
return L1CachePolicyHelper<IGFX_UNKNOWN>::getDefaultL1CachePolicy();
|
||||
}
|
||||
|
||||
template <>
|
||||
uint32_t L1CachePolicyHelper<IGFX_UNKNOWN>::getUncachedL1CachePolicy() {
|
||||
return 1u;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
#include "shared/source/os_interface/hw_info_config.inl"
|
||||
|
||||
@@ -45,5 +45,11 @@ HWTEST2_F(CommandEncoderXeHpgCorePlusTests, givenSpecifiedL1CacheControlWhenAppe
|
||||
EncodeSurfaceState<FamilyType>::encodeBuffer(args);
|
||||
|
||||
EXPECT_EQ(static_cast<uint32_t>(l1CacheControl), rssCmd.getL1CachePolicyL1CacheControl());
|
||||
|
||||
DebugManager.flags.ForceAllResourcesUncached.set(true);
|
||||
EncodeSurfaceState<FamilyType>::encodeBuffer(args);
|
||||
|
||||
EXPECT_EQ(static_cast<uint32_t>(FamilyType::RENDER_SURFACE_STATE::L1_CACHE_POLICY_UC), rssCmd.getL1CachePolicyL1CacheControl());
|
||||
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
@@ -16,12 +16,21 @@ HWTEST2_F(HwInfoConfigTest, givenL1CachePolicyHelperWhenUnsupportedL1PoliciesAnd
|
||||
EXPECT_EQ(L1CachePolicyHelper<productFamily>::getL1CachePolicy(), 0u);
|
||||
}
|
||||
|
||||
HWTEST2_F(HwInfoConfigTest, givenAtLeastDG2WhenGetL1CachePolicyThenReturnCorrectValue, IsAtLeastXeHpgCore) {
|
||||
HWTEST2_F(HwInfoConfigTest, givenL1CachePolicyHelperWhenUnsupportedL1PoliciesAndGetUncached1CachePolicyThenReturnOne, IsAtMostXeHpCore) {
|
||||
EXPECT_EQ(L1CachePolicyHelper<productFamily>::getUncachedL1CachePolicy(), 1u);
|
||||
}
|
||||
|
||||
HWTEST2_F(HwInfoConfigTest, givenAtLeastXeHpgCoreWhenGetL1CachePolicyThenReturnCorrectValue, 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) {
|
||||
HWTEST2_F(HwInfoConfigTest, givenAtLeastXeHpgCoreWhenGetUncached1CachePolicyThenReturnCorrectValue, IsAtLeastXeHpgCore) {
|
||||
using GfxFamily = typename HwMapper<productFamily>::GfxFamily;
|
||||
EXPECT_EQ(L1CachePolicyHelper<productFamily>::getUncachedL1CachePolicy(), GfxFamily::STATE_BASE_ADDRESS::L1_CACHE_POLICY_UC);
|
||||
}
|
||||
|
||||
HWTEST2_F(HwInfoConfigTest, givenAtLeastXeHpgCoreAndWriteBackPolicyWhenGetL1CachePolicyThenReturnCorrectValue, IsAtLeastXeHpgCore) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.set(2);
|
||||
|
||||
@@ -29,6 +38,15 @@ HWTEST2_F(HwInfoConfigTest, givenAtLeastDG2AndWriteBackPolicyWhenGetL1CachePolic
|
||||
EXPECT_EQ(0, memcmp(L1CachePolicyHelper<productFamily>::getCachingPolicyOptions(), expectedStr, strlen(expectedStr)));
|
||||
}
|
||||
|
||||
HWTEST2_F(HwInfoConfigTest, givenAtLeastXeHpgCoreAndForceAllResourcesUncachedWhenGetL1CachePolicyThenReturnCorrectValue, IsAtLeastXeHpgCore) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.ForceAllResourcesUncached.set(true);
|
||||
DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.set(4);
|
||||
|
||||
const char *expectedStr = "-cl-store-cache-default=1 -cl-load-cache-default=1";
|
||||
EXPECT_EQ(0, memcmp(L1CachePolicyHelper<productFamily>::getCachingPolicyOptions(), expectedStr, strlen(expectedStr)));
|
||||
}
|
||||
|
||||
HWTEST2_F(HwInfoConfigTest, givenL1CachePolicyHelperWhenDebugFlagSetAndGetL1CachePolicyThenReturnCorrectValue, MatchAny) {
|
||||
DebugManagerStateRestore restorer;
|
||||
|
||||
|
||||
@@ -284,6 +284,7 @@ HWTEST2_F(SBATest, givenStateBaseAddressAndDebugFlagSetWhenAppendExtraCacheSetti
|
||||
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
|
||||
auto stateBaseAddress = FamilyType::cmdInitStateBaseAddress;
|
||||
auto expectedStateBaseAddress = FamilyType::cmdInitStateBaseAddress;
|
||||
DebugManagerStateRestore restore;
|
||||
|
||||
StateBaseAddressHelper<FamilyType>::appendExtraCacheSettings(&stateBaseAddress, &hardwareInfo);
|
||||
EXPECT_EQ(0, memcmp(&stateBaseAddress, &expectedStateBaseAddress, sizeof(STATE_BASE_ADDRESS)));
|
||||
@@ -291,6 +292,35 @@ HWTEST2_F(SBATest, givenStateBaseAddressAndDebugFlagSetWhenAppendExtraCacheSetti
|
||||
DebugManager.flags.ForceStatelessL1CachingPolicy.set(2);
|
||||
StateBaseAddressHelper<FamilyType>::appendExtraCacheSettings(&stateBaseAddress, &hardwareInfo);
|
||||
EXPECT_EQ(0, memcmp(&stateBaseAddress, &expectedStateBaseAddress, sizeof(STATE_BASE_ADDRESS)));
|
||||
|
||||
DebugManager.flags.ForceAllResourcesUncached.set(true);
|
||||
StateBaseAddressHelper<FamilyType>::appendExtraCacheSettings(&stateBaseAddress, &hardwareInfo);
|
||||
EXPECT_EQ(0, memcmp(&stateBaseAddress, &expectedStateBaseAddress, sizeof(STATE_BASE_ADDRESS)));
|
||||
}
|
||||
|
||||
HWTEST2_F(SBATest, givenStateBaseAddressAndDebugFlagSetWhenAppendExtraCacheSettingsThenProgramCorrectL1CachePolicy, IsAtLeastXeHpgCore) {
|
||||
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
|
||||
auto stateBaseAddress = FamilyType::cmdInitStateBaseAddress;
|
||||
DebugManagerStateRestore restore;
|
||||
|
||||
StateBaseAddressHelper<FamilyType>::appendExtraCacheSettings(&stateBaseAddress, &hardwareInfo);
|
||||
EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP, stateBaseAddress.getL1CachePolicyL1CacheControl());
|
||||
|
||||
DebugManager.flags.ForceStatelessL1CachingPolicy.set(2);
|
||||
StateBaseAddressHelper<FamilyType>::appendExtraCacheSettings(&stateBaseAddress, &hardwareInfo);
|
||||
EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WB, stateBaseAddress.getL1CachePolicyL1CacheControl());
|
||||
|
||||
DebugManager.flags.ForceStatelessL1CachingPolicy.set(3);
|
||||
StateBaseAddressHelper<FamilyType>::appendExtraCacheSettings(&stateBaseAddress, &hardwareInfo);
|
||||
EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WT, stateBaseAddress.getL1CachePolicyL1CacheControl());
|
||||
|
||||
DebugManager.flags.ForceStatelessL1CachingPolicy.set(4);
|
||||
StateBaseAddressHelper<FamilyType>::appendExtraCacheSettings(&stateBaseAddress, &hardwareInfo);
|
||||
EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WS, stateBaseAddress.getL1CachePolicyL1CacheControl());
|
||||
|
||||
DebugManager.flags.ForceAllResourcesUncached.set(true);
|
||||
StateBaseAddressHelper<FamilyType>::appendExtraCacheSettings(&stateBaseAddress, &hardwareInfo);
|
||||
EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_UC, stateBaseAddress.getL1CachePolicyL1CacheControl());
|
||||
}
|
||||
|
||||
HWTEST2_F(SBATest, givenDebugFlagSetWhenAppendingSbaThenProgramCorrectL1CachePolicy, IsAtLeastXeHpgCore) {
|
||||
@@ -331,10 +361,15 @@ HWTEST2_F(SBATest, givenDebugFlagSetWhenAppendingSbaThenProgramCorrectL1CachePol
|
||||
};
|
||||
|
||||
for (const auto &input : testInputs) {
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.set(input.option);
|
||||
StateBaseAddressHelper<FamilyType>::appendStateBaseAddressParameters(args, true);
|
||||
|
||||
EXPECT_EQ(input.cachePolicy, sbaCmd.getL1CachePolicyL1CacheControl());
|
||||
|
||||
DebugManager.flags.ForceAllResourcesUncached.set(true);
|
||||
StateBaseAddressHelper<FamilyType>::appendStateBaseAddressParameters(args, true);
|
||||
EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_UC, sbaCmd.getL1CachePolicyL1CacheControl());
|
||||
}
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
@@ -370,6 +405,7 @@ HWTEST2_F(SBATest, givenDebugFlagSetWhenAppendingRssThenProgramCorrectL1CachePol
|
||||
{4, FamilyType::RENDER_SURFACE_STATE::L1_CACHE_POLICY_WS}};
|
||||
|
||||
for (const auto &input : testInputs) {
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.set(input.option);
|
||||
EncodeSurfaceState<FamilyType>::encodeBuffer(args);
|
||||
EXPECT_EQ(input.cachePolicy, rssCmd.getL1CachePolicyL1CacheControl());
|
||||
|
||||
@@ -107,13 +107,13 @@ HWTEST2_F(HwInfoConfigTest, givenAtMostXeHPWhenGetCachingPolicyOptionsThenReturn
|
||||
EXPECT_EQ(compilerHwInfoConfig->getCachingPolicyOptions(), nullptr);
|
||||
}
|
||||
|
||||
HWTEST2_F(HwInfoConfigTest, givenAtLeastDG2WhenGetCachingPolicyOptionsThenReturnWriteByPassPolicyOption, IsAtLeastXeHpgCore) {
|
||||
HWTEST2_F(HwInfoConfigTest, givenAtLeastXeHpgCoreWhenGetCachingPolicyOptionsThenReturnWriteByPassPolicyOption, 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) {
|
||||
HWTEST2_F(HwInfoConfigTest, givenAtLeastXeHpgCoreWhenGetCachingPolicyOptionsThenReturnWriteBackPolicyOption, IsAtLeastXeHpgCore) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.set(2);
|
||||
|
||||
@@ -122,9 +122,19 @@ HWTEST2_F(HwInfoConfigTest, givenAtLeastDG2WhenGetCachingPolicyOptionsThenReturn
|
||||
EXPECT_EQ(0, memcmp(compilerHwInfoConfig->getCachingPolicyOptions(), expectedStr, strlen(expectedStr)));
|
||||
}
|
||||
|
||||
HWTEST2_F(HwInfoConfigTest, givenAtLeastXeHpgCoreAndDebugFlagSetForceAllResourcesUncachedWhenGetCachingPolicyOptionsThenReturnUncachedPolicyOption, IsAtLeastXeHpgCore) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.set(2);
|
||||
DebugManager.flags.ForceAllResourcesUncached.set(true);
|
||||
|
||||
auto compilerHwInfoConfig = CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
|
||||
const char *expectedStr = "-cl-store-cache-default=1 -cl-load-cache-default=1";
|
||||
EXPECT_EQ(0, memcmp(compilerHwInfoConfig->getCachingPolicyOptions(), expectedStr, strlen(expectedStr)));
|
||||
}
|
||||
|
||||
HWTEST2_F(HwInfoConfigTest, givenCachePolicyWithoutCorrespondingBuildOptionWhenGetCachingPolicyOptionsThenReturnNullptr, IsAtLeastXeHpgCore) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.set(1);
|
||||
DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.set(5);
|
||||
|
||||
auto compilerHwInfoConfig = CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
|
||||
EXPECT_EQ(nullptr, compilerHwInfoConfig->getCachingPolicyOptions());
|
||||
@@ -146,6 +156,9 @@ HWTEST2_F(HwInfoConfigTest, givenHwInfoConfigAndDebugFlagWhenGetL1CachePolicyThe
|
||||
|
||||
DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.set(4);
|
||||
EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WS, hwInfoConfig->getL1CachePolicy());
|
||||
|
||||
DebugManager.flags.ForceAllResourcesUncached.set(true);
|
||||
EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_UC, hwInfoConfig->getL1CachePolicy());
|
||||
}
|
||||
|
||||
HWTEST2_F(HwInfoConfigTest, givenHwInfoConfigWhenGetL1CachePolicyThenReturnWriteByPass, IsAtLeastXeHpgCore) {
|
||||
|
||||
Reference in New Issue
Block a user