Files
compute-runtime/shared/test/unit_test/gen11/hw_cmds_gen11_tests.cpp
Artur Harasimiuk e245523730 per gen/per sku TEST_F/TEST_P refactor
In gen/sku specific tests include only required files to reduce
dependency on not related HW scpecific headers and improve build
performance.
This is achieved by reduce in usage of hw_test.h and related collateral,
like shared/source/helpers/definitions/hw_cmds.h which can be replaced
by sku specific hw_cmds_<sku>.h

Signed-off-by: Artur Harasimiuk <artur.harasimiuk@intel.com>
2022-07-06 23:13:46 +02:00

60 lines
3.0 KiB
C++

/*
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/gen11/hw_cmds_base.h"
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
#include "shared/test/common/test_macros/test.h"
using namespace NEO;
using Gen11HwCmdTest = ::testing::Test;
GEN11TEST_F(Gen11HwCmdTest, givenRenderSurfaceStateWhenProgrammingMocsThenMocsIndexIsSetProperly) {
auto renderSurfaceState = FamilyType::cmdInitRenderSurfaceState;
uint32_t mocs = 4u;
uint32_t expectedMocsIndex = (mocs >> 1);
renderSurfaceState.setMemoryObjectControlState(mocs);
EXPECT_EQ(expectedMocsIndex, renderSurfaceState.TheStructure.Common.MemoryObjectControlState_IndexToMocsTables);
}
GEN11TEST_F(Gen11HwCmdTest, givenStateBaseAddressWhenProgrammingMocsThenMocsIndexIsSetProperly) {
auto stateBaseAddress = FamilyType::cmdInitStateBaseAddress;
uint32_t mocs = 4u;
uint32_t expectedMocsIndex = (mocs >> 1);
stateBaseAddress.setGeneralStateMemoryObjectControlState(mocs);
EXPECT_EQ(expectedMocsIndex, stateBaseAddress.TheStructure.Common.GeneralStateMemoryObjectControlState_IndexToMocsTables);
stateBaseAddress.setStatelessDataPortAccessMemoryObjectControlState(mocs);
EXPECT_EQ(expectedMocsIndex, stateBaseAddress.TheStructure.Common.StatelessDataPortAccessMemoryObjectControlState_IndexToMocsTables);
stateBaseAddress.setSurfaceStateMemoryObjectControlState(mocs);
EXPECT_EQ(expectedMocsIndex, stateBaseAddress.TheStructure.Common.SurfaceStateMemoryObjectControlState_IndexToMocsTables);
stateBaseAddress.setDynamicStateMemoryObjectControlState(mocs);
EXPECT_EQ(expectedMocsIndex, stateBaseAddress.TheStructure.Common.DynamicStateMemoryObjectControlState_IndexToMocsTables);
stateBaseAddress.setIndirectObjectMemoryObjectControlState(mocs);
EXPECT_EQ(expectedMocsIndex, stateBaseAddress.TheStructure.Common.IndirectObjectMemoryObjectControlState_IndexToMocsTables);
stateBaseAddress.setInstructionMemoryObjectControlState(mocs);
EXPECT_EQ(expectedMocsIndex, stateBaseAddress.TheStructure.Common.InstructionMemoryObjectControlState_IndexToMocsTables);
stateBaseAddress.setBindlessSurfaceStateMemoryObjectControlState(mocs);
EXPECT_EQ(expectedMocsIndex, stateBaseAddress.TheStructure.Common.BindlessSurfaceStateMemoryObjectControlState_IndexToMocsTables);
stateBaseAddress.setBindlessSamplerStateMemoryObjectControlState(mocs);
EXPECT_EQ(expectedMocsIndex, stateBaseAddress.TheStructure.Common.BindlessSamplerStateMemoryObjectControlState_IndexToMocsTables);
}
GEN11TEST_F(Gen11HwCmdTest, givenMediaSurfaceStateWhenProgrammingMocsThenMocsIndexIsSetProperly) {
auto mediaSurfaceState = FamilyType::cmdInitMediaSurfaceState;
uint32_t mocs = 4u;
uint32_t expectedMocsIndex = (mocs >> 1);
mediaSurfaceState.setSurfaceMemoryObjectControlState(mocs);
EXPECT_EQ(expectedMocsIndex, mediaSurfaceState.TheStructure.Common.SurfaceMemoryObjectControlState_IndexToMocsTables);
}