mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-09 22:43:00 +08:00
Move neo_shared_tests sources from /common to /unit_test
Resolves: NEO-6524 Signed-off-by: Warchulski, Jaroslaw <jaroslaw.warchulski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
e135c0ba82
commit
1388818a0e
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2021 Intel Corporation
|
||||
# Copyright (C) 2021-2022 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
@@ -8,10 +8,18 @@ if(TESTS_GEN8)
|
||||
target_sources(neo_shared_tests PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/coherency_tests_gen8.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/command_encoder_tests_gen8.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_tests_gen8.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/image_surface_state_tests_gen8.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/sampler_tests_gen8.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/simd_helper_tests_gen8.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/state_base_address_tests_gen8.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_device_caps_gen8.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_encode_math_gen8.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_preamble_gen8.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_preemption_gen8.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_sample_gen8.cpp
|
||||
)
|
||||
|
||||
add_subdirectories()
|
||||
endif()
|
||||
|
||||
23
shared/test/unit_test/gen8/command_encoder_tests_gen8.cpp
Normal file
23
shared/test/unit_test/gen8/command_encoder_tests_gen8.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_container/command_encoder.h"
|
||||
#include "shared/source/gen8/hw_cmds.h"
|
||||
#include "shared/source/helpers/blit_commands_helper.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 Gen8CommandEncodeTest = testing::Test;
|
||||
GEN8TEST_F(Gen8CommandEncodeTest, givenGen8PlatformWhenDoBindingTablePrefetchIsCalledThenReturnsTrue) {
|
||||
EXPECT_TRUE(EncodeSurfaceState<FamilyType>::doBindingTablePrefetch());
|
||||
}
|
||||
|
||||
GEN8TEST_F(Gen8CommandEncodeTest, givenBcsCommandsHelperWhenMiArbCheckWaRequiredThenReturnTrue) {
|
||||
EXPECT_FALSE(BlitCommandsHelper<FamilyType>::miArbCheckWaRequired());
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_container/command_encoder.h"
|
||||
#include "shared/source/gen8/hw_cmds.h"
|
||||
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
#include "shared/test/unit_test/image/image_surface_state_fixture.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using ImageSurfaceStateTestsGen8 = ImageSurfaceStateTests;
|
||||
|
||||
GEN8TEST_F(ImageSurfaceStateTestsGen8, givenGmmWithMediaCompressedWhenSetFlagsForMediaCompressionThenAuxiliarySurfaceNoneIsSet) {
|
||||
auto size = sizeof(typename FamilyType::RENDER_SURFACE_STATE);
|
||||
auto surfaceState = std::make_unique<char[]>(size);
|
||||
auto castSurfaceState = reinterpret_cast<typename FamilyType::RENDER_SURFACE_STATE *>(surfaceState.get());
|
||||
castSurfaceState->setAuxiliarySurfaceMode(FamilyType::RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_CCS_E);
|
||||
|
||||
mockGmm->gmmResourceInfo->getResourceFlags()->Info.MediaCompressed = false;
|
||||
EncodeSurfaceState<FamilyType>::setFlagsForMediaCompression(castSurfaceState, mockGmm.get());
|
||||
EXPECT_EQ(castSurfaceState->getAuxiliarySurfaceMode(), FamilyType::RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_CCS_E);
|
||||
mockGmm->gmmResourceInfo->getResourceFlags()->Info.MediaCompressed = true;
|
||||
EncodeSurfaceState<FamilyType>::setFlagsForMediaCompression(castSurfaceState, mockGmm.get());
|
||||
EXPECT_EQ(castSurfaceState->getAuxiliarySurfaceMode(), FamilyType::RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_NONE);
|
||||
}
|
||||
|
||||
GEN8TEST_F(ImageSurfaceStateTestsGen8, givenGmmWithMediaCompressedWhenSetMipTailStartLodThenMipTailStartLodIsSet) {
|
||||
auto size = sizeof(typename FamilyType::RENDER_SURFACE_STATE);
|
||||
auto surfaceState = std::make_unique<char[]>(size);
|
||||
auto castSurfaceState = reinterpret_cast<typename FamilyType::RENDER_SURFACE_STATE *>(surfaceState.get());
|
||||
|
||||
setMipTailStartLod<FamilyType>(castSurfaceState, nullptr);
|
||||
}
|
||||
16
shared/test/unit_test/gen8/simd_helper_tests_gen8.cpp
Normal file
16
shared/test/unit_test/gen8/simd_helper_tests_gen8.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/helpers/simd_helper_tests.inl"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using TestSimdConfigSet = ::testing::Test;
|
||||
|
||||
GEN8TEST_F(TestSimdConfigSet, GivenSimdSizeWhenGetSimdConfigCalledThenCorrectEnumReturnedGen8) {
|
||||
GivenSimdSizeWhenGetSimdConfigCalledThenCorrectEnumReturned<typename FamilyType::GPGPU_WALKER>::TestBodyImpl();
|
||||
}
|
||||
35
shared/test/unit_test/gen8/state_base_address_tests_gen8.cpp
Normal file
35
shared/test/unit_test/gen8/state_base_address_tests_gen8.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/gen8/hw_cmds.h"
|
||||
#include "shared/test/common/helpers/state_base_address_tests.h"
|
||||
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
BDWTEST_F(SBATest, givenUsedBindlessBuffersWhenAppendStateBaseAddressParametersIsCalledThenSBACmdHasNotBindingSurfaceStateProgrammed) {
|
||||
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
|
||||
|
||||
DebugManager.flags.UseBindlessMode.set(1);
|
||||
|
||||
STATE_BASE_ADDRESS stateBaseAddress = {};
|
||||
STATE_BASE_ADDRESS stateBaseAddressReference = {};
|
||||
|
||||
StateBaseAddressHelper<FamilyType>::appendStateBaseAddressParameters(
|
||||
&stateBaseAddress,
|
||||
&ssh,
|
||||
false,
|
||||
0,
|
||||
nullptr,
|
||||
false,
|
||||
MemoryCompressionState::NotApplicable,
|
||||
true,
|
||||
false,
|
||||
1u);
|
||||
|
||||
EXPECT_EQ(0u, ssh.getUsed());
|
||||
EXPECT_EQ(0, memcmp(&stateBaseAddressReference, &stateBaseAddress, sizeof(STATE_BASE_ADDRESS)));
|
||||
}
|
||||
67
shared/test/unit_test/gen8/test_encode_math_gen8.cpp
Normal file
67
shared/test/unit_test/gen8/test_encode_math_gen8.cpp
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_container/command_encoder.h"
|
||||
#include "shared/source/gen8/hw_cmds.h"
|
||||
#include "shared/source/helpers/register_offsets.h"
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/common/fixtures/device_fixture.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 CommandEncoderMathTestGen8 = Test<DeviceFixture>;
|
||||
|
||||
GEN8TEST_F(CommandEncoderMathTestGen8, WhenAppendsAGreaterThanThenPredicateCorrectlySet) {
|
||||
using MI_LOAD_REGISTER_MEM = typename FamilyType::MI_LOAD_REGISTER_MEM;
|
||||
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;
|
||||
using MI_LOAD_REGISTER_REG = typename FamilyType::MI_LOAD_REGISTER_REG;
|
||||
using MI_MATH = typename FamilyType::MI_MATH;
|
||||
using MI_MATH_ALU_INST_INLINE = typename FamilyType::MI_MATH_ALU_INST_INLINE;
|
||||
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true);
|
||||
|
||||
EncodeMathMMIO<FamilyType>::encodeGreaterThanPredicate(cmdContainer, 0xDEADBEEFCAF0u, 17u);
|
||||
|
||||
GenCmdList commands;
|
||||
CmdParse<FamilyType>::parseCommandBuffer(commands, ptrOffset(cmdContainer.getCommandStream()->getCpuBase(), 0), cmdContainer.getCommandStream()->getUsed());
|
||||
|
||||
auto itor = commands.begin();
|
||||
|
||||
itor = find<MI_LOAD_REGISTER_MEM *>(itor, commands.end());
|
||||
ASSERT_NE(itor, commands.end());
|
||||
|
||||
auto cmdMEM = genCmdCast<MI_LOAD_REGISTER_MEM *>(*itor);
|
||||
EXPECT_EQ(cmdMEM->getRegisterAddress(), CS_GPR_R0);
|
||||
EXPECT_EQ(cmdMEM->getMemoryAddress(), 0xDEADBEEFCAF0u);
|
||||
|
||||
itor = find<MI_LOAD_REGISTER_IMM *>(itor, commands.end());
|
||||
ASSERT_NE(itor, commands.end());
|
||||
|
||||
auto cmdIMM = genCmdCast<MI_LOAD_REGISTER_IMM *>(*itor);
|
||||
EXPECT_EQ(cmdIMM->getRegisterOffset(), CS_GPR_R1);
|
||||
EXPECT_EQ(cmdIMM->getDataDword(), 17u);
|
||||
|
||||
itor = find<MI_MATH *>(itor, commands.end());
|
||||
ASSERT_NE(itor, commands.end());
|
||||
|
||||
auto cmdMATH = genCmdCast<MI_MATH *>(*itor);
|
||||
EXPECT_EQ(cmdMATH->DW0.BitField.DwordLength, 3u);
|
||||
|
||||
itor = find<MI_LOAD_REGISTER_REG *>(itor, commands.end());
|
||||
ASSERT_NE(itor, commands.end());
|
||||
|
||||
auto cmdREG = genCmdCast<MI_LOAD_REGISTER_REG *>(*itor);
|
||||
EXPECT_EQ(cmdREG->getSourceRegisterAddress(), CS_GPR_R2);
|
||||
EXPECT_EQ(cmdREG->getDestinationRegisterAddress(), CS_PREDICATE_RESULT);
|
||||
|
||||
auto cmdALU = reinterpret_cast<MI_MATH_ALU_INST_INLINE *>(cmdMATH + 3);
|
||||
EXPECT_EQ(cmdALU->DW0.BitField.ALUOpcode,
|
||||
static_cast<uint32_t>(AluRegisters::OPCODE_SUB));
|
||||
}
|
||||
117
shared/test/unit_test/gen8/test_preamble_gen8.cpp
Normal file
117
shared/test/unit_test/gen8/test_preamble_gen8.cpp
Normal file
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_container/command_encoder.h"
|
||||
#include "shared/source/command_stream/stream_properties.h"
|
||||
#include "shared/source/command_stream/thread_arbitration_policy.h"
|
||||
#include "shared/source/gen8/reg_configs.h"
|
||||
#include "shared/source/helpers/preamble.h"
|
||||
#include "shared/test/unit_test/preamble/preamble_fixture.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
typedef PreambleFixture BdwSlm;
|
||||
|
||||
BDWTEST_F(BdwSlm, WhenL3ConfigIsDispatchedThenProperRegisterAddressAndValueAreProgrammed) {
|
||||
typedef BDWFamily::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM;
|
||||
LinearStream &cs = linearStream;
|
||||
uint32_t l3Config = PreambleHelper<BDWFamily>::getL3Config(*defaultHwInfo, true);
|
||||
PreambleHelper<BDWFamily>::programL3(&cs, l3Config);
|
||||
|
||||
parseCommands<BDWFamily>(cs);
|
||||
|
||||
auto itorLRI = find<MI_LOAD_REGISTER_IMM *>(cmdList.begin(), cmdList.end());
|
||||
ASSERT_NE(cmdList.end(), itorLRI);
|
||||
|
||||
const auto &lri = *reinterpret_cast<MI_LOAD_REGISTER_IMM *>(*itorLRI);
|
||||
auto registerOffset = L3CNTLRegisterOffset<BDWFamily>::registerOffset;
|
||||
EXPECT_EQ(registerOffset, lri.getRegisterOffset());
|
||||
EXPECT_EQ(1u, lri.getDataDword() & 1);
|
||||
}
|
||||
|
||||
typedef PreambleFixture Gen8L3Config;
|
||||
|
||||
BDWTEST_F(Gen8L3Config, GivenNoSlmWhenProgrammingL3ThenProgrammingIsCorrect) {
|
||||
bool slmUsed = false;
|
||||
uint32_t l3Config = 0;
|
||||
|
||||
l3Config = getL3ConfigHelper<IGFX_BROADWELL>(slmUsed);
|
||||
EXPECT_EQ(0x80000340u, l3Config);
|
||||
|
||||
uint32_t errorDetectionBehaviorControlBit = 1 << 9;
|
||||
EXPECT_TRUE((l3Config & errorDetectionBehaviorControlBit) != 0);
|
||||
}
|
||||
|
||||
BDWTEST_F(Gen8L3Config, GivenlmWhenProgrammingL3ThenProgrammingIsCorrect) {
|
||||
bool slmUsed = true;
|
||||
uint32_t l3Config = 0;
|
||||
|
||||
l3Config = getL3ConfigHelper<IGFX_BROADWELL>(slmUsed);
|
||||
EXPECT_EQ(0x60000321u, l3Config);
|
||||
|
||||
uint32_t errorDetectionBehaviorControlBit = 1 << 9;
|
||||
EXPECT_TRUE((l3Config & errorDetectionBehaviorControlBit) != 0);
|
||||
}
|
||||
|
||||
BDWTEST_F(Gen8L3Config, WhenPreambleIsCreatedThenL3ProgrammingIsCorrect) {
|
||||
bool l3ConfigDifference;
|
||||
bool isL3Programmable;
|
||||
|
||||
l3ConfigDifference =
|
||||
PreambleHelper<BDWFamily>::getL3Config(*defaultHwInfo, true) !=
|
||||
PreambleHelper<BDWFamily>::getL3Config(*defaultHwInfo, false);
|
||||
isL3Programmable =
|
||||
PreambleHelper<BDWFamily>::isL3Configurable(*defaultHwInfo);
|
||||
|
||||
EXPECT_EQ(l3ConfigDifference, isL3Programmable);
|
||||
}
|
||||
|
||||
typedef PreambleFixture ThreadArbitrationGen8;
|
||||
BDWTEST_F(ThreadArbitrationGen8, givenPolicyWhenThreadArbitrationProgrammedThenDoNothing) {
|
||||
typedef BDWFamily::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM;
|
||||
LinearStream &cs = linearStream;
|
||||
|
||||
StreamProperties streamProperties{};
|
||||
streamProperties.stateComputeMode.threadArbitrationPolicy.set(ThreadArbitrationPolicy::RoundRobin);
|
||||
EncodeComputeMode<FamilyType>::programComputeModeCommand(linearStream, streamProperties.stateComputeMode, *defaultHwInfo, nullptr);
|
||||
|
||||
EXPECT_EQ(0u, cs.getUsed());
|
||||
|
||||
MockDevice device;
|
||||
EXPECT_EQ(0u, PreambleHelper<BDWFamily>::getAdditionalCommandsSize(device));
|
||||
EXPECT_EQ(ThreadArbitrationPolicy::AgeBased, HwHelperHw<BDWFamily>::get().getDefaultThreadArbitrationPolicy());
|
||||
}
|
||||
|
||||
BDWTEST_F(ThreadArbitrationGen8, whenGetSupportThreadArbitrationPoliciesIsCalledThenEmptyVectorIsReturned) {
|
||||
auto supportedPolicies = PreambleHelper<BDWFamily>::getSupportedThreadArbitrationPolicies();
|
||||
|
||||
EXPECT_EQ(0u, supportedPolicies.size());
|
||||
}
|
||||
|
||||
typedef PreambleFixture Gen8UrbEntryAllocationSize;
|
||||
BDWTEST_F(Gen8UrbEntryAllocationSize, WhenPreambleIsCreatedThenUrbEntryAllocationSizeIsCorrect) {
|
||||
uint32_t actualVal = PreambleHelper<FamilyType>::getUrbEntryAllocationSize();
|
||||
EXPECT_EQ(0x782u, actualVal);
|
||||
}
|
||||
|
||||
BDWTEST_F(PreambleVfeState, WhenProgrammingVfeStateThenProgrammingIsCorrect) {
|
||||
typedef BDWFamily::PIPE_CONTROL PIPE_CONTROL;
|
||||
|
||||
LinearStream &cs = linearStream;
|
||||
auto pVfeCmd = PreambleHelper<BDWFamily>::getSpaceForVfeState(&linearStream, *defaultHwInfo, EngineGroupType::RenderCompute);
|
||||
StreamProperties emptyProperties{};
|
||||
PreambleHelper<BDWFamily>::programVfeState(pVfeCmd, *defaultHwInfo, 0u, 0, 168u, emptyProperties, nullptr);
|
||||
|
||||
parseCommands<BDWFamily>(cs);
|
||||
|
||||
auto itorPC = find<PIPE_CONTROL *>(cmdList.begin(), cmdList.end());
|
||||
ASSERT_NE(cmdList.end(), itorPC);
|
||||
|
||||
const auto &pc = *reinterpret_cast<PIPE_CONTROL *>(*itorPC);
|
||||
EXPECT_TRUE(pc.getDcFlushEnable());
|
||||
EXPECT_EQ(1u, pc.getCommandStreamerStallEnable());
|
||||
}
|
||||
222
shared/test/unit_test/gen8/test_preemption_gen8.cpp
Normal file
222
shared/test/unit_test/gen8/test_preemption_gen8.cpp
Normal file
@@ -0,0 +1,222 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_stream/linear_stream.h"
|
||||
#include "shared/source/command_stream/preemption.h"
|
||||
#include "shared/source/helpers/constants.h"
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/test/common/cmd_parse/hw_parse.h"
|
||||
#include "shared/test/common/fixtures/preemption_fixture.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
template <>
|
||||
PreemptionTestHwDetails getPreemptionTestHwDetails<BDWFamily>() {
|
||||
PreemptionTestHwDetails ret;
|
||||
ret.modeToRegValueMap[PreemptionMode::ThreadGroup] = 0;
|
||||
ret.modeToRegValueMap[PreemptionMode::MidBatch] = (1 << 2);
|
||||
ret.defaultRegValue = ret.modeToRegValueMap[PreemptionMode::MidBatch];
|
||||
ret.regAddress = 0x2248u;
|
||||
return ret;
|
||||
}
|
||||
|
||||
using Gen8PreemptionTests = DevicePreemptionTests;
|
||||
|
||||
GEN8TEST_F(Gen8PreemptionTests, whenProgramStateSipIsCalledThenNoCmdsAreProgrammed) {
|
||||
size_t requiredSize = PreemptionHelper::getRequiredStateSipCmdSize<FamilyType>(*device, false);
|
||||
EXPECT_EQ(0U, requiredSize);
|
||||
|
||||
LinearStream cmdStream{nullptr, 0};
|
||||
PreemptionHelper::programStateSip<FamilyType>(cmdStream, *device, nullptr);
|
||||
EXPECT_EQ(0U, cmdStream.getUsed());
|
||||
}
|
||||
|
||||
GEN8TEST_F(Gen8PreemptionTests, GivenMidBatchWhenGettingPreemptionWaCsSizeThenSizeIsZero) {
|
||||
size_t expectedSize = 0;
|
||||
device->setPreemptionMode(PreemptionMode::MidBatch);
|
||||
size_t size = PreemptionHelper::getPreemptionWaCsSize<FamilyType>(*device);
|
||||
EXPECT_EQ(expectedSize, size);
|
||||
}
|
||||
|
||||
GEN8TEST_F(Gen8PreemptionTests, GivenMidBatchAndNoWaWhenGettingPreemptionWaCsSizeThenSizeIsZero) {
|
||||
size_t expectedSize = 0;
|
||||
device->setPreemptionMode(PreemptionMode::ThreadGroup);
|
||||
device->getRootDeviceEnvironment().getMutableHardwareInfo()->workaroundTable.flags.waModifyVFEStateAfterGPGPUPreemption = false;
|
||||
size_t size = PreemptionHelper::getPreemptionWaCsSize<FamilyType>(*device);
|
||||
EXPECT_EQ(expectedSize, size);
|
||||
}
|
||||
|
||||
GEN8TEST_F(Gen8PreemptionTests, GivenMidBatchAndWaWhenGettingPreemptionWaCsSizeThenSizeIsNonZero) {
|
||||
typedef typename FamilyType::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM;
|
||||
size_t expectedSize = 2 * sizeof(MI_LOAD_REGISTER_IMM);
|
||||
device->setPreemptionMode(PreemptionMode::ThreadGroup);
|
||||
device->getRootDeviceEnvironment().getMutableHardwareInfo()->workaroundTable.flags.waModifyVFEStateAfterGPGPUPreemption = true;
|
||||
size_t size = PreemptionHelper::getPreemptionWaCsSize<FamilyType>(*device);
|
||||
EXPECT_EQ(expectedSize, size);
|
||||
}
|
||||
|
||||
GEN8TEST_F(Gen8PreemptionTests, GivenMidThreadAndNoWaWhenGettingPreemptionWaCsSizeThenSizeIsZero) {
|
||||
size_t expectedSize = 0;
|
||||
device->setPreemptionMode(PreemptionMode::MidThread);
|
||||
device->getRootDeviceEnvironment().getMutableHardwareInfo()->workaroundTable.flags.waModifyVFEStateAfterGPGPUPreemption = false;
|
||||
size_t size = PreemptionHelper::getPreemptionWaCsSize<FamilyType>(*device);
|
||||
EXPECT_EQ(expectedSize, size);
|
||||
}
|
||||
|
||||
GEN8TEST_F(Gen8PreemptionTests, GivenMidThreadAndWaWhenGettingPreemptionWaCsSizeThenSizeNonIsZero) {
|
||||
typedef typename FamilyType::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM;
|
||||
size_t expectedSize = 2 * sizeof(MI_LOAD_REGISTER_IMM);
|
||||
device->setPreemptionMode(PreemptionMode::MidThread);
|
||||
device->getRootDeviceEnvironment().getMutableHardwareInfo()->workaroundTable.flags.waModifyVFEStateAfterGPGPUPreemption = true;
|
||||
size_t size = PreemptionHelper::getPreemptionWaCsSize<FamilyType>(*device);
|
||||
EXPECT_EQ(expectedSize, size);
|
||||
}
|
||||
|
||||
GEN8TEST_F(Gen8PreemptionTests, givenInterfaceDescriptorDataWhenAnyPreemptionModeThenNoChange) {
|
||||
using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA;
|
||||
|
||||
INTERFACE_DESCRIPTOR_DATA idd;
|
||||
INTERFACE_DESCRIPTOR_DATA iddArg;
|
||||
int ret;
|
||||
|
||||
idd = FamilyType::cmdInitInterfaceDescriptorData;
|
||||
iddArg = FamilyType::cmdInitInterfaceDescriptorData;
|
||||
|
||||
PreemptionHelper::programInterfaceDescriptorDataPreemption<FamilyType>(&iddArg, PreemptionMode::Disabled);
|
||||
ret = memcmp(&idd, &iddArg, sizeof(INTERFACE_DESCRIPTOR_DATA));
|
||||
EXPECT_EQ(0, ret);
|
||||
|
||||
PreemptionHelper::programInterfaceDescriptorDataPreemption<FamilyType>(&iddArg, PreemptionMode::MidBatch);
|
||||
ret = memcmp(&idd, &iddArg, sizeof(INTERFACE_DESCRIPTOR_DATA));
|
||||
EXPECT_EQ(0, ret);
|
||||
|
||||
PreemptionHelper::programInterfaceDescriptorDataPreemption<FamilyType>(&iddArg, PreemptionMode::ThreadGroup);
|
||||
ret = memcmp(&idd, &iddArg, sizeof(INTERFACE_DESCRIPTOR_DATA));
|
||||
EXPECT_EQ(0, ret);
|
||||
|
||||
PreemptionHelper::programInterfaceDescriptorDataPreemption<FamilyType>(&iddArg, PreemptionMode::MidThread);
|
||||
ret = memcmp(&idd, &iddArg, sizeof(INTERFACE_DESCRIPTOR_DATA));
|
||||
EXPECT_EQ(0, ret);
|
||||
}
|
||||
|
||||
struct Gen8PreemptionTestsLinearStream : public Gen8PreemptionTests {
|
||||
void SetUp() override {
|
||||
Gen8PreemptionTests::SetUp();
|
||||
cmdBufferAllocation = alignedMalloc(MemoryConstants::pageSize, MemoryConstants::pageSize);
|
||||
cmdBuffer.replaceBuffer(cmdBufferAllocation, MemoryConstants::pageSize);
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
alignedFree(cmdBufferAllocation);
|
||||
Gen8PreemptionTests::TearDown();
|
||||
}
|
||||
|
||||
LinearStream cmdBuffer;
|
||||
void *cmdBufferAllocation;
|
||||
HardwareParse cmdBufferParser;
|
||||
};
|
||||
|
||||
GEN8TEST_F(Gen8PreemptionTestsLinearStream, givenMidBatchPreemptionWhenProgrammingWaCmdsBeginThenExpectNoCmds) {
|
||||
device->setPreemptionMode(PreemptionMode::MidBatch);
|
||||
PreemptionHelper::applyPreemptionWaCmdsBegin<FamilyType>(&cmdBuffer, *device);
|
||||
EXPECT_EQ(0u, cmdBuffer.getUsed());
|
||||
}
|
||||
|
||||
GEN8TEST_F(Gen8PreemptionTestsLinearStream, givenMidBatchPreemptionWhenProgrammingWaCmdsEndThenExpectNoCmds) {
|
||||
device->setPreemptionMode(PreemptionMode::MidBatch);
|
||||
PreemptionHelper::applyPreemptionWaCmdsEnd<FamilyType>(&cmdBuffer, *device);
|
||||
EXPECT_EQ(0u, cmdBuffer.getUsed());
|
||||
}
|
||||
|
||||
GEN8TEST_F(Gen8PreemptionTestsLinearStream, givenThreadGroupPreemptionNoWaSetWhenProgrammingWaCmdsBeginThenExpectNoCmd) {
|
||||
device->setPreemptionMode(PreemptionMode::ThreadGroup);
|
||||
device->getRootDeviceEnvironment().getMutableHardwareInfo()->workaroundTable.flags.waModifyVFEStateAfterGPGPUPreemption = false;
|
||||
PreemptionHelper::applyPreemptionWaCmdsBegin<FamilyType>(&cmdBuffer, *device);
|
||||
EXPECT_EQ(0u, cmdBuffer.getUsed());
|
||||
}
|
||||
|
||||
GEN8TEST_F(Gen8PreemptionTestsLinearStream, givenThreadGroupPreemptionNoWaSetWhenProgrammingWaCmdsEndThenExpectNoCmd) {
|
||||
device->setPreemptionMode(PreemptionMode::ThreadGroup);
|
||||
device->getRootDeviceEnvironment().getMutableHardwareInfo()->workaroundTable.flags.waModifyVFEStateAfterGPGPUPreemption = false;
|
||||
PreemptionHelper::applyPreemptionWaCmdsEnd<FamilyType>(&cmdBuffer, *device);
|
||||
EXPECT_EQ(0u, cmdBuffer.getUsed());
|
||||
}
|
||||
|
||||
GEN8TEST_F(Gen8PreemptionTestsLinearStream, givenThreadGroupPreemptionWaSetWhenProgrammingWaCmdsBeginThenExpectMmioCmd) {
|
||||
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;
|
||||
device->setPreemptionMode(PreemptionMode::ThreadGroup);
|
||||
device->getRootDeviceEnvironment().getMutableHardwareInfo()->workaroundTable.flags.waModifyVFEStateAfterGPGPUPreemption = true;
|
||||
PreemptionHelper::applyPreemptionWaCmdsBegin<FamilyType>(&cmdBuffer, *device);
|
||||
|
||||
cmdBufferParser.parseCommands<FamilyType>(cmdBuffer);
|
||||
cmdBufferParser.findHardwareCommands<FamilyType>();
|
||||
GenCmdList::iterator itMmioCmd = cmdBufferParser.lriList.begin();
|
||||
ASSERT_NE(cmdBufferParser.lriList.end(), itMmioCmd);
|
||||
MI_LOAD_REGISTER_IMM *mmioCmd = genCmdCast<MI_LOAD_REGISTER_IMM *>(*itMmioCmd);
|
||||
EXPECT_EQ(0x2600u, mmioCmd->getRegisterOffset());
|
||||
EXPECT_EQ(0xFFFFFFFFu, mmioCmd->getDataDword());
|
||||
}
|
||||
|
||||
GEN8TEST_F(Gen8PreemptionTestsLinearStream, givenThreadGroupPreemptionWaSetWhenProgrammingWaCmdsEndThenExpectMmioCmd) {
|
||||
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;
|
||||
device->setPreemptionMode(PreemptionMode::ThreadGroup);
|
||||
device->getRootDeviceEnvironment().getMutableHardwareInfo()->workaroundTable.flags.waModifyVFEStateAfterGPGPUPreemption = true;
|
||||
PreemptionHelper::applyPreemptionWaCmdsEnd<FamilyType>(&cmdBuffer, *device);
|
||||
|
||||
cmdBufferParser.parseCommands<FamilyType>(cmdBuffer);
|
||||
cmdBufferParser.findHardwareCommands<FamilyType>();
|
||||
GenCmdList::iterator itMmioCmd = cmdBufferParser.lriList.begin();
|
||||
ASSERT_NE(cmdBufferParser.lriList.end(), itMmioCmd);
|
||||
MI_LOAD_REGISTER_IMM *mmioCmd = genCmdCast<MI_LOAD_REGISTER_IMM *>(*itMmioCmd);
|
||||
EXPECT_EQ(0x2600u, mmioCmd->getRegisterOffset());
|
||||
EXPECT_EQ(0x00000000u, mmioCmd->getDataDword());
|
||||
}
|
||||
|
||||
GEN8TEST_F(Gen8PreemptionTestsLinearStream, givenMidThreadPreemptionNoWaSetWhenProgrammingWaCmdsBeginThenExpectNoCmd) {
|
||||
device->setPreemptionMode(PreemptionMode::MidThread);
|
||||
device->getRootDeviceEnvironment().getMutableHardwareInfo()->workaroundTable.flags.waModifyVFEStateAfterGPGPUPreemption = false;
|
||||
PreemptionHelper::applyPreemptionWaCmdsBegin<FamilyType>(&cmdBuffer, *device);
|
||||
EXPECT_EQ(0u, cmdBuffer.getUsed());
|
||||
}
|
||||
|
||||
GEN8TEST_F(Gen8PreemptionTestsLinearStream, givenMidThreadPreemptionNoWaSetWhenProgrammingWaCmdsEndThenExpectNoCmd) {
|
||||
device->setPreemptionMode(PreemptionMode::MidThread);
|
||||
device->getRootDeviceEnvironment().getMutableHardwareInfo()->workaroundTable.flags.waModifyVFEStateAfterGPGPUPreemption = false;
|
||||
PreemptionHelper::applyPreemptionWaCmdsEnd<FamilyType>(&cmdBuffer, *device);
|
||||
EXPECT_EQ(0u, cmdBuffer.getUsed());
|
||||
}
|
||||
|
||||
GEN8TEST_F(Gen8PreemptionTestsLinearStream, givenMidThreadPreemptionWaSetWhenProgrammingWaCmdsBeginThenExpectMmioCmd) {
|
||||
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;
|
||||
device->setPreemptionMode(PreemptionMode::MidThread);
|
||||
device->getRootDeviceEnvironment().getMutableHardwareInfo()->workaroundTable.flags.waModifyVFEStateAfterGPGPUPreemption = true;
|
||||
PreemptionHelper::applyPreemptionWaCmdsBegin<FamilyType>(&cmdBuffer, *device);
|
||||
|
||||
cmdBufferParser.parseCommands<FamilyType>(cmdBuffer);
|
||||
cmdBufferParser.findHardwareCommands<FamilyType>();
|
||||
GenCmdList::iterator itMmioCmd = cmdBufferParser.lriList.begin();
|
||||
ASSERT_NE(cmdBufferParser.lriList.end(), itMmioCmd);
|
||||
MI_LOAD_REGISTER_IMM *mmioCmd = genCmdCast<MI_LOAD_REGISTER_IMM *>(*itMmioCmd);
|
||||
EXPECT_EQ(0x2600u, mmioCmd->getRegisterOffset());
|
||||
EXPECT_EQ(0xFFFFFFFFu, mmioCmd->getDataDword());
|
||||
}
|
||||
|
||||
GEN8TEST_F(Gen8PreemptionTestsLinearStream, givenMidThreadPreemptionWaSetWhenProgrammingWaCmdsEndThenExpectMmioCmd) {
|
||||
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;
|
||||
device->setPreemptionMode(PreemptionMode::MidThread);
|
||||
device->getRootDeviceEnvironment().getMutableHardwareInfo()->workaroundTable.flags.waModifyVFEStateAfterGPGPUPreemption = true;
|
||||
PreemptionHelper::applyPreemptionWaCmdsEnd<FamilyType>(&cmdBuffer, *device);
|
||||
|
||||
cmdBufferParser.parseCommands<FamilyType>(cmdBuffer);
|
||||
cmdBufferParser.findHardwareCommands<FamilyType>();
|
||||
GenCmdList::iterator itMmioCmd = cmdBufferParser.lriList.begin();
|
||||
ASSERT_NE(cmdBufferParser.lriList.end(), itMmioCmd);
|
||||
MI_LOAD_REGISTER_IMM *mmioCmd = genCmdCast<MI_LOAD_REGISTER_IMM *>(*itMmioCmd);
|
||||
EXPECT_EQ(0x2600u, mmioCmd->getRegisterOffset());
|
||||
EXPECT_EQ(0x00000000u, mmioCmd->getDataDword());
|
||||
}
|
||||
Reference in New Issue
Block a user