Add mock helper for hwInfoConfig

Signed-off-by: Katarzyna Cencelewska <katarzyna.cencelewska@intel.com>
This commit is contained in:
Katarzyna Cencelewska
2022-06-21 11:43:43 +00:00
committed by Compute-Runtime-Automation
parent e75c313ce7
commit b983ea120b
36 changed files with 396 additions and 101 deletions

View File

@@ -0,0 +1,14 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_ELKHARTLAKE;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@@ -0,0 +1,14 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_ICELAKE_LP;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@@ -0,0 +1,14 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_LAKEFIELD;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@@ -0,0 +1,14 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_ALDERLAKE_N;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@@ -0,0 +1,14 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_ALDERLAKE_P;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@@ -0,0 +1,14 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_ALDERLAKE_S;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@@ -0,0 +1,13 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_DG1;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@@ -0,0 +1,13 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_ROCKETLAKE;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@@ -0,0 +1,11 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
using namespace NEO;
constexpr static auto gfxProduct = IGFX_BROADWELL;
#include "shared/source/os_interface/hw_info_config_hw.inl"

View File

@@ -0,0 +1,14 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_TIGERLAKE_LP;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@@ -0,0 +1,14 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_BROADWELL;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@@ -0,0 +1,14 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_BROXTON;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@@ -0,0 +1,14 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_COFFEELAKE;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@@ -0,0 +1,14 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_GEMINILAKE;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@@ -0,0 +1,15 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_KABYLAKE;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@@ -0,0 +1,15 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_SKYLAKE;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@@ -0,0 +1,15 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_UNKNOWN;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@@ -0,0 +1,31 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/os_interface/hw_info_config.h"
namespace NEO {
template <PRODUCT_FAMILY productFamily>
struct MockHwInfoConfigHw : NEO::HwInfoConfigHw<productFamily> {
using HwInfoConfig::getDefaultLocalMemoryAccessMode;
std::vector<int32_t> getKernelSupportedThreadArbitrationPolicies() override;
bool isCooperativeEngineSupported(const HardwareInfo &hwInfo) const override;
bool getUuid(Device *device, std::array<uint8_t, HwInfoConfig::uuidSize> &uuid) const override;
uint32_t getSteppingFromHwRevId(const HardwareInfo &hwInfo) const override;
int configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) override;
bool use128MbEdram = false;
bool enableMidThreadPreemption = false;
bool enableThreadGroupPreemption = false;
bool enableMidBatchPreemption = false;
bool failOnConfigureHardwareCustom = false;
bool isCooperativeEngineSupportedValue = true;
uint32_t returnedStepping = 0;
std::vector<int32_t> threadArbPolicies = {};
};
} // namespace NEO

View File

@@ -0,0 +1,48 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
template <>
std::vector<int32_t> MockHwInfoConfigHw<gfxProduct>::getKernelSupportedThreadArbitrationPolicies() {
return threadArbPolicies;
}
template <>
bool MockHwInfoConfigHw<gfxProduct>::isCooperativeEngineSupported(const HardwareInfo &hwInfo) const {
return isCooperativeEngineSupportedValue;
}
template <>
bool MockHwInfoConfigHw<gfxProduct>::getUuid(Device *device, std::array<uint8_t, HwInfoConfig::uuidSize> &uuid) const {
return false;
}
template <>
uint32_t MockHwInfoConfigHw<gfxProduct>::getSteppingFromHwRevId(const HardwareInfo &hwInfo) const {
return returnedStepping;
}
template <>
int MockHwInfoConfigHw<gfxProduct>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) {
FeatureTable *featureTable = &hwInfo->featureTable;
featureTable->flags.ftrGpGpuMidThreadLevelPreempt = 0;
featureTable->flags.ftrGpGpuThreadGroupLevelPreempt = 0;
featureTable->flags.ftrGpGpuMidBatchPreempt = 0;
if (use128MbEdram) {
GT_SYSTEM_INFO *gtSystemInfo = &hwInfo->gtSystemInfo;
gtSystemInfo->EdramSizeInKb = 128 * 1000;
}
if (enableMidThreadPreemption) {
featureTable->flags.ftrGpGpuMidThreadLevelPreempt = 1;
}
if (enableThreadGroupPreemption) {
featureTable->flags.ftrGpGpuThreadGroupLevelPreempt = 1;
}
if (enableMidBatchPreemption) {
featureTable->flags.ftrGpGpuMidBatchPreempt = 1;
}
return (failOnConfigureHardwareCustom) ? -1 : 0;
}

View File

@@ -21,6 +21,10 @@ macro(macro_for_each_platform)
if(EXISTS ${SRC_FILE})
list(APPEND neo_libult_common_SRCS_ENABLE_TESTED_HW ${SRC_FILE})
endif()
set(SRC_FILE ${NEO_SHARED_TEST_DIRECTORY}/common${BRANCH_DIR}${CORE_TYPE_LOWER}${BRANCH}${PLATFORM_IT_LOWER}/mock_hw_info_config_${PLATFORM_IT_LOWER}.cpp)
if(EXISTS ${SRC_FILE})
list(APPEND neo_libult_common_SRCS_ENABLE_TESTED_HW ${SRC_FILE})
endif()
endforeach()
endforeach()
endmacro()
@@ -86,6 +90,8 @@ set(neo_libult_common_SRCS_LIB_ULT
${NEO_SHARED_TEST_DIRECTORY}/common/helpers/memory_leak_listener.h
${NEO_SHARED_TEST_DIRECTORY}/common/helpers/memory_management.cpp
${NEO_SHARED_TEST_DIRECTORY}/common/helpers/memory_management.h
${NEO_SHARED_TEST_DIRECTORY}/common/helpers/mock_hw_info_config_hw.cpp
${NEO_SHARED_TEST_DIRECTORY}/common/helpers/mock_hw_info_config_hw.h
${NEO_SHARED_TEST_DIRECTORY}/common/helpers/sip_init.cpp
${NEO_SHARED_TEST_DIRECTORY}/common/helpers/test_files.cpp
${NEO_SHARED_TEST_DIRECTORY}/common/helpers/test_files.h

View File

@@ -0,0 +1,15 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_XE_HP_SDV;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@@ -1,15 +0,0 @@
#
# Copyright (C) 2021-2022 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
if(TESTS_XE_HP_SDV)
set(NEO_CORE_TESTS_XE_HP_CORE_XEHP
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/test_preamble_xehp.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_preemption_xehp.cpp
)
target_sources(${TARGET_NAME} PRIVATE ${NEO_CORE_TESTS_XE_HP_CORE_XEHP})
endif()

View File

@@ -1,138 +0,0 @@
/*
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/command_stream/preemption.h"
#include "shared/source/command_stream/stream_properties.h"
#include "shared/source/helpers/preamble.h"
#include "shared/test/common/cmd_parse/hw_parse.h"
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/mocks/mock_graphics_allocation.h"
#include "shared/test/common/test_macros/test.h"
using namespace NEO;
struct XeHPSlm : HardwareParse, ::testing::Test {
void SetUp() override {
HardwareParse::SetUp();
}
void TearDown() override {
HardwareParse::TearDown();
}
uint32_t cmdBuffer[1024]{};
MockGraphicsAllocation gfxAllocation{cmdBuffer, sizeof(cmdBuffer)};
LinearStream linearStream{&gfxAllocation};
};
XEHPTEST_F(XeHPSlm, givenTglWhenPreambleIsBeingProgrammedThenThreadArbitrationPolicyIsIgnored) {
typedef XeHpFamily::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM;
LinearStream &cs = linearStream;
uint32_t l3Config = PreambleHelper<XeHpFamily>::getL3Config(*defaultHwInfo, true);
MockDevice mockDevice;
PreambleHelper<XeHpFamily>::programPreamble(&linearStream, mockDevice, l3Config,
nullptr);
parseCommands<XeHpFamily>(cs);
// parse through commands and ensure that 0xE404 is not being programmed
EXPECT_EQ(0U, countMmio<FamilyType>(cmdList.begin(), cmdList.end(), 0xE404));
}
XEHPTEST_F(XeHPSlm, WhenProgrammingL3ThenLoadRegisterImmNotUsed) {
typedef XeHpFamily::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM;
LinearStream &cs = linearStream;
uint32_t l3Config = PreambleHelper<FamilyType>::getL3Config(*defaultHwInfo, true);
PreambleHelper<FamilyType>::programL3(&cs, l3Config);
parseCommands<XeHpFamily>(cs);
auto itorLRI = find<MI_LOAD_REGISTER_IMM *>(cmdList.begin(), cmdList.end());
ASSERT_EQ(cmdList.end(), itorLRI);
}
using XeHPUrbEntryAllocationSize = ::testing::Test;
XEHPTEST_F(XeHPUrbEntryAllocationSize, WhenGettingUrbEntryAllocationSizeTheZeroIsReturned) {
uint32_t actualVal = PreambleHelper<FamilyType>::getUrbEntryAllocationSize();
EXPECT_EQ(0u, actualVal);
}
using XeHPPreambleVfeState = XeHPSlm;
XEHPTEST_F(XeHPPreambleVfeState, givenDefaultPipeControlWhenItIsProgrammedThenCsStallBitIsSet) {
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
PIPE_CONTROL *pipeControl = static_cast<PIPE_CONTROL *>(linearStream.getSpace(sizeof(PIPE_CONTROL)));
*pipeControl = FamilyType::cmdInitPipeControl;
EXPECT_EQ(1u, pipeControl->getCommandStreamerStallEnable());
}
XEHPTEST_F(XeHPPreambleVfeState, whenProgrammingComputeWalkerThenUavFieldsSetToZero) {
using COMPUTE_WALKER = typename FamilyType::COMPUTE_WALKER;
COMPUTE_WALKER *computeWalker = static_cast<COMPUTE_WALKER *>(linearStream.getSpace(sizeof(COMPUTE_WALKER)));
*computeWalker = FamilyType::cmdInitGpgpuWalker;
EXPECT_FALSE(computeWalker->getUavWaitToProduce());
EXPECT_FALSE(computeWalker->getUavProducer());
EXPECT_FALSE(computeWalker->getUavConsumer());
}
XEHPTEST_F(XeHPPreambleVfeState, whenProgrammingVfeStateThenDoNotAddPipeControlWaCmd) {
LinearStream &cs = linearStream;
size_t sizeBefore = cs.getUsed();
PreambleHelper<FamilyType>::addPipeControlBeforeVfeCmd(&cs, defaultHwInfo.get(), EngineGroupType::RenderCompute);
size_t sizeAfter = cs.getUsed();
EXPECT_EQ(sizeBefore, sizeAfter);
}
XEHPTEST_F(XeHPPreambleVfeState, WhenProgramVFEStateIsCalledThenCorrectCfeStateAddressIsReturned) {
using CFE_STATE = typename FamilyType::CFE_STATE;
char buffer[64];
MockGraphicsAllocation graphicsAllocation(buffer, sizeof(buffer));
LinearStream preambleStream(&graphicsAllocation, graphicsAllocation.getUnderlyingBuffer(), graphicsAllocation.getUnderlyingBufferSize());
uint64_t addressToPatch = 0xC0DEC0DE;
uint64_t expectedAddress = 0xDEC0C0;
auto pCfeCmd = PreambleHelper<FamilyType>::getSpaceForVfeState(&preambleStream, *defaultHwInfo, EngineGroupType::RenderCompute);
StreamProperties emptyProperties{};
PreambleHelper<FamilyType>::programVfeState(pCfeCmd, *defaultHwInfo, 1024u, addressToPatch, 10u, emptyProperties);
EXPECT_GE(reinterpret_cast<uintptr_t>(pCfeCmd), reinterpret_cast<uintptr_t>(preambleStream.getCpuBase()));
EXPECT_LT(reinterpret_cast<uintptr_t>(pCfeCmd), reinterpret_cast<uintptr_t>(preambleStream.getCpuBase()) + preambleStream.getUsed());
auto &cfeCmd = *reinterpret_cast<CFE_STATE *>(pCfeCmd);
EXPECT_EQ(10u, cfeCmd.getMaximumNumberOfThreads());
EXPECT_EQ(1u, cfeCmd.getNumberOfWalkers());
EXPECT_EQ(expectedAddress, cfeCmd.getScratchSpaceBuffer());
}
using XeHPPipelineSelect = ::testing::Test;
XEHPTEST_F(XeHPPipelineSelect, WhenAppendProgramPipelineSelectThenCorrectValuesSet) {
using PIPELINE_SELECT = typename FamilyType::PIPELINE_SELECT;
PIPELINE_SELECT cmd = FamilyType::cmdInitPipelineSelect;
PreambleHelper<FamilyType>::appendProgramPipelineSelect(&cmd, true, *defaultHwInfo);
EXPECT_TRUE(cmd.getSystolicModeEnable());
PreambleHelper<FamilyType>::appendProgramPipelineSelect(&cmd, false, *defaultHwInfo);
EXPECT_FALSE(cmd.getSystolicModeEnable());
EXPECT_EQ(pipelineSelectSystolicModeEnableMaskBits, cmd.getMaskBits());
}
XEHPTEST_F(XeHPPipelineSelect, WhenProgramPipelineSelectThenProgramMediaSamplerDopClockGateEnable) {
using PIPELINE_SELECT = typename FamilyType::PIPELINE_SELECT;
PIPELINE_SELECT cmd = FamilyType::cmdInitPipelineSelect;
LinearStream pipelineSelectStream(&cmd, sizeof(cmd));
PreambleHelper<FamilyType>::programPipelineSelect(&pipelineSelectStream, {}, *defaultHwInfo);
auto expectedSubMask = pipelineSelectMediaSamplerDopClockGateMaskBits;
EXPECT_TRUE(cmd.getMediaSamplerDopClockGateEnable());
EXPECT_EQ(expectedSubMask, (cmd.getMaskBits() & expectedSubMask));
}

View File

@@ -1,100 +0,0 @@
/*
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/built_ins/sip.h"
#include "shared/source/command_stream/preemption.h"
#include "shared/source/helpers/hw_info.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/common/cmd_parse/hw_parse.h"
#include "shared/test/common/mocks/mock_debugger.h"
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/test_macros/test.h"
#include <array>
using namespace NEO;
using PreemptionXeHPTest = ::testing::Test;
XEHPTEST_F(PreemptionXeHPTest, givenRevisionA0toBWhenProgrammingSipThenGlobalSipIsSet) {
using PIPE_CONTROL = XeHpFamily::PIPE_CONTROL;
using MI_LOAD_REGISTER_IMM = XeHpFamily::MI_LOAD_REGISTER_IMM;
using STATE_SIP = XeHpFamily::STATE_SIP;
HardwareInfo hwInfo = *NEO::defaultHwInfo.get();
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
std::array<uint32_t, 2> revisions = {hwInfoConfig.getHwRevIdFromStepping(REVID::REVISION_A0, hwInfo),
hwInfoConfig.getHwRevIdFromStepping(REVID::REVISION_B, hwInfo)};
for (auto revision : revisions) {
hwInfo.platform.usRevId = revision;
std::unique_ptr<MockDevice> mockDevice(NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, 0));
mockDevice->getExecutionEnvironment()->rootDeviceEnvironments[0]->debugger.reset(new MockDebugger);
auto sipAllocation = SipKernel::getSipKernel(*mockDevice).getSipAllocation();
size_t requiredSize = PreemptionHelper::getRequiredStateSipCmdSize<FamilyType>(*mockDevice, false);
StackVec<char, 1024> streamStorage(1024);
LinearStream cmdStream{streamStorage.begin(), streamStorage.size()};
auto expectedGlobalSipWaSize = sizeof(PIPE_CONTROL) + 2 * sizeof(MI_LOAD_REGISTER_IMM);
EXPECT_EQ(expectedGlobalSipWaSize, requiredSize);
PreemptionHelper::programStateSip<FamilyType>(cmdStream, *mockDevice);
EXPECT_NE(0U, cmdStream.getUsed());
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
cmdList, ptrOffset(cmdStream.getCpuBase(), 0), cmdStream.getUsed()));
auto itorLRI = findMmio<FamilyType>(cmdList.begin(), cmdList.end(), 0xE42C);
EXPECT_NE(cmdList.end(), itorLRI);
auto cmdLRI = genCmdCast<MI_LOAD_REGISTER_IMM *>(*itorLRI);
auto sipAddress = cmdLRI->getDataDword() & 0xfffffff8;
EXPECT_EQ(sipAllocation->getGpuAddressToPatch(), sipAddress);
}
}
XEHPTEST_F(PreemptionXeHPTest, givenRevisionA0toBWhenProgrammingSipEndWaThenGlobalSipIsRestored) {
using PIPE_CONTROL = XeHpFamily::PIPE_CONTROL;
using MI_LOAD_REGISTER_IMM = XeHpFamily::MI_LOAD_REGISTER_IMM;
using STATE_SIP = XeHpFamily::STATE_SIP;
HardwareInfo hwInfo = *NEO::defaultHwInfo.get();
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
std::array<uint32_t, 2> revisions = {hwInfoConfig.getHwRevIdFromStepping(REVID::REVISION_A0, hwInfo),
hwInfoConfig.getHwRevIdFromStepping(REVID::REVISION_B, hwInfo)};
for (auto revision : revisions) {
hwInfo.platform.usRevId = revision;
std::unique_ptr<MockDevice> mockDevice(NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, 0));
mockDevice->getExecutionEnvironment()->rootDeviceEnvironments[0]->debugger.reset(new MockDebugger);
StackVec<char, 1024> streamStorage(1024);
LinearStream cmdStream{streamStorage.begin(), streamStorage.size()};
PreemptionHelper::programStateSipEndWa<FamilyType>(cmdStream, *mockDevice);
EXPECT_NE(0U, cmdStream.getUsed());
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
cmdList, ptrOffset(cmdStream.getCpuBase(), 0), cmdStream.getUsed()));
auto itorPC = find<PIPE_CONTROL *>(cmdList.begin(), cmdList.end());
EXPECT_NE(cmdList.end(), itorPC);
auto itorLRI = findMmio<FamilyType>(itorPC, cmdList.end(), 0xE42C);
EXPECT_NE(cmdList.end(), itorLRI);
auto cmdLRI = genCmdCast<MI_LOAD_REGISTER_IMM *>(*itorLRI);
auto sipAddress = cmdLRI->getDataDword() & 0xfffffff8;
EXPECT_EQ(0u, sipAddress);
}
}

View File

@@ -0,0 +1,15 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_PVC;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@@ -0,0 +1,15 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_DG2;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO