Debian Codegraph @

shared/test/unit_test/gen12lp/adlp/test_product_helper_adlp.cpp

raw
1 /*
2 * Copyright (C) 2021-2024 Intel Corporation
3 *
4 * SPDX-License-Identifier: MIT
5 *
6 */
7
8 #include "shared/source/gen12lp/hw_cmds_adlp.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/test_macros/header/per_product_test_definitions.h"
15 #include "shared/test/common/test_macros/test.h"
16 #include "shared/test/unit_test/os_interface/product_helper_tests.h"
17
18 #include "aubstream/product_family.h"
19 #include "platforms.h"
20
21 using namespace NEO;
22
23 using AdlpHwInfo = ::testing::Test;
24
25 ADLPTEST_F(AdlpHwInfo, givenBoolWhenCallAdlpHardwareInfoSetupThenFeatureTableAndWorkaroundTableAreSetCorrect) {
26 static bool boolValue[]{
27 true, false};
28 HardwareInfo hwInfo = *defaultHwInfo;
29 GT_SYSTEM_INFO &gtSystemInfo = hwInfo.gtSystemInfo;
30 FeatureTable &featureTable = hwInfo.featureTable;
31 WorkaroundTable &workaroundTable = hwInfo.workaroundTable;
32
33 uint64_t config = 0x0;
34 for (auto setParamBool : boolValue) {
35
36 gtSystemInfo = {0};
37 featureTable = {};
38 workaroundTable = {};
39 hardwareInfoSetup[productFamily](&hwInfo, setParamBool, config, nullptr);
40
41 EXPECT_EQ(setParamBool, featureTable.flags.ftrL3IACoherency);
42 EXPECT_EQ(setParamBool, featureTable.flags.ftrPPGTT);
43 EXPECT_EQ(setParamBool, featureTable.flags.ftrSVM);
44 EXPECT_EQ(setParamBool, featureTable.flags.ftrIA32eGfxPTEs);
45 EXPECT_EQ(setParamBool, featureTable.flags.ftrStandardMipTailFormat);
46 EXPECT_EQ(setParamBool, featureTable.flags.ftrTranslationTable);
47 EXPECT_EQ(setParamBool, featureTable.flags.ftrUserModeTranslationTable);
48 EXPECT_EQ(setParamBool, featureTable.flags.ftrTileMappedResource);
49 EXPECT_EQ(setParamBool, featureTable.flags.ftrFbc);
50 EXPECT_FALSE(featureTable.flags.ftrTileY);
51 EXPECT_EQ(setParamBool, featureTable.flags.ftrAstcHdr2D);
52 EXPECT_EQ(setParamBool, featureTable.flags.ftrAstcLdr2D);
53 EXPECT_EQ(setParamBool, featureTable.flags.ftrGpGpuMidBatchPreempt);
54 EXPECT_EQ(setParamBool, featureTable.flags.ftrGpGpuThreadGroupLevelPreempt);
55
56 EXPECT_EQ(setParamBool, workaroundTable.flags.wa4kAlignUVOffsetNV12LinearSurface);
57 EXPECT_EQ(setParamBool, workaroundTable.flags.waUntypedBufferCompression);
58 }
59 }
60
61 ADLPTEST_F(AdlpHwInfo, whenPlatformIsAdlpThenExpectSvmIsSet) {
62 const HardwareInfo &hardwareInfo = ADLP::hwInfo;
63 EXPECT_TRUE(hardwareInfo.capabilityTable.ftrSvm);
64 }
65
66 ADLPTEST_F(AdlpHwInfo, givenAdlpWhenCheckL0ThenReturnTrue) {
67 const HardwareInfo &hardwareInfo = ADLP::hwInfo;
68 EXPECT_TRUE(hardwareInfo.capabilityTable.levelZeroSupported);
69 }
70
71 using AdlpProductHelper = ProductHelperTest;
72
73 ADLPTEST_F(AdlpProductHelper, whenGettingAubstreamProductFamilyThenProperEnumValueIsReturned) {
74 EXPECT_EQ(aub_stream::ProductFamily::Adlp, productHelper->getAubStreamProductFamily());
75 }
76
77 ADLPTEST_F(AdlpProductHelper, givenCompilerProductHelperWhenGetProductConfigThenCorrectMatchIsFound) {
78
79 EXPECT_EQ(compilerProductHelper->getHwIpVersion(pInHwInfo), AOT::ADL_P);
80 }
81
82 ADLPTEST_F(AdlpProductHelper, givenCompilerProductHelperWhenGettingOclocEnforceZebinFormatThenExpectTrue) {
83
84 EXPECT_TRUE(compilerProductHelper->oclocEnforceZebinFormat());
85 }
86
87 ADLPTEST_F(AdlpProductHelper, givenProductHelperWhenGettingEvictIfNecessaryFlagSupportedThenExpectTrue) {
88
89 EXPECT_TRUE(productHelper->isEvictionIfNecessaryFlagSupported());
90 }
91
92 ADLPTEST_F(AdlpProductHelper, givenProductHelperWhenIsSystolicModeConfigurabledThenTrueIsReturned) {
93
94 EXPECT_TRUE(productHelper->isSystolicModeConfigurable(pInHwInfo));
95 }
96
97 ADLPTEST_F(AdlpProductHelper, givenProductHelperWhenGetCommandsStreamPropertiesSupportThenExpectCorrectValues) {
98
99 EXPECT_FALSE(productHelper->getScmPropertyThreadArbitrationPolicySupport());
100 EXPECT_TRUE(productHelper->getScmPropertyCoherencyRequiredSupport());
101 EXPECT_FALSE(productHelper->getScmPropertyZPassAsyncComputeThreadLimitSupport());
102 EXPECT_FALSE(productHelper->getScmPropertyPixelAsyncComputeThreadLimitSupport());
103 EXPECT_FALSE(productHelper->getScmPropertyLargeGrfModeSupport());
104 EXPECT_FALSE(productHelper->getScmPropertyDevicePreemptionModeSupport());
105
106 EXPECT_FALSE(productHelper->getStateBaseAddressPropertyBindingTablePoolBaseAddressSupport());
107
108 EXPECT_TRUE(productHelper->getFrontEndPropertyScratchSizeSupport());
109 EXPECT_FALSE(productHelper->getFrontEndPropertyPrivateScratchSizeSupport());
110
111 EXPECT_TRUE(productHelper->getPreemptionDbgPropertyPreemptionModeSupport());
112 EXPECT_TRUE(productHelper->getPreemptionDbgPropertyStateSipSupport());
113 EXPECT_TRUE(productHelper->getPreemptionDbgPropertyCsrSurfaceSupport());
114
115 EXPECT_FALSE(productHelper->getFrontEndPropertyComputeDispatchAllWalkerSupport());
116 EXPECT_TRUE(productHelper->getFrontEndPropertyDisableEuFusionSupport());
117 EXPECT_FALSE(productHelper->getFrontEndPropertyDisableOverDispatchSupport());
118 EXPECT_FALSE(productHelper->getFrontEndPropertySingleSliceDispatchCcsModeSupport());
119
120 EXPECT_TRUE(productHelper->getPipelineSelectPropertyMediaSamplerDopClockGateSupport());
121 EXPECT_TRUE(productHelper->getPipelineSelectPropertySystolicModeSupport());
122 }
123
124 ADLPTEST_F(AdlpProductHelper, givenA0SteppingAndAdlpPlatformWhenAskingIfWAIsRequiredThenReturnTrue) {
125 std::array<std::pair<uint32_t, bool>, 3> revisions = {
126 {{REVISION_A0, true},
127 {REVISION_B, false},
128 {REVISION_C, false}}};
129
130 for (const auto &[revision, paramBool] : revisions) {
131 auto hwInfo = *defaultHwInfo;
132 hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(revision, hwInfo);
133 productHelper->configureHardwareCustom(&hwInfo, nullptr);
134
135 EXPECT_EQ(paramBool, productHelper->pipeControlWARequired(hwInfo));
136 }
137 }