Skip to content

Commit 0ac8e8c

Browse files
performance: Set L1 cache policy to WB on PTL
Resolves: NEO-16378 Signed-off-by: Lukasz Jobczyk <[email protected]>
1 parent 719b218 commit 0ac8e8c

File tree

8 files changed

+34
-9
lines changed

8 files changed

+34
-9
lines changed

level_zero/core/test/unit_tests/sources/module/test_module.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@
5454
namespace L0 {
5555
namespace ult {
5656

57+
HWTEST_EXCLUDE_PRODUCT(ModuleTranslationUnitTest, givenAtLeastXeHpgCoreWhenGetInternalOptionsThenCorrectBuildOptionIsSet_IsAtLeastXeCore, IGFX_PTL);
58+
5759
using ModuleTest = Test<ModuleFixture>;
5860

5961
TEST_F(ModuleTest, GivenGeneralRegisterFileDescriptorWhenGetKernelPropertiesIsCalledThenDescriptorIsCorrectlySet) {

opencl/test/unit_test/program/program_tests.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@
7171

7272
using namespace NEO;
7373

74+
HWTEST_EXCLUDE_PRODUCT(ProgramTests, givenAtLeastXeHpgCoreWhenGetInternalOptionsThenCorrectBuildOptionIsSet_IsAtLeastXeCore, IGFX_PTL);
75+
7476
void ProgramTests::SetUp() {
7577
ClDeviceFixture::setUp();
7678
cl_device_id device = pClDevice;

opencl/test/unit_test/xe3_core/test_cmds_programming_xe3_core.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ XE3_CORETEST_F(CmdsProgrammingTestsXe3Core, givenL3ToL1DebugFlagWhenStatelessMoc
4444

4545
auto actualL1CachePolocy = static_cast<uint8_t>(stateBaseAddress->getL1CacheControlCachePolicy());
4646

47-
const uint8_t expectedL1CachePolicy = 0;
47+
const uint8_t expectedL1CachePolicy = pDevice->getHardwareInfo().platform.eProductFamily == IGFX_PTL ? 2 : 0;
4848
EXPECT_EQ(expectedL1CachePolicy, actualL1CachePolocy);
4949
}
5050

@@ -75,7 +75,8 @@ XE3_CORETEST_F(CmdsProgrammingTestsXe3Core, whenAppendingRssThenProgramWtL1Cache
7575

7676
EncodeSurfaceState<FamilyType>::encodeBuffer(args);
7777

78-
EXPECT_EQ(FamilyType::RENDER_SURFACE_STATE::L1_CACHE_CONTROL_WBP, rssCmd.getL1CacheControlCachePolicy());
78+
const uint8_t expectedL1CachePolicy = pDevice->getHardwareInfo().platform.eProductFamily == IGFX_PTL ? 2 : 0;
79+
EXPECT_EQ(expectedL1CachePolicy, rssCmd.getL1CacheControlCachePolicy());
7980
}
8081

8182
XE3_CORETEST_F(CmdsProgrammingTestsXe3Core, givenAlignedCacheableReadOnlyBufferThenChoseOclBufferConstPolicy) {
@@ -102,7 +103,7 @@ XE3_CORETEST_F(CmdsProgrammingTestsXe3Core, givenAlignedCacheableReadOnlyBufferT
102103

103104
auto actualL1CachePolocy = static_cast<uint8_t>(surfaceState.getL1CacheControlCachePolicy());
104105

105-
const uint8_t expectedL1CachePolicy = 0;
106+
const uint8_t expectedL1CachePolicy = pDevice->getHardwareInfo().platform.eProductFamily == IGFX_PTL ? 2 : 0;
106107
EXPECT_EQ(expectedL1CachePolicy, actualL1CachePolocy);
107108

108109
alignedFree(ptr);

shared/source/xe3_core/definitions/enable_xe3_core_products.inl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@
66
*/
77

88
#ifdef SUPPORT_PTL
9+
10+
template <>
11+
uint32_t L1CachePolicyHelper<IGFX_PTL>::getDefaultL1CachePolicy(bool isDebuggerActive) {
12+
using GfxFamily = HwMapper<IGFX_PTL>::GfxFamily;
13+
if (isDebuggerActive) {
14+
return GfxFamily::STATE_BASE_ADDRESS::L1_CACHE_CONTROL_WBP;
15+
}
16+
return GfxFamily::STATE_BASE_ADDRESS::L1_CACHE_CONTROL_WB;
17+
}
18+
919
template struct L1CachePolicyHelper<IGFX_PTL>;
1020
static EnableGfxProductHw<IGFX_PTL> enableGfxProductHwPTL;
1121
#endif

shared/test/unit_test/helpers/cache_policy_tests.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,17 @@ HWTEST2_F(ProductHelperTest, givenL1CachePolicyHelperWhenUnsupportedL1PoliciesAn
2525

2626
HWTEST2_F(ProductHelperTest, givenAtLeastXeHpgCoreWhenGetL1CachePolicyThenReturnCorrectValue, IsAtLeastXeCore) {
2727
using GfxFamily = typename HwMapper<productFamily>::GfxFamily;
28-
auto policy = [&]() -> uint32_t {
29-
if constexpr (GfxFamily::isHeaplessRequired()) {
28+
auto policy = [&](bool debuggerActive) -> uint32_t {
29+
if constexpr (productFamily == IGFX_PTL) {
30+
return debuggerActive ? GfxFamily::RENDER_SURFACE_STATE::L1_CACHE_CONTROL_WBP : GfxFamily::RENDER_SURFACE_STATE::L1_CACHE_CONTROL_WB;
31+
} else if constexpr (GfxFamily::isHeaplessRequired()) {
3032
return GfxFamily::RENDER_SURFACE_STATE::L1_CACHE_CONTROL_WBP;
3133
} else {
3234
return GfxFamily::STATE_BASE_ADDRESS::L1_CACHE_CONTROL_WBP;
3335
}
34-
}();
35-
EXPECT_EQ(L1CachePolicyHelper<productFamily>::getL1CachePolicy(false), policy);
36-
EXPECT_EQ(L1CachePolicyHelper<productFamily>::getL1CachePolicy(true), policy);
36+
};
37+
EXPECT_EQ(L1CachePolicyHelper<productFamily>::getL1CachePolicy(false), policy(false));
38+
EXPECT_EQ(L1CachePolicyHelper<productFamily>::getL1CachePolicy(true), policy(true));
3739
}
3840

3941
HWTEST2_F(ProductHelperTest, givenAtLeastXeHpgCoreWhenGetUncached1CachePolicyThenReturnCorrectValue, IsAtLeastXeCore) {

shared/test/unit_test/xe3_core/ptl/excludes_xe3_core_ptl.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@
88
#include "shared/test/common/test_macros/hw_test_base.h"
99

1010
HWTEST_EXCLUDE_PRODUCT(ProductHelperTest, whenGettingPreferredAllocationMethodThenNoPreferenceIsReturned, IGFX_PTL);
11+
HWTEST_EXCLUDE_PRODUCT(ProductHelperTest, givenProductHelperWhenGetL1CachePolicyThenReturnWriteByPass_IsSbaRequiredAndAtLeastXeCore, IGFX_PTL);
12+
HWTEST_EXCLUDE_PRODUCT(CompilerProductHelperFixture, givenAtLeastXeHpgCoreWhenGetCachingPolicyOptionsThenReturnWriteByPassPolicyOption_IsAtLeastXeCore, IGFX_PTL);
13+
HWTEST_EXCLUDE_PRODUCT(SbaTest, givenStateBaseAddressAndDebugFlagSetWhenAppendExtraCacheSettingsThenProgramCorrectL1CachePolicy_IsSbaRequiredAndAtLeastXeCore, IGFX_PTL);

shared/test/unit_test/xe3_core/ptl/product_helper_tests_ptl.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ PTLTEST_F(PtlProductHelper, givenProductHelperWhenCheckingIsBufferPoolAllocatorS
7575
EXPECT_TRUE(productHelper->isBufferPoolAllocatorSupported());
7676
}
7777

78+
PTLTEST_F(ProductHelperTest, givenProductHelperWhenGetL1CachePolicyThenReturnWriteByPass) {
79+
EXPECT_EQ(2u, productHelper->getL1CachePolicy(false));
80+
EXPECT_EQ(0u, productHelper->getL1CachePolicy(true));
81+
}
82+
7883
PTLTEST_F(PtlProductHelper, givenDebugFlagWhenCheckingIsResolveDependenciesByPipeControlsSupportedThenTheFlagDerivedValueIsReturned) {
7984
DebugManagerStateRestore restorer;
8085

shared/test/unit_test/xe3_core/test_encode_xe3_core.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ XE3_CORETEST_F(Xe3SbaTest, givenSpecificProductFamilyWhenAppendingSbaThenProgram
593593

594594
StateBaseAddressHelper<FamilyType>::appendStateBaseAddressParameters(args);
595595

596-
EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_CONTROL_WBP, sbaCmd.getL1CacheControlCachePolicy());
596+
EXPECT_EQ(pDevice->getHardwareInfo().platform.eProductFamily == IGFX_PTL ? 2 : 0, sbaCmd.getL1CacheControlCachePolicy());
597597
}
598598

599599
XE3_CORETEST_F(Xe3SbaTest, givenL1CachingOverrideWhenStateBaseAddressIsProgrammedThenItMatchesTheOverrideValue) {

0 commit comments

Comments
 (0)