Refactor Gen12LP helpers

Signed-off-by: Rafal Maziejuk <rafal.maziejuk@intel.com>
Related-To: NEO-4541
This commit is contained in:
Rafal Maziejuk
2021-09-24 14:29:49 +00:00
committed by Compute-Runtime-Automation
parent ed06bcdc65
commit 82f27e882d
33 changed files with 270 additions and 205 deletions

View File

@ -13,6 +13,7 @@
#include "shared/test/common/helpers/dispatch_flags_helper.h"
#include "shared/test/common/mocks/mock_device.h"
#include "opencl/test/unit_test/gen12lp/special_ult_helper_gen12lp.h"
#include "test.h"
using namespace NEO;
@ -62,10 +63,10 @@ struct Gen12LpCoherencyRequirements : public ::testing::Test {
GEN12LPTEST_F(Gen12LpCoherencyRequirements, GivenNoSharedHandlesWhenGettingCmdSizeThenSizeIsCorrect) {
auto cmdsSize = sizeof(STATE_COMPUTE_MODE);
auto &hwHelper = HwHelper::get(device->getHardwareInfo().platform.eRenderCoreFamily);
if (hwHelper.is3DPipelineSelectWARequired(device->getHardwareInfo())) {
const auto &hwInfoConfig = *HwInfoConfig::get(device->getHardwareInfo().platform.eProductFamily);
if (hwInfoConfig.is3DPipelineSelectWARequired()) {
cmdsSize += 2 * sizeof(PIPELINE_SELECT);
if (Gen12LPHelpers::pipeControlWaRequired(device->getHardwareInfo().platform.eProductFamily)) {
if (SpecialUltHelperGen12lp::isPipeControlWArequired(device->getHardwareInfo().platform.eProductFamily)) {
cmdsSize += 2 * sizeof(PIPE_CONTROL);
}
}
@ -89,10 +90,10 @@ GEN12LPTEST_F(Gen12LpCoherencyRequirements, GivenNoSharedHandlesWhenGettingCmdSi
GEN12LPTEST_F(Gen12LpCoherencyRequirements, GivenSharedHandlesWhenGettingCmdSizeThenSizeIsCorrect) {
auto cmdsSize = sizeof(STATE_COMPUTE_MODE) + sizeof(PIPE_CONTROL);
auto &hwHelper = HwHelper::get(device->getHardwareInfo().platform.eRenderCoreFamily);
if (hwHelper.is3DPipelineSelectWARequired(device->getHardwareInfo())) {
const auto &hwInfoConfig = *HwInfoConfig::get(device->getHardwareInfo().platform.eProductFamily);
if (hwInfoConfig.is3DPipelineSelectWARequired()) {
cmdsSize += 2 * sizeof(PIPELINE_SELECT);
if (Gen12LPHelpers::pipeControlWaRequired(device->getHardwareInfo().platform.eProductFamily)) {
if (SpecialUltHelperGen12lp::isPipeControlWArequired(device->getHardwareInfo().platform.eProductFamily)) {
cmdsSize += 2 * sizeof(PIPE_CONTROL);
}
}
@ -117,11 +118,11 @@ GEN12LPTEST_F(Gen12LpCoherencyRequirements, GivenSharedHandlesWhenGettingCmdSize
GEN12LPTEST_F(Gen12LpCoherencyRequirements, GivenNoSharedHandlesThenCoherencyCmdValuesAreCorrect) {
auto cmdsSize = sizeof(STATE_COMPUTE_MODE);
auto cmdsSizeWABeginOffset = 0;
auto &hwHelper = HwHelper::get(device->getHardwareInfo().platform.eRenderCoreFamily);
if (hwHelper.is3DPipelineSelectWARequired(device->getHardwareInfo())) {
const auto &hwInfoConfig = *HwInfoConfig::get(device->getHardwareInfo().platform.eProductFamily);
if (hwInfoConfig.is3DPipelineSelectWARequired()) {
cmdsSizeWABeginOffset += sizeof(PIPELINE_SELECT);
cmdsSize += sizeof(PIPELINE_SELECT);
if (Gen12LPHelpers::pipeControlWaRequired(device->getHardwareInfo().platform.eProductFamily)) {
if (SpecialUltHelperGen12lp::isPipeControlWArequired(device->getHardwareInfo().platform.eProductFamily)) {
cmdsSizeWABeginOffset += sizeof(PIPE_CONTROL);
cmdsSize += sizeof(PIPE_CONTROL);
}
@ -157,11 +158,11 @@ GEN12LPTEST_F(Gen12LpCoherencyRequirements, GivenNoSharedHandlesThenCoherencyCmd
GEN12LPTEST_F(Gen12LpCoherencyRequirements, GivenSharedHandlesThenCoherencyCmdValuesAreCorrect) {
auto cmdsSize = sizeof(STATE_COMPUTE_MODE) + sizeof(PIPE_CONTROL);
auto cmdsSizeWABeginOffset = 0;
auto &hwHelper = HwHelper::get(device->getHardwareInfo().platform.eRenderCoreFamily);
if (hwHelper.is3DPipelineSelectWARequired(device->getHardwareInfo())) {
const auto &hwInfoConfig = *HwInfoConfig::get(device->getHardwareInfo().platform.eProductFamily);
if (hwInfoConfig.is3DPipelineSelectWARequired()) {
cmdsSizeWABeginOffset += sizeof(PIPELINE_SELECT);
cmdsSize += sizeof(PIPELINE_SELECT);
if (Gen12LPHelpers::pipeControlWaRequired(device->getHardwareInfo().platform.eProductFamily)) {
if (SpecialUltHelperGen12lp::isPipeControlWArequired(device->getHardwareInfo().platform.eProductFamily)) {
cmdsSizeWABeginOffset += sizeof(PIPE_CONTROL);
cmdsSize += sizeof(PIPE_CONTROL);
}
@ -230,7 +231,7 @@ GEN12LPTEST_F(Gen12LpCoherencyRequirements, givenCoherencyRequirementWithoutShar
EXPECT_FALSE(foundOne);
foundOne = true;
auto pc = genCmdCast<PIPE_CONTROL *>(*(++it));
if (!expectPipeControl && !Gen12LPHelpers::pipeControlWaRequired(device->getHardwareInfo().platform.eProductFamily)) {
if (!expectPipeControl && !SpecialUltHelperGen12lp::isPipeControlWArequired(device->getHardwareInfo().platform.eProductFamily)) {
EXPECT_EQ(nullptr, pc);
} else {
EXPECT_NE(nullptr, pc);

View File

@ -9,3 +9,7 @@
HWTEST_EXCLUDE_PRODUCT(BufferSetSurfaceTests, givenBufferSetSurfaceThatMemoryIsUnalignedToCachelineButReadOnlyThenL3CacheShouldBeStillOn, IGFX_DG1)
HWTEST_EXCLUDE_PRODUCT(BufferSetSurfaceTests, givenAlignedCacheableReadOnlyBufferThenChoseOclBufferPolicy, IGFX_DG1);
HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, givenHwInfoConfigWhenAskedIfPipeControlWAIsRequiredThenFalseIsReturned, IGFX_DG1);
HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, givenHwInfoConfigWhenAskedIfImagePitchAlignmentWAIsRequiredThenFalseIsReturned, IGFX_DG1);
HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, givenHwInfoConfigWhenAskedIfForceEmuInt32DivRemSPWAIsRequiredThenFalseIsReturned, IGFX_DG1);
HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, givenHwInfoConfigWhenAskedIf3DPipelineSelectWAIsRequiredThenFalseIsReturned, IGFX_DG1);

View File

@ -14,20 +14,6 @@
using HwHelperTestDg1 = HwHelperTest;
DG1TEST_F(HwHelperTestDg1, givenDg1PlatformWhenIsLocalMemoryEnabledIsCalledThenTrueIsReturned) {
hardwareInfo.featureTable.ftrLocalMemory = true;
auto &helper = reinterpret_cast<HwHelperHw<FamilyType> &>(HwHelperHw<FamilyType>::get());
EXPECT_TRUE(helper.isLocalMemoryEnabled(hardwareInfo));
}
DG1TEST_F(HwHelperTestDg1, givenDg1PlatformWithoutLocalMemoryFeatureWhenIsLocalMemoryEnabledIsCalledThenFalseIsReturned) {
hardwareInfo.featureTable.ftrLocalMemory = false;
auto &helper = reinterpret_cast<HwHelperHw<FamilyType> &>(HwHelperHw<FamilyType>::get());
EXPECT_FALSE(helper.isLocalMemoryEnabled(hardwareInfo));
}
DG1TEST_F(HwHelperTestDg1, givenDg1PlatformWhenSetupHardwareCapabilitiesIsCalledThenThenSpecificImplementationIsUsed) {
hardwareInfo.featureTable.ftrLocalMemory = true;
@ -82,21 +68,6 @@ DG1TEST_F(HwHelperTestDg1, givenDg1AndVariousSteppingsWhenGettingIsWorkaroundReq
}
}
DG1TEST_F(HwHelperTestDg1, givenDg1WhenSteppingA0ThenIntegerDivisionEmulationIsEnabled) {
const auto &hwInfoConfig = *HwInfoConfig::get(hardwareInfo.platform.eProductFamily);
uint32_t stepping = REVISION_A0;
hardwareInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(stepping, hardwareInfo);
auto &helper = HwHelper::get(renderCoreFamily);
EXPECT_TRUE(helper.isForceEmuInt32DivRemSPWARequired(hardwareInfo));
}
DG1TEST_F(HwHelperTestDg1, givenDg1WhenSteppingB0ThenIntegerDivisionEmulationIsNotEnabled) {
const auto &hwInfoConfig = *HwInfoConfig::get(hardwareInfo.platform.eProductFamily);
hardwareInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_B, hardwareInfo);
auto &helper = HwHelper::get(renderCoreFamily);
EXPECT_FALSE(helper.isForceEmuInt32DivRemSPWARequired(hardwareInfo));
}
DG1TEST_F(HwHelperTestDg1, givenBufferAllocationTypeWhenSetExtraAllocationDataIsCalledThenIsLockableIsSet) {
auto &hwHelper = HwHelper::get(renderCoreFamily);
AllocationData allocData{};

View File

@ -29,6 +29,29 @@ DG1TEST_F(Dg1HwInfoConfig, givenInvalidSystemInfoWhenSettingHardwareInfoThenExpe
EXPECT_EQ(0u, gtSystemInfo.EUCount);
}
DG1TEST_F(Dg1HwInfoConfig, givenA0SteppingAndDg1PlatformWhenAskingIfWAIsRequiredThenReturnTrue) {
auto hwInfoConfig = HwInfoConfig::get(productFamily);
std::array<std::pair<uint32_t, bool>, 2> revisions = {
{{REVISION_A0, true},
{REVISION_B, false}}};
for (const auto &[revision, paramBool] : revisions) {
auto hwInfo = *defaultHwInfo;
hwInfo.platform.usRevId = hwInfoConfig->getHwRevIdFromStepping(revision, hwInfo);
hwInfoConfig->configureHardwareCustom(&hwInfo, nullptr);
EXPECT_EQ(paramBool, hwInfoConfig->pipeControlWARequired(hwInfo));
EXPECT_EQ(paramBool, hwInfoConfig->imagePitchAlignmentWARequired(hwInfo));
EXPECT_EQ(paramBool, hwInfoConfig->isForceEmuInt32DivRemSPWARequired(hwInfo));
}
}
DG1TEST_F(Dg1HwInfoConfig, givenHwInfoConfigWhenAskedIf3DPipelineSelectWAIsRequiredThenTrueIsReturned) {
const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
EXPECT_TRUE(hwInfoConfig.is3DPipelineSelectWARequired());
}
using Dg1HwInfo = ::testing::Test;
DG1TEST_F(Dg1HwInfo, givenBoolWhenCallDg1HardwareInfoSetupThenFeatureTableAndWorkaroundTableAreSetCorrect) {

View File

@ -425,3 +425,17 @@ GEN12LPTEST_F(HwHelperTestGen12Lp, WhenGettingSupportedDeviceFeatureCapabilities
cl_device_feature_capabilities_intel expectedCapabilities = CL_DEVICE_FEATURE_FLAG_DP4A_INTEL;
EXPECT_EQ(expectedCapabilities, ClHwHelper::get(renderCoreFamily).getSupportedDeviceFeatureCapabilities());
}
GEN12LPTEST_F(HwHelperTestGen12Lp, givenLocalMemoryFeatureDisabledWhenIsLocalMemoryEnabledIsCalledThenTrueIsReturned) {
hardwareInfo.featureTable.ftrLocalMemory = true;
auto &helper = reinterpret_cast<HwHelperHw<FamilyType> &>(HwHelperHw<FamilyType>::get());
EXPECT_TRUE(helper.isLocalMemoryEnabled(hardwareInfo));
}
GEN12LPTEST_F(HwHelperTestGen12Lp, givenLocalMemoryFeatureEnabledWhenIsLocalMemoryEnabledIsCalledThenFalseIsReturned) {
hardwareInfo.featureTable.ftrLocalMemory = false;
auto &helper = reinterpret_cast<HwHelperHw<FamilyType> &>(HwHelperHw<FamilyType>::get());
EXPECT_FALSE(helper.isLocalMemoryEnabled(hardwareInfo));
}

View File

@ -14,6 +14,7 @@ if(TESTS_RKL)
${IGDRCL_SRCS_tests_gen12lp_rkl_excludes}
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/test_hw_helper_rkl.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_hw_info_config_rkl.cpp
)
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_gen12lp_rkl})
add_subdirectories()

View File

@ -10,3 +10,5 @@
HWTEST_EXCLUDE_PRODUCT(DeviceFactoryTest, givenInvalidHwConfigStringWhenPrepareDeviceEnvironmentsForProductFamilyOverrideThenThrowsException, IGFX_ROCKETLAKE);
HWTEST_EXCLUDE_PRODUCT(BufferSetSurfaceTests, givenBufferSetSurfaceThatMemoryIsUnalignedToCachelineButReadOnlyThenL3CacheShouldBeStillOn, IGFX_ROCKETLAKE)
HWTEST_EXCLUDE_PRODUCT(BufferSetSurfaceTests, givenAlignedCacheableReadOnlyBufferThenChoseOclBufferPolicy, IGFX_ROCKETLAKE);
HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, givenHwInfoConfigWhenAskedIfForceEmuInt32DivRemSPWAIsRequiredThenFalseIsReturned, IGFX_ROCKETLAKE);
HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, givenHwInfoConfigWhenAskedIf3DPipelineSelectWAIsRequiredThenFalseIsReturned, IGFX_ROCKETLAKE);

View File

@ -36,23 +36,3 @@ RKLTEST_F(HwHelperTestRkl, givenRklWhenRequestedVmeFlagsThenReturnFalse) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.ftrSupportsVmeAvcTextureSampler);
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.ftrSupportsVmeAvcPreemption);
}
RKLTEST_F(HwHelperTestRkl, givenRklWhenSteppingA0OrB0ThenIntegerDivisionEmulationIsEnabled) {
const auto &hwInfoConfig = *HwInfoConfig::get(hardwareInfo.platform.eProductFamily);
uint32_t steppings[] = {
REVISION_A0,
REVISION_B};
for (auto stepping : steppings) {
hardwareInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(stepping, hardwareInfo);
auto &helper = HwHelper::get(renderCoreFamily);
EXPECT_TRUE(helper.isForceEmuInt32DivRemSPWARequired(hardwareInfo));
}
}
RKLTEST_F(HwHelperTestRkl, givenRklWhenSteppingC0ThenIntegerDivisionEmulationIsNotEnabled) {
const auto &hwInfoConfig = *HwInfoConfig::get(hardwareInfo.platform.eProductFamily);
hardwareInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_C, hardwareInfo);
auto &helper = HwHelper::get(renderCoreFamily);
EXPECT_FALSE(helper.isForceEmuInt32DivRemSPWARequired(hardwareInfo));
}

View File

@ -0,0 +1,39 @@
/*
* Copyright (C) 2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "test.h"
#include <array>
using namespace NEO;
using RklHwInfoConfig = ::testing::Test;
RKLTEST_F(RklHwInfoConfig, givenA0OrBSteppingAndRklPlatformWhenAskingIfWAIsRequiredThenReturnTrue) {
auto hwInfoConfig = HwInfoConfig::get(productFamily);
std::array<std::pair<uint32_t, bool>, 3> revisions = {
{{REVISION_A0, true},
{REVISION_B, true},
{REVISION_C, false}}};
for (const auto &[revision, paramBool] : revisions) {
auto hwInfo = *defaultHwInfo;
hwInfo.platform.usRevId = hwInfoConfig->getHwRevIdFromStepping(revision, hwInfo);
hwInfoConfig->configureHardwareCustom(&hwInfo, nullptr);
EXPECT_EQ(paramBool, hwInfoConfig->isForceEmuInt32DivRemSPWARequired(hwInfo));
}
}
RKLTEST_F(RklHwInfoConfig, givenHwInfoConfigWhenAskedIf3DPipelineSelectWAIsRequiredThenTrueIsReturned) {
const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
EXPECT_TRUE(hwInfoConfig.is3DPipelineSelectWARequired());
}

View File

@ -9,3 +9,7 @@
HWTEST_EXCLUDE_PRODUCT(BufferSetSurfaceTests, givenBufferSetSurfaceThatMemoryIsUnalignedToCachelineButReadOnlyThenL3CacheShouldBeStillOn, IGFX_TIGERLAKE_LP)
HWTEST_EXCLUDE_PRODUCT(BufferSetSurfaceTests, givenAlignedCacheableReadOnlyBufferThenChoseOclBufferPolicy, IGFX_TIGERLAKE_LP);
HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, givenHwInfoConfigWhenAskedIfPipeControlWAIsRequiredThenFalseIsReturned, IGFX_TIGERLAKE_LP);
HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, givenHwInfoConfigWhenAskedIfImagePitchAlignmentWAIsRequiredThenFalseIsReturned, IGFX_TIGERLAKE_LP);
HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, givenHwInfoConfigWhenAskedIfForceEmuInt32DivRemSPWAIsRequiredThenFalseIsReturned, IGFX_TIGERLAKE_LP);
HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, givenHwInfoConfigWhenAskedIf3DPipelineSelectWAIsRequiredThenFalseIsReturned, IGFX_TIGERLAKE_LP);

View File

@ -43,20 +43,6 @@ TGLLPTEST_F(HwHelperTestGen12Lp, givenTgllWhenWaForDefaultEngineIsNotAppliedThen
EXPECT_EQ(aub_stream::ENGINE_RCS, hardwareInfo.capabilityTable.defaultEngineType);
}
TGLLPTEST_F(HwHelperTestGen12Lp, givenTgllpWhenSteppingBellowBThenIntegerDivisionEmulationIsEnabled) {
const auto &hwInfoConfig = *HwInfoConfig::get(hardwareInfo.platform.eProductFamily);
hardwareInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_A0, hardwareInfo);
auto &helper = HwHelper::get(renderCoreFamily);
EXPECT_TRUE(helper.isForceEmuInt32DivRemSPWARequired(hardwareInfo));
}
TGLLPTEST_F(HwHelperTestGen12Lp, givenTgllpWhenSteppingBThenIntegerDivisionEmulationIsEnabled) {
const auto &hwInfoConfig = *HwInfoConfig::get(hardwareInfo.platform.eProductFamily);
hardwareInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_A1, hardwareInfo);
auto &helper = HwHelper::get(renderCoreFamily);
EXPECT_FALSE(helper.isForceEmuInt32DivRemSPWARequired(hardwareInfo));
}
TGLLPTEST_F(HwHelperTestGen12Lp, givenTgllpAndVariousSteppingsWhenGettingIsWorkaroundRequiredThenCorrectValueIsReturned) {
auto &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
const auto &hwInfoConfig = *HwInfoConfig::get(hardwareInfo.platform.eProductFamily);

View File

@ -48,6 +48,30 @@ TGLLPTEST_F(TgllpHwInfoConfig, whenUsingCorrectConfigValueThenCorrectHwInfoIsRet
EXPECT_EQ(2u, gtSystemInfo.DualSubSliceCount);
}
TGLLPTEST_F(TgllpHwInfoConfig, givenA0SteppingAndTgllpPlatformWhenAskingIfWAIsRequiredThenReturnTrue) {
auto hwInfoConfig = HwInfoConfig::get(productFamily);
std::array<std::pair<uint32_t, bool>, 3> revisions = {
{{REVISION_A0, true},
{REVISION_B, false},
{REVISION_C, false}}};
for (const auto &[revision, paramBool] : revisions) {
auto hwInfo = *defaultHwInfo;
hwInfo.platform.usRevId = hwInfoConfig->getHwRevIdFromStepping(revision, hwInfo);
hwInfoConfig->configureHardwareCustom(&hwInfo, nullptr);
EXPECT_EQ(paramBool, hwInfoConfig->pipeControlWARequired(hwInfo));
EXPECT_EQ(paramBool, hwInfoConfig->imagePitchAlignmentWARequired(hwInfo));
EXPECT_EQ(paramBool, hwInfoConfig->isForceEmuInt32DivRemSPWARequired(hwInfo));
}
}
TGLLPTEST_F(TgllpHwInfoConfig, givenHwInfoConfigWhenAskedIf3DPipelineSelectWAIsRequiredThenTrueIsReturned) {
const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
EXPECT_TRUE(hwInfoConfig.is3DPipelineSelectWARequired());
}
using TgllpHwInfo = ::testing::Test;
TGLLPTEST_F(TgllpHwInfo, givenBoolWhenCallTgllpHardwareInfoSetupThenFeatureTableAndWorkaroundTableAreSetCorrect) {