mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
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:
committed by
Compute-Runtime-Automation
parent
8e027a305d
commit
76e023b941
@@ -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)));
|
||||
}
|
||||
|
||||
@@ -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
|
||||
)
|
||||
|
||||
46
shared/test/unit_test/helpers/cache_policy_tests.cpp
Normal file
46
shared/test/unit_test/helpers/cache_policy_tests.cpp
Normal 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);
|
||||
}
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user