| 1 |
/* |
| 2 |
* Copyright (C) 2019-2024 Intel Corporation |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: MIT |
| 5 |
* |
| 6 |
*/ |
| 7 |
|
| 8 |
#include "shared/source/execution_environment/execution_environment.h" |
| 9 |
#include "shared/source/execution_environment/root_device_environment.h" |
| 10 |
#include "shared/source/gen11/hw_cmds_lkf.h" |
| 11 |
#include "shared/source/helpers/compiler_product_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 "platforms.h" |
| 19 |
|
| 20 |
using namespace NEO; |
| 21 |
|
| 22 |
using LkfProductHelper = ProductHelperTest; |
| 23 |
|
| 24 |
LKFTEST_F(LkfProductHelper, givenInvalidSystemInfoWhenSettingHardwareInfoThenExpectThrow) { |
| 25 |
|
| 26 |
GT_SYSTEM_INFO >SystemInfo = pInHwInfo.gtSystemInfo; |
| 27 |
|
| 28 |
uint64_t config = 0xdeadbeef; |
| 29 |
gtSystemInfo = {0}; |
| 30 |
EXPECT_ANY_THROW(hardwareInfoSetup[productFamily](&pInHwInfo, false, config, nullptr)); |
| 31 |
EXPECT_EQ(0u, gtSystemInfo.SliceCount); |
| 32 |
EXPECT_EQ(0u, gtSystemInfo.SubSliceCount); |
| 33 |
EXPECT_EQ(0u, gtSystemInfo.DualSubSliceCount); |
| 34 |
EXPECT_EQ(0u, gtSystemInfo.EUCount); |
| 35 |
} |
| 36 |
|
| 37 |
LKFTEST_F(LkfProductHelper, givenProductHelperStringThenAfterSetupResultingVmeIsDisabled) { |
| 38 |
|
| 39 |
uint64_t config = 0x100080008; |
| 40 |
hardwareInfoSetup[productFamily](&pInHwInfo, false, config, nullptr); |
| 41 |
EXPECT_FALSE(pInHwInfo.capabilityTable.ftrSupportsVmeAvcTextureSampler); |
| 42 |
EXPECT_FALSE(pInHwInfo.capabilityTable.ftrSupportsVmeAvcPreemption); |
| 43 |
EXPECT_FALSE(pInHwInfo.capabilityTable.supportsVme); |
| 44 |
} |
| 45 |
|
| 46 |
LKFTEST_F(LkfProductHelper, givenBoolWhenCallLkfHardwareInfoSetupThenFeatureTableAndWorkaroundTableAreSetCorrect) { |
| 47 |
bool boolValue[]{ |
| 48 |
true, false}; |
| 49 |
|
| 50 |
GT_SYSTEM_INFO >SystemInfo = pInHwInfo.gtSystemInfo; |
| 51 |
FeatureTable &featureTable = pInHwInfo.featureTable; |
| 52 |
WorkaroundTable &workaroundTable = pInHwInfo.workaroundTable; |
| 53 |
|
| 54 |
uint64_t config = 0x100080008; |
| 55 |
|
| 56 |
for (auto setParamBool : boolValue) { |
| 57 |
|
| 58 |
gtSystemInfo = {0}; |
| 59 |
featureTable = {}; |
| 60 |
workaroundTable = {}; |
| 61 |
hardwareInfoSetup[productFamily](&pInHwInfo, setParamBool, config, nullptr); |
| 62 |
|
| 63 |
EXPECT_EQ(setParamBool, featureTable.flags.ftrL3IACoherency); |
| 64 |
EXPECT_EQ(setParamBool, featureTable.flags.ftrPPGTT); |
| 65 |
EXPECT_EQ(setParamBool, featureTable.flags.ftrSVM); |
| 66 |
EXPECT_EQ(setParamBool, featureTable.flags.ftrIA32eGfxPTEs); |
| 67 |
EXPECT_EQ(setParamBool, featureTable.flags.ftrStandardMipTailFormat); |
| 68 |
EXPECT_EQ(setParamBool, featureTable.flags.ftrDisplayYTiling); |
| 69 |
EXPECT_EQ(setParamBool, featureTable.flags.ftrTranslationTable); |
| 70 |
EXPECT_EQ(setParamBool, featureTable.flags.ftrUserModeTranslationTable); |
| 71 |
EXPECT_EQ(setParamBool, featureTable.flags.ftrTileMappedResource); |
| 72 |
EXPECT_EQ(setParamBool, featureTable.flags.ftrFbc); |
| 73 |
EXPECT_EQ(setParamBool, featureTable.flags.ftrTileY); |
| 74 |
EXPECT_EQ(setParamBool, featureTable.flags.ftrAstcHdr2D); |
| 75 |
EXPECT_EQ(setParamBool, featureTable.flags.ftrAstcLdr2D); |
| 76 |
EXPECT_EQ(setParamBool, featureTable.flags.ftrGpGpuMidBatchPreempt); |
| 77 |
EXPECT_EQ(setParamBool, featureTable.flags.ftrGpGpuMidThreadLevelPreempt); |
| 78 |
EXPECT_EQ(setParamBool, featureTable.flags.ftrGpGpuThreadGroupLevelPreempt); |
| 79 |
|
| 80 |
EXPECT_EQ(setParamBool, workaroundTable.flags.wa4kAlignUVOffsetNV12LinearSurface); |
| 81 |
} |
| 82 |
} |
| 83 |
|
| 84 |
LKFTEST_F(LkfProductHelper, givenCompilerProductHelperWhenGetProductConfigThenCorrectMatchIsFound) { |
| 85 |
EXPECT_EQ(compilerProductHelper->getHwIpVersion(pInHwInfo), AOT::LKF); |
| 86 |
} |
| 87 |
|
| 88 |
LKFTEST_F(LkfProductHelper, givenProductHelperWhenGettingEvictIfNecessaryFlagSupportedThenExpectTrue) { |
| 89 |
|
| 90 |
EXPECT_TRUE(productHelper->isEvictionIfNecessaryFlagSupported()); |
| 91 |
} |
| 92 |
|
| 93 |
LKFTEST_F(LkfProductHelper, givenProductHelperWhenGetCommandsStreamPropertiesSupportThenExpectCorrectValues) { |
| 94 |
|
| 95 |
EXPECT_TRUE(productHelper->getScmPropertyThreadArbitrationPolicySupport()); |
| 96 |
EXPECT_TRUE(productHelper->getScmPropertyCoherencyRequiredSupport()); |
| 97 |
EXPECT_FALSE(productHelper->getScmPropertyZPassAsyncComputeThreadLimitSupport()); |
| 98 |
EXPECT_FALSE(productHelper->getScmPropertyPixelAsyncComputeThreadLimitSupport()); |
| 99 |
EXPECT_FALSE(productHelper->getScmPropertyLargeGrfModeSupport()); |
| 100 |
EXPECT_FALSE(productHelper->getScmPropertyDevicePreemptionModeSupport()); |
| 101 |
|
| 102 |
EXPECT_FALSE(productHelper->getStateBaseAddressPropertyBindingTablePoolBaseAddressSupport()); |
| 103 |
|
| 104 |
EXPECT_TRUE(productHelper->getFrontEndPropertyScratchSizeSupport()); |
| 105 |
EXPECT_FALSE(productHelper->getFrontEndPropertyPrivateScratchSizeSupport()); |
| 106 |
|
| 107 |
EXPECT_TRUE(productHelper->getPreemptionDbgPropertyPreemptionModeSupport()); |
| 108 |
EXPECT_TRUE(productHelper->getPreemptionDbgPropertyStateSipSupport()); |
| 109 |
EXPECT_TRUE(productHelper->getPreemptionDbgPropertyCsrSurfaceSupport()); |
| 110 |
|
| 111 |
EXPECT_FALSE(productHelper->getFrontEndPropertyComputeDispatchAllWalkerSupport()); |
| 112 |
EXPECT_FALSE(productHelper->getFrontEndPropertyDisableEuFusionSupport()); |
| 113 |
EXPECT_FALSE(productHelper->getFrontEndPropertyDisableOverDispatchSupport()); |
| 114 |
EXPECT_FALSE(productHelper->getFrontEndPropertySingleSliceDispatchCcsModeSupport()); |
| 115 |
|
| 116 |
EXPECT_TRUE(productHelper->getPipelineSelectPropertyMediaSamplerDopClockGateSupport()); |
| 117 |
EXPECT_FALSE(productHelper->getPipelineSelectPropertySystolicModeSupport()); |
| 118 |
} |