Debian Codegraph @

shared/test/unit_test/gen12lp/dg1/test_product_helper_dg1.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_dg1.h"
9 #include "shared/source/helpers/compiler_product_helper.h"
10 #include "shared/source/helpers/gfx_core_helper.h"
11 #include "shared/source/os_interface/product_helper.h"
12 #include "shared/test/common/helpers/default_hw_info.h"
13 #include "shared/test/common/test_macros/header/per_product_test_definitions.h"
14 #include "shared/test/common/test_macros/test.h"
15 #include "shared/test/unit_test/os_interface/product_helper_tests.h"
16
17 #include "aubstream/product_family.h"
18 #include "hw_cmds.h"
19 #include "platforms.h"
20
21 using namespace NEO;
22
23 using Dg1HwInfo = ::testing::Test;
24
25 DG1TEST_F(Dg1HwInfo, givenInvalidSystemInfoWhenSettingHardwareInfoThenExpectThrow) {
26 HardwareInfo hwInfo = *defaultHwInfo;
27 GT_SYSTEM_INFO &gtSystemInfo = hwInfo.gtSystemInfo;
28
29 uint64_t config = 0xdeadbeef;
30 gtSystemInfo = {0};
31 EXPECT_ANY_THROW(hardwareInfoSetup[productFamily](&hwInfo, false, config, nullptr));
32 EXPECT_EQ(0u, gtSystemInfo.SliceCount);
33 EXPECT_EQ(0u, gtSystemInfo.SubSliceCount);
34 EXPECT_EQ(0u, gtSystemInfo.DualSubSliceCount);
35 EXPECT_EQ(0u, gtSystemInfo.EUCount);
36 }
37
38 DG1TEST_F(Dg1HwInfo, givenBoolWhenCallDg1HardwareInfoSetupThenFeatureTableAndWorkaroundTableAreSetCorrect) {
39 bool boolValue[]{
40 true, false};
41 HardwareInfo hwInfo = *defaultHwInfo;
42 GT_SYSTEM_INFO &gtSystemInfo = hwInfo.gtSystemInfo;
43 FeatureTable &featureTable = hwInfo.featureTable;
44 WorkaroundTable &workaroundTable = hwInfo.workaroundTable;
45
46 uint64_t config = 0x100060010;
47 for (auto setParamBool : boolValue) {
48
49 gtSystemInfo = {0};
50 featureTable = {};
51 workaroundTable = {};
52 hardwareInfoSetup[productFamily](&hwInfo, setParamBool, config, nullptr);
53
54 EXPECT_EQ(setParamBool, featureTable.flags.ftrL3IACoherency);
55 EXPECT_EQ(setParamBool, featureTable.flags.ftrPPGTT);
56 EXPECT_EQ(setParamBool, featureTable.flags.ftrSVM);
57 EXPECT_EQ(setParamBool, featureTable.flags.ftrIA32eGfxPTEs);
58 EXPECT_EQ(setParamBool, featureTable.flags.ftrStandardMipTailFormat);
59 EXPECT_EQ(setParamBool, featureTable.flags.ftrLocalMemory);
60 EXPECT_EQ(setParamBool, featureTable.flags.ftrTranslationTable);
61 EXPECT_EQ(setParamBool, featureTable.flags.ftrUserModeTranslationTable);
62 EXPECT_EQ(setParamBool, featureTable.flags.ftrTileMappedResource);
63 EXPECT_EQ(setParamBool, featureTable.flags.ftrFbc);
64 EXPECT_EQ(setParamBool, featureTable.flags.ftrTileY);
65 EXPECT_EQ(setParamBool, featureTable.flags.ftrAstcLdr2D);
66 EXPECT_EQ(setParamBool, featureTable.flags.ftrAstcHdr2D);
67 EXPECT_EQ(setParamBool, featureTable.flags.ftrGpGpuMidBatchPreempt);
68 EXPECT_EQ(setParamBool, featureTable.flags.ftrGpGpuThreadGroupLevelPreempt);
69
70 EXPECT_EQ(setParamBool, workaroundTable.flags.wa4kAlignUVOffsetNV12LinearSurface);
71 }
72 }
73
74 DG1TEST_F(Dg1HwInfo, whenPlatformIsDg1ThenExpectSvmIsSet) {
75 const HardwareInfo &hardwareInfo = DG1::hwInfo;
76 EXPECT_TRUE(hardwareInfo.capabilityTable.ftrSvm);
77 }
78
79 using Dg1ProductHelper = ProductHelperTest;
80
81 DG1TEST_F(Dg1ProductHelper, whenGettingAubstreamProductFamilyThenProperEnumValueIsReturned) {
82 EXPECT_EQ(aub_stream::ProductFamily::Dg1, productHelper->getAubStreamProductFamily());
83 }
84
85 DG1TEST_F(Dg1ProductHelper, givenA0SteppingAndDg1PlatformWhenAskingIfWAIsRequiredThenReturnTrue) {
86
87 std::array<std::pair<uint32_t, bool>, 2> revisions = {
88 {{REVISION_A0, true},
89 {REVISION_B, false}}};
90
91 for (const auto &[revision, paramBool] : revisions) {
92 auto hwInfo = *defaultHwInfo;
93 hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(revision, hwInfo);
94
95 productHelper->configureHardwareCustom(&hwInfo, nullptr);
96
97 EXPECT_EQ(paramBool, productHelper->pipeControlWARequired(hwInfo));
98 EXPECT_EQ(paramBool, productHelper->imagePitchAlignmentWARequired(hwInfo));
99 EXPECT_EQ(paramBool, productHelper->isForceEmuInt32DivRemSPWARequired(hwInfo));
100 }
101 }
102
103 DG1TEST_F(Dg1ProductHelper, givenProductHelperWhenAskedIfStorageInfoAdjustmentIsRequiredThenTrueIsReturned) {
104 EXPECT_TRUE(productHelper->isStorageInfoAdjustmentRequired());
105 }
106
107 DG1TEST_F(Dg1ProductHelper, givenProductHelperWhenAskedIf3DPipelineSelectWAIsRequiredThenTrueIsReturned) {
108 EXPECT_TRUE(productHelper->is3DPipelineSelectWARequired());
109 }
110
111 DG1TEST_F(Dg1ProductHelper, givenDg1WhenObtainingBlitterPreferenceThenReturnTrue) {
112 const auto &hardwareInfo = DG1::hwInfo;
113 EXPECT_TRUE(productHelper->obtainBlitterPreference(hardwareInfo));
114 }
115
116 DG1TEST_F(Dg1ProductHelper, whenConfigureHwInfoThenBlitterSupportIsEnabled) {
117 auto hardwareInfo = *defaultHwInfo;
118 hardwareInfo.capabilityTable.blitterOperationsSupported = false;
119 productHelper->configureHardwareCustom(&hardwareInfo, nullptr);
120
121 EXPECT_TRUE(hardwareInfo.capabilityTable.blitterOperationsSupported);
122 }
123
124 DG1TEST_F(Dg1ProductHelper, givenDg1WhenObtainingFullBlitterSupportThenReturnFalse) {
125 const auto &hardwareInfo = DG1::hwInfo;
126
127 EXPECT_FALSE(productHelper->isBlitterFullySupported(hardwareInfo));
128 }
129
130 DG1TEST_F(Dg1ProductHelper, whenOverrideGfxPartitionLayoutForWslThenReturnTrue) {
131 EXPECT_TRUE(productHelper->overrideGfxPartitionLayoutForWsl());
132 }
133
134 DG1TEST_F(Dg1ProductHelper, givenCompilerProductHelperWhenGetProductConfigThenCorrectMatchIsFound) {
135 EXPECT_EQ(compilerProductHelper->getHwIpVersion(*defaultHwInfo), AOT::DG1);
136 }
137
138 DG1TEST_F(Dg1ProductHelper, givenProductHelperWhenGettingEvictIfNecessaryFlagSupportedThenExpectTrue) {
139 EXPECT_TRUE(productHelper->isEvictionIfNecessaryFlagSupported());
140 }
141
142 DG1TEST_F(Dg1ProductHelper, givenProductHelperWhenGetCommandsStreamPropertiesSupportThenExpectCorrectValues) {
143 EXPECT_FALSE(productHelper->getScmPropertyThreadArbitrationPolicySupport());
144 EXPECT_TRUE(productHelper->getScmPropertyCoherencyRequiredSupport());
145 EXPECT_FALSE(productHelper->getScmPropertyZPassAsyncComputeThreadLimitSupport());
146 EXPECT_FALSE(productHelper->getScmPropertyPixelAsyncComputeThreadLimitSupport());
147 EXPECT_FALSE(productHelper->getScmPropertyLargeGrfModeSupport());
148 EXPECT_FALSE(productHelper->getScmPropertyDevicePreemptionModeSupport());
149
150 EXPECT_FALSE(productHelper->getStateBaseAddressPropertyBindingTablePoolBaseAddressSupport());
151
152 EXPECT_TRUE(productHelper->getFrontEndPropertyScratchSizeSupport());
153 EXPECT_FALSE(productHelper->getFrontEndPropertyPrivateScratchSizeSupport());
154
155 EXPECT_TRUE(productHelper->getPreemptionDbgPropertyPreemptionModeSupport());
156 EXPECT_TRUE(productHelper->getPreemptionDbgPropertyStateSipSupport());
157 EXPECT_TRUE(productHelper->getPreemptionDbgPropertyCsrSurfaceSupport());
158
159 EXPECT_FALSE(productHelper->getFrontEndPropertyComputeDispatchAllWalkerSupport());
160 EXPECT_TRUE(productHelper->getFrontEndPropertyDisableEuFusionSupport());
161 EXPECT_FALSE(productHelper->getFrontEndPropertyDisableOverDispatchSupport());
162 EXPECT_FALSE(productHelper->getFrontEndPropertySingleSliceDispatchCcsModeSupport());
163
164 EXPECT_TRUE(productHelper->getPipelineSelectPropertyMediaSamplerDopClockGateSupport());
165 EXPECT_FALSE(productHelper->getPipelineSelectPropertySystolicModeSupport());
166 }