Debian Codegraph @

shared/test/unit_test/gen12lp/rkl/test_product_helper_rkl.cpp

raw
1 /*
2 * Copyright (C) 2020-2024 Intel Corporation
3 *
4 * SPDX-License-Identifier: MIT
5 *
6 */
7
8 #include "shared/source/gen12lp/hw_cmds_rkl.h"
9 #include "shared/source/gen12lp/hw_info_gen12lp.h"
10 #include "shared/source/helpers/compiler_product_helper.h"
11 #include "shared/source/helpers/gfx_core_helper.h"
12 #include "shared/source/os_interface/product_helper.h"
13 #include "shared/test/common/helpers/default_hw_info.h"
14 #include "shared/test/common/mocks/mock_execution_environment.h"
15 #include "shared/test/common/test_macros/header/per_product_test_definitions.h"
16 #include "shared/test/common/test_macros/test.h"
17 #include "shared/test/unit_test/os_interface/product_helper_tests.h"
18
19 #include "platforms.h"
20
21 using namespace NEO;
22
23 using RklHwInfo = ::testing::Test;
24
25 RKLTEST_F(RklHwInfo, givenBoolWhenCallRklHardwareInfoSetupThenFeatureTableAndWorkaroundTableAreSetCorrect) {
26 uint64_t configs[] = {
27 0x100020010};
28 bool boolValue[]{
29 true, false};
30 HardwareInfo hwInfo = *defaultHwInfo;
31 GT_SYSTEM_INFO &gtSystemInfo = hwInfo.gtSystemInfo;
32 FeatureTable &featureTable = hwInfo.featureTable;
33 WorkaroundTable &workaroundTable = hwInfo.workaroundTable;
34
35 for (auto &config : configs) {
36 for (auto setParamBool : boolValue) {
37
38 gtSystemInfo = {0};
39 featureTable = {};
40 workaroundTable = {};
41 hardwareInfoSetup[productFamily](&hwInfo, setParamBool, config, nullptr);
42
43 EXPECT_EQ(setParamBool, featureTable.flags.ftrL3IACoherency);
44 EXPECT_EQ(setParamBool, featureTable.flags.ftrPPGTT);
45 EXPECT_EQ(setParamBool, featureTable.flags.ftrSVM);
46 EXPECT_EQ(setParamBool, featureTable.flags.ftrIA32eGfxPTEs);
47 EXPECT_EQ(setParamBool, featureTable.flags.ftrStandardMipTailFormat);
48
49 EXPECT_EQ(setParamBool, featureTable.flags.ftrTranslationTable);
50 EXPECT_EQ(setParamBool, featureTable.flags.ftrUserModeTranslationTable);
51 EXPECT_EQ(setParamBool, featureTable.flags.ftrTileMappedResource);
52
53 EXPECT_EQ(setParamBool, featureTable.flags.ftrFbc);
54 EXPECT_EQ(setParamBool, featureTable.flags.ftrTileY);
55
56 EXPECT_EQ(setParamBool, featureTable.flags.ftrAstcHdr2D);
57 EXPECT_EQ(setParamBool, featureTable.flags.ftrAstcLdr2D);
58 EXPECT_EQ(setParamBool, featureTable.flags.ftrGpGpuMidBatchPreempt);
59 EXPECT_EQ(setParamBool, featureTable.flags.ftrGpGpuThreadGroupLevelPreempt);
60
61 EXPECT_EQ(setParamBool, workaroundTable.flags.wa4kAlignUVOffsetNV12LinearSurface);
62 }
63 }
64 }
65
66 RKLTEST_F(RklHwInfo, whenPlatformIsRklThenExpectSvmIsSet) {
67 const HardwareInfo &hardwareInfo = RKL::hwInfo;
68 EXPECT_TRUE(hardwareInfo.capabilityTable.ftrSvm);
69 }
70
71 RKLTEST_F(RklHwInfo, givenRklWhenCheckFtrSupportsInteger64BitAtomicsThenReturnFalse) {
72 const HardwareInfo &hardwareInfo = RKL::hwInfo;
73 EXPECT_TRUE(hardwareInfo.capabilityTable.ftrSupportsInteger64BitAtomics);
74 }
75
76 RKLTEST_F(RklHwInfo, givenRklWhenCheckL0ThenReturnTrue) {
77 const HardwareInfo &hardwareInfo = RKL::hwInfo;
78 EXPECT_TRUE(hardwareInfo.capabilityTable.levelZeroSupported);
79 }
80
81 using RklProductHelper = ProductHelperTest;
82
83 RKLTEST_F(RklProductHelper, givenCompilerProductHelperWhenGetProductConfigThenCorrectMatchIsFound) {
84 EXPECT_EQ(compilerProductHelper->getHwIpVersion(pInHwInfo), AOT::RKL);
85 }
86
87 RKLTEST_F(RklProductHelper, givenCompilerProductHelperWhenGettingOclocEnforceZebinFormatThenExpectTrue) {
88 EXPECT_TRUE(compilerProductHelper->oclocEnforceZebinFormat());
89 }
90
91 RKLTEST_F(RklProductHelper, givenProductHelperWhenGettingEvictIfNecessaryFlagSupportedThenExpectTrue) {
92 EXPECT_TRUE(productHelper->isEvictionIfNecessaryFlagSupported());
93 }
94
95 RKLTEST_F(RklProductHelper, givenProductHelperWhenGetCommandsStreamPropertiesSupportThenExpectCorrectValues) {
96 EXPECT_FALSE(productHelper->getScmPropertyThreadArbitrationPolicySupport());
97 EXPECT_TRUE(productHelper->getScmPropertyCoherencyRequiredSupport());
98 EXPECT_FALSE(productHelper->getScmPropertyZPassAsyncComputeThreadLimitSupport());
99 EXPECT_FALSE(productHelper->getScmPropertyPixelAsyncComputeThreadLimitSupport());
100 EXPECT_FALSE(productHelper->getScmPropertyLargeGrfModeSupport());
101 EXPECT_FALSE(productHelper->getScmPropertyDevicePreemptionModeSupport());
102
103 EXPECT_FALSE(productHelper->getStateBaseAddressPropertyBindingTablePoolBaseAddressSupport());
104
105 EXPECT_TRUE(productHelper->getFrontEndPropertyScratchSizeSupport());
106 EXPECT_FALSE(productHelper->getFrontEndPropertyPrivateScratchSizeSupport());
107
108 EXPECT_TRUE(productHelper->getPreemptionDbgPropertyPreemptionModeSupport());
109 EXPECT_TRUE(productHelper->getPreemptionDbgPropertyStateSipSupport());
110 EXPECT_TRUE(productHelper->getPreemptionDbgPropertyCsrSurfaceSupport());
111
112 EXPECT_FALSE(productHelper->getFrontEndPropertyComputeDispatchAllWalkerSupport());
113 EXPECT_TRUE(productHelper->getFrontEndPropertyDisableEuFusionSupport());
114 EXPECT_FALSE(productHelper->getFrontEndPropertyDisableOverDispatchSupport());
115 EXPECT_FALSE(productHelper->getFrontEndPropertySingleSliceDispatchCcsModeSupport());
116
117 EXPECT_TRUE(productHelper->getPipelineSelectPropertyMediaSamplerDopClockGateSupport());
118 EXPECT_FALSE(productHelper->getPipelineSelectPropertySystolicModeSupport());
119 }
120
121 RKLTEST_F(RklProductHelper, givenA0OrBSteppingAndRklPlatformWhenAskingIfWAIsRequiredThenReturnTrue) {
122
123 std::array<std::pair<uint32_t, bool>, 3> revisions = {
124 {{REVISION_A0, true},
125 {REVISION_B, true},
126 {REVISION_C, false}}};
127
128 for (const auto &[revision, paramBool] : revisions) {
129 auto hwInfo = *defaultHwInfo;
130 hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(revision, hwInfo);
131
132 productHelper->configureHardwareCustom(&hwInfo, nullptr);
133
134 EXPECT_EQ(paramBool, productHelper->isForceEmuInt32DivRemSPWARequired(hwInfo));
135 }
136 }
137
138 RKLTEST_F(RklProductHelper, givenProductHelperWhenAskedIf3DPipelineSelectWAIsRequiredThenTrueIsReturned) {
139 EXPECT_TRUE(productHelper->is3DPipelineSelectWARequired());
140 }
141
142 using CompilerProductHelperHelperTestsRkl = ::testing::Test;
143 RKLTEST_F(CompilerProductHelperHelperTestsRkl, givenRklWhenIsForceEmuInt32DivRemSPRequiredIsCalledThenReturnsTrue) {
144 MockExecutionEnvironment mockExecutionEnvironment{};
145 auto &compilerProductHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<CompilerProductHelper>();
146 EXPECT_TRUE(compilerProductHelper.isForceEmuInt32DivRemSPRequired());
147 }