mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 23:03:02 +08:00
Move non-ult shared files to single directory
Add SKIP_SHARED_UNIT_TESTS flag Related-To: NEO-5201 Signed-off-by: Pawel Cieslak <pawel.cieslak@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
1a0b7dc393
commit
8a700c5187
@@ -1,29 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2019-2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
if(TESTS_GEN8)
|
||||
|
||||
set(NEO_CORE_TESTS_GEN8
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/simd_helper_tests_gen8.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_preamble_gen8.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_traits_gen8.h
|
||||
)
|
||||
set_property(GLOBAL PROPERTY NEO_CORE_TESTS_GEN8 ${NEO_CORE_TESTS_GEN8})
|
||||
add_subdirectories()
|
||||
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/command_encoder_tests_gen8.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/image_surface_state_tests_gen8.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/state_base_address_tests_gen8.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_encode_math_gen8.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_preemption_gen8.cpp
|
||||
${COMPUTE_RUNTIME_ULT_GEN8}
|
||||
${NEO_SOURCE_DIR}/opencl/test/unit_test/gen8/unit_test_helper_gen8.cpp
|
||||
)
|
||||
|
||||
endif()
|
||||
@@ -1,71 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/unit_test/cmd_parse/gen_cmd_parse.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
using GenStruct = NEO::GEN8;
|
||||
using GenGfxFamily = NEO::BDWFamily;
|
||||
#include "shared/test/unit_test/cmd_parse/cmd_parse_base.inl"
|
||||
#include "shared/test/unit_test/cmd_parse/cmd_parse_base_mi_arb.inl"
|
||||
#include "shared/test/unit_test/cmd_parse/cmd_parse_gpgpu_walker.inl"
|
||||
#include "shared/test/unit_test/cmd_parse/cmd_parse_sip.inl"
|
||||
#include "shared/test/unit_test/cmd_parse/hw_parse.h"
|
||||
#include "shared/test/unit_test/cmd_parse/hw_parse.inl"
|
||||
|
||||
template <>
|
||||
size_t CmdParse<GenGfxFamily>::getCommandLengthHwSpecific(void *cmd) {
|
||||
{
|
||||
auto pCmd = genCmdCast<GPGPU_WALKER *>(cmd);
|
||||
if (pCmd)
|
||||
return pCmd->TheStructure.Common.DwordLength + 2;
|
||||
}
|
||||
{
|
||||
auto pCmd = genCmdCast<MEDIA_INTERFACE_DESCRIPTOR_LOAD *>(cmd);
|
||||
if (pCmd)
|
||||
return pCmd->TheStructure.Common.DwordLength + 2;
|
||||
}
|
||||
{
|
||||
auto pCmd = genCmdCast<MEDIA_VFE_STATE *>(cmd);
|
||||
if (pCmd)
|
||||
return pCmd->TheStructure.Common.DwordLength + 2;
|
||||
}
|
||||
{
|
||||
auto pCmd = genCmdCast<MEDIA_STATE_FLUSH *>(cmd);
|
||||
if (pCmd)
|
||||
return pCmd->TheStructure.Common.DwordLength + 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <>
|
||||
const char *CmdParse<GenGfxFamily>::getCommandNameHwSpecific(void *cmd) {
|
||||
if (nullptr != genCmdCast<GPGPU_WALKER *>(cmd)) {
|
||||
return "GPGPU_WALKER";
|
||||
}
|
||||
|
||||
if (nullptr != genCmdCast<MEDIA_INTERFACE_DESCRIPTOR_LOAD *>(cmd)) {
|
||||
return "MEDIA_INTERFACE_DESCRIPTOR_LOAD";
|
||||
}
|
||||
|
||||
if (nullptr != genCmdCast<MEDIA_VFE_STATE *>(cmd)) {
|
||||
return "MEDIA_VFE_STATE";
|
||||
}
|
||||
|
||||
if (nullptr != genCmdCast<MEDIA_STATE_FLUSH *>(cmd)) {
|
||||
return "MEDIA_STATE_FLUSH";
|
||||
}
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
||||
template struct CmdParse<GenGfxFamily>;
|
||||
|
||||
namespace NEO {
|
||||
template void HardwareParse::findHardwareCommands<BDWFamily>();
|
||||
template void HardwareParse::findHardwareCommands<BDWFamily>(IndirectHeap *);
|
||||
template const void *HardwareParse::getStatelessArgumentPointer<BDWFamily>(const Kernel &kernel, uint32_t indexArg, IndirectHeap &ioh, uint32_t rootDeviceIndex);
|
||||
} // namespace NEO
|
||||
@@ -1,22 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_container/command_encoder.h"
|
||||
#include "shared/source/helpers/blit_commands_helper.h"
|
||||
|
||||
#include "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());
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#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);
|
||||
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);
|
||||
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);
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/unit_test/helpers/simd_helper_tests.inl"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using TestSimdConfigSet = ::testing::Test;
|
||||
|
||||
GEN8TEST_F(TestSimdConfigSet, GivenSimdSizeWhenGetSimdConfigCalledThenCorrectEnumReturnedGen8) {
|
||||
GivenSimdSizeWhenGetSimdConfigCalledThenCorrectEnumReturned<typename FamilyType::GPGPU_WALKER>::TestBodyImpl();
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/unit_test/helpers/state_base_address_tests.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)));
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_container/command_encoder.h"
|
||||
#include "shared/source/helpers/register_offsets.h"
|
||||
#include "shared/test/unit_test/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/unit_test/fixtures/device_fixture.h"
|
||||
|
||||
#include "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);
|
||||
|
||||
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));
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#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"
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/platform_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;
|
||||
|
||||
PreambleHelper<BDWFamily>::programThreadArbitration(&cs, ThreadArbitrationPolicy::RoundRobin);
|
||||
|
||||
EXPECT_EQ(0u, cs.getUsed());
|
||||
|
||||
MockDevice device;
|
||||
EXPECT_EQ(0u, PreambleHelper<BDWFamily>::getAdditionalCommandsSize(device));
|
||||
EXPECT_EQ(0u, PreambleHelper<BDWFamily>::getThreadArbitrationCommandsSize());
|
||||
EXPECT_EQ(0u, HwHelperHw<BDWFamily>::get().getDefaultThreadArbitrationPolicy());
|
||||
}
|
||||
|
||||
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;
|
||||
PreambleHelper<BDWFamily>::programVFEState(&linearStream, *defaultHwInfo, 0u, 0, 168u, aub_stream::EngineType::ENGINE_RCS,
|
||||
AdditionalKernelExecInfo::NotApplicable, KernelExecutionType::NotApplicable);
|
||||
|
||||
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());
|
||||
}
|
||||
@@ -1,222 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 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/unit_test/cmd_parse/hw_parse.h"
|
||||
#include "shared/test/unit_test/fixtures/preemption_fixture.h"
|
||||
#include "shared/test/unit_test/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);
|
||||
EXPECT_EQ(0U, requiredSize);
|
||||
|
||||
LinearStream cmdStream{nullptr, 0};
|
||||
PreemptionHelper::programStateSip<FamilyType>(cmdStream, *device);
|
||||
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.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.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.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.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.waModifyVFEStateAfterGPGPUPreemption = false;
|
||||
PreemptionHelper::applyPreemptionWaCmdsBegin<FamilyType>(&cmdBuffer, *device);
|
||||
EXPECT_EQ(0u, cmdBuffer.getUsed());
|
||||
}
|
||||
|
||||
GEN8TEST_F(Gen8PreemptionTestsLinearStream, givenThreadGroupPreemptionNoWaSetWhenProgrammingWaCmdsEndThenExpectNoCmd) {
|
||||
device->setPreemptionMode(PreemptionMode::ThreadGroup);
|
||||
device->getRootDeviceEnvironment().getMutableHardwareInfo()->workaroundTable.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.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.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.waModifyVFEStateAfterGPGPUPreemption = false;
|
||||
PreemptionHelper::applyPreemptionWaCmdsBegin<FamilyType>(&cmdBuffer, *device);
|
||||
EXPECT_EQ(0u, cmdBuffer.getUsed());
|
||||
}
|
||||
|
||||
GEN8TEST_F(Gen8PreemptionTestsLinearStream, givenMidThreadPreemptionNoWaSetWhenProgrammingWaCmdsEndThenExpectNoCmd) {
|
||||
device->setPreemptionMode(PreemptionMode::MidThread);
|
||||
device->getRootDeviceEnvironment().getMutableHardwareInfo()->workaroundTable.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.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.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());
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "shared/test/unit_test/helpers/test_traits.h"
|
||||
|
||||
template <>
|
||||
struct TestTraits<IGFX_GEN8_CORE> {
|
||||
static constexpr bool auxBuiltinsSupported = true;
|
||||
};
|
||||
Reference in New Issue
Block a user