Debian Codegraph @

shared/test/unit_test/gen12lp/adls/test_product_helper_adls.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_adls.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 AdlsHwInfo = ::testing::Test;
24
25 ADLSTEST_F(AdlsHwInfo, givenBoolWhenCallAdlsHardwareInfoSetupThenFeatureTableAndWorkaroundTableAreSetCorrect) {
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 = 0x100020016;
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_EQ(setParamBool, 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 ADLSTEST_F(AdlsHwInfo, whenPlatformIsAdlsThenExpectSvmIsSet) {
62 const HardwareInfo &hardwareInfo = ADLS::hwInfo;
63 EXPECT_TRUE(hardwareInfo.capabilityTable.ftrSvm);
64 }
65
66 ADLSTEST_F(AdlsHwInfo, givenAdlsWhenCheckL0ThenReturnTrue) {
67 const HardwareInfo &hardwareInfo = ADLS::hwInfo;
68 EXPECT_TRUE(hardwareInfo.capabilityTable.levelZeroSupported);
69 }
70
71 using AdlsProductHelper = ProductHelperTest;
72
73 ADLSTEST_F(AdlsProductHelper, whenGettingAubstreamProductFamilyThenProperEnumValueIsReturned) {
74 EXPECT_EQ(aub_stream::ProductFamily::Adls, productHelper->getAubStreamProductFamily());
75 }
76
77 ADLSTEST_F(AdlsProductHelper, givenCompilerProductHelperWhenGetProductConfigThenCorrectMatchIsFound) {
78
79 EXPECT_EQ(compilerProductHelper->getHwIpVersion(pInHwInfo), AOT::ADL_S);
80 }
81
82 ADLSTEST_F(AdlsProductHelper, givenCompilerProductHelperWhenGettingOclocEnforceZebinFormatThenExpectTrue) {
83
84 EXPECT_TRUE(compilerProductHelper->oclocEnforceZebinFormat());
85 }
86
87 ADLSTEST_F(AdlsProductHelper, givenProductHelperWhenGettingEvictIfNecessaryFlagSupportedThenExpectTrue) {
88
89 EXPECT_TRUE(productHelper->isEvictionIfNecessaryFlagSupported());
90 }
91
92 ADLSTEST_F(AdlsProductHelper, givenProductHelperWhenGetCommandsStreamPropertiesSupportThenExpectCorrectValues) {
93
94 EXPECT_FALSE(productHelper->getScmPropertyThreadArbitrationPolicySupport());
95 EXPECT_TRUE(productHelper->getScmPropertyCoherencyRequiredSupport());
96 EXPECT_FALSE(productHelper->getScmPropertyZPassAsyncComputeThreadLimitSupport());
97 EXPECT_FALSE(productHelper->getScmPropertyPixelAsyncComputeThreadLimitSupport());
98 EXPECT_FALSE(productHelper->getScmPropertyLargeGrfModeSupport());
99 EXPECT_FALSE(productHelper->getScmPropertyDevicePreemptionModeSupport());
100
101 EXPECT_FALSE(productHelper->getStateBaseAddressPropertyBindingTablePoolBaseAddressSupport());
102
103 EXPECT_TRUE(productHelper->getFrontEndPropertyScratchSizeSupport());
104 EXPECT_FALSE(productHelper->getFrontEndPropertyPrivateScratchSizeSupport());
105
106 EXPECT_TRUE(productHelper->getPreemptionDbgPropertyPreemptionModeSupport());
107 EXPECT_TRUE(productHelper->getPreemptionDbgPropertyStateSipSupport());
108 EXPECT_TRUE(productHelper->getPreemptionDbgPropertyCsrSurfaceSupport());
109
110 EXPECT_FALSE(productHelper->getFrontEndPropertyComputeDispatchAllWalkerSupport());
111 EXPECT_TRUE(productHelper->getFrontEndPropertyDisableEuFusionSupport());
112 EXPECT_FALSE(productHelper->getFrontEndPropertyDisableOverDispatchSupport());
113 EXPECT_FALSE(productHelper->getFrontEndPropertySingleSliceDispatchCcsModeSupport());
114
115 EXPECT_TRUE(productHelper->getPipelineSelectPropertyMediaSamplerDopClockGateSupport());
116 EXPECT_FALSE(productHelper->getPipelineSelectPropertySystolicModeSupport());
117 }
118
119 ADLSTEST_F(AdlsProductHelper, givenA0SteppingAndAdlsPlatformWhenAskingIfWAIsRequiredThenReturnTrue) {
120 std::array<std::pair<uint32_t, bool>, 3> revisions = {
121 {{REVISION_A0, true},
122 {REVISION_B, false},
123 {REVISION_C, false}}};
124
125 for (const auto &[revision, paramBool] : revisions) {
126 auto hwInfo = *defaultHwInfo;
127 hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(revision, hwInfo);
128 productHelper->configureHardwareCustom(&hwInfo, nullptr);
129
130 EXPECT_EQ(paramBool, productHelper->pipeControlWARequired(hwInfo));
131 }
132 }