2017-12-21 00:45:38 +01:00
|
|
|
/*
|
2022-03-07 17:00:26 +00:00
|
|
|
* Copyright (C) 2018-2022 Intel Corporation
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
2018-09-18 09:11:08 +02:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2022-03-25 21:04:08 +00:00
|
|
|
#include "shared/source/command_container/command_encoder.h"
|
2021-05-18 02:46:21 +00:00
|
|
|
#include "shared/source/command_stream/stream_properties.h"
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/command_stream/thread_arbitration_policy.h"
|
2020-03-03 11:59:49 +01:00
|
|
|
#include "shared/source/gen8/reg_configs.h"
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/helpers/preamble.h"
|
2022-08-11 15:58:56 +00:00
|
|
|
#include "shared/test/common/fixtures/preamble_fixture.h"
|
2020-02-24 10:22:30 +01:00
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
using namespace NEO;
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
typedef PreambleFixture BdwSlm;
|
|
|
|
|
|
2020-10-21 09:49:11 +02:00
|
|
|
BDWTEST_F(BdwSlm, WhenL3ConfigIsDispatchedThenProperRegisterAddressAndValueAreProgrammed) {
|
2022-07-25 15:30:11 +00:00
|
|
|
typedef Gen8Family::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM;
|
2017-12-21 00:45:38 +01:00
|
|
|
LinearStream &cs = linearStream;
|
2022-07-25 15:30:11 +00:00
|
|
|
uint32_t l3Config = PreambleHelper<Gen8Family>::getL3Config(*defaultHwInfo, true);
|
|
|
|
|
PreambleHelper<Gen8Family>::programL3(&cs, l3Config);
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2022-07-25 15:30:11 +00:00
|
|
|
parseCommands<Gen8Family>(cs);
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
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);
|
2022-07-25 15:30:11 +00:00
|
|
|
auto registerOffset = L3CNTLRegisterOffset<Gen8Family>::registerOffset;
|
2022-05-16 15:15:59 +00:00
|
|
|
EXPECT_EQ(registerOffset, lri.getRegisterOffset());
|
2017-12-21 00:45:38 +01:00
|
|
|
EXPECT_EQ(1u, lri.getDataDword() & 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
typedef PreambleFixture Gen8L3Config;
|
|
|
|
|
|
2020-10-21 09:49:11 +02:00
|
|
|
BDWTEST_F(Gen8L3Config, GivenNoSlmWhenProgrammingL3ThenProgrammingIsCorrect) {
|
2017-12-21 00:45:38 +01:00
|
|
|
bool slmUsed = false;
|
|
|
|
|
uint32_t l3Config = 0;
|
|
|
|
|
|
|
|
|
|
l3Config = getL3ConfigHelper<IGFX_BROADWELL>(slmUsed);
|
2019-02-18 13:43:10 +01:00
|
|
|
EXPECT_EQ(0x80000340u, l3Config);
|
|
|
|
|
|
|
|
|
|
uint32_t errorDetectionBehaviorControlBit = 1 << 9;
|
|
|
|
|
EXPECT_TRUE((l3Config & errorDetectionBehaviorControlBit) != 0);
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|
|
|
|
|
|
2020-10-21 09:49:11 +02:00
|
|
|
BDWTEST_F(Gen8L3Config, GivenlmWhenProgrammingL3ThenProgrammingIsCorrect) {
|
2017-12-21 00:45:38 +01:00
|
|
|
bool slmUsed = true;
|
|
|
|
|
uint32_t l3Config = 0;
|
|
|
|
|
|
|
|
|
|
l3Config = getL3ConfigHelper<IGFX_BROADWELL>(slmUsed);
|
2019-02-18 13:43:10 +01:00
|
|
|
EXPECT_EQ(0x60000321u, l3Config);
|
|
|
|
|
|
|
|
|
|
uint32_t errorDetectionBehaviorControlBit = 1 << 9;
|
|
|
|
|
EXPECT_TRUE((l3Config & errorDetectionBehaviorControlBit) != 0);
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|
|
|
|
|
|
2020-10-21 09:49:11 +02:00
|
|
|
BDWTEST_F(Gen8L3Config, WhenPreambleIsCreatedThenL3ProgrammingIsCorrect) {
|
2019-08-05 14:57:15 -07:00
|
|
|
bool l3ConfigDifference;
|
|
|
|
|
bool isL3Programmable;
|
|
|
|
|
|
|
|
|
|
l3ConfigDifference =
|
2022-07-25 15:30:11 +00:00
|
|
|
PreambleHelper<Gen8Family>::getL3Config(*defaultHwInfo, true) !=
|
|
|
|
|
PreambleHelper<Gen8Family>::getL3Config(*defaultHwInfo, false);
|
2019-08-05 14:57:15 -07:00
|
|
|
isL3Programmable =
|
2022-07-25 15:30:11 +00:00
|
|
|
PreambleHelper<Gen8Family>::isL3Configurable(*defaultHwInfo);
|
2019-08-05 14:57:15 -07:00
|
|
|
|
|
|
|
|
EXPECT_EQ(l3ConfigDifference, isL3Programmable);
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-21 00:45:38 +01:00
|
|
|
typedef PreambleFixture ThreadArbitrationGen8;
|
2018-02-20 08:11:24 +01:00
|
|
|
BDWTEST_F(ThreadArbitrationGen8, givenPolicyWhenThreadArbitrationProgrammedThenDoNothing) {
|
2022-07-25 15:30:11 +00:00
|
|
|
typedef Gen8Family::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM;
|
2017-12-21 00:45:38 +01:00
|
|
|
LinearStream &cs = linearStream;
|
|
|
|
|
|
2022-03-08 14:18:31 +00:00
|
|
|
StreamProperties streamProperties{};
|
|
|
|
|
streamProperties.stateComputeMode.threadArbitrationPolicy.set(ThreadArbitrationPolicy::RoundRobin);
|
2022-06-23 15:25:10 +00:00
|
|
|
EncodeComputeMode<FamilyType>::programComputeModeCommand(linearStream, streamProperties.stateComputeMode, *defaultHwInfo, nullptr);
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2018-02-20 08:11:24 +01:00
|
|
|
EXPECT_EQ(0u, cs.getUsed());
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2019-05-06 12:33:44 +02:00
|
|
|
MockDevice device;
|
2022-07-25 15:30:11 +00:00
|
|
|
EXPECT_EQ(0u, PreambleHelper<Gen8Family>::getAdditionalCommandsSize(device));
|
|
|
|
|
EXPECT_EQ(ThreadArbitrationPolicy::AgeBased, HwHelperHw<Gen8Family>::get().getDefaultThreadArbitrationPolicy());
|
2021-09-09 08:32:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BDWTEST_F(ThreadArbitrationGen8, whenGetSupportThreadArbitrationPoliciesIsCalledThenEmptyVectorIsReturned) {
|
2022-07-25 15:30:11 +00:00
|
|
|
auto supportedPolicies = PreambleHelper<Gen8Family>::getSupportedThreadArbitrationPolicies();
|
2021-09-09 08:32:45 +00:00
|
|
|
|
|
|
|
|
EXPECT_EQ(0u, supportedPolicies.size());
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
typedef PreambleFixture Gen8UrbEntryAllocationSize;
|
2020-10-21 09:49:11 +02:00
|
|
|
BDWTEST_F(Gen8UrbEntryAllocationSize, WhenPreambleIsCreatedThenUrbEntryAllocationSizeIsCorrect) {
|
2017-12-21 00:45:38 +01:00
|
|
|
uint32_t actualVal = PreambleHelper<FamilyType>::getUrbEntryAllocationSize();
|
|
|
|
|
EXPECT_EQ(0x782u, actualVal);
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-21 09:49:11 +02:00
|
|
|
BDWTEST_F(PreambleVfeState, WhenProgrammingVfeStateThenProgrammingIsCorrect) {
|
2022-07-25 15:30:11 +00:00
|
|
|
typedef Gen8Family::PIPE_CONTROL PIPE_CONTROL;
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
LinearStream &cs = linearStream;
|
2022-07-25 15:30:11 +00:00
|
|
|
auto pVfeCmd = PreambleHelper<Gen8Family>::getSpaceForVfeState(&linearStream, *defaultHwInfo, EngineGroupType::RenderCompute);
|
2021-04-01 18:26:29 +00:00
|
|
|
StreamProperties emptyProperties{};
|
2022-07-25 15:30:11 +00:00
|
|
|
PreambleHelper<Gen8Family>::programVfeState(pVfeCmd, *defaultHwInfo, 0u, 0, 168u, emptyProperties, nullptr);
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2022-07-25 15:30:11 +00:00
|
|
|
parseCommands<Gen8Family>(cs);
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
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());
|
|
|
|
|
}
|