mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-10 07:08:04 +08:00
Add PVC shared unit tests
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
9483070b18
commit
27f20b302b
@@ -28,5 +28,11 @@ if(TESTS_XEHP_AND_LATER)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(TESTS_PVC_AND_LATER)
|
||||
list(APPEND NEO_SHARED_TESTS_CMD_PARSE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmd_parse_pvc_and_later.inl
|
||||
)
|
||||
endif()
|
||||
|
||||
add_subdirectories()
|
||||
set_property(GLOBAL PROPERTY NEO_SHARED_TESTS_CMD_PARSE ${NEO_SHARED_TESTS_CMD_PARSE})
|
||||
|
||||
226
shared/test/common/cmd_parse/cmd_parse_pvc_and_later.inl
Normal file
226
shared/test/common/cmd_parse/cmd_parse_pvc_and_later.inl
Normal file
@@ -0,0 +1,226 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/program/kernel_info.h"
|
||||
#include "shared/test/common/cmd_parse/cmd_parse_3d_state_btd.inl"
|
||||
#include "shared/test/common/cmd_parse/cmd_parse_base.inl"
|
||||
#include "shared/test/common/cmd_parse/cmd_parse_compute_mi_arb.inl"
|
||||
#include "shared/test/common/cmd_parse/cmd_parse_compute_mode.inl"
|
||||
#include "shared/test/common/cmd_parse/cmd_parse_compute_walker.inl"
|
||||
#include "shared/test/common/cmd_parse/hw_parse.h"
|
||||
#include "shared/test/common/cmd_parse/hw_parse.inl"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using STATE_SIP = GenStruct::STATE_SIP;
|
||||
|
||||
template <>
|
||||
STATE_SIP *genCmdCast<STATE_SIP *>(void *buffer) {
|
||||
auto pCmd = reinterpret_cast<STATE_SIP *>(buffer);
|
||||
|
||||
return STATE_SIP::COMMAND_TYPE_GFXPIPE == pCmd->TheStructure.Common.CommandType &&
|
||||
STATE_SIP::COMMAND_SUBTYPE_GFXPIPE_COMMON == pCmd->TheStructure.Common.CommandSubtype &&
|
||||
STATE_SIP::_3D_COMMAND_OPCODE_GFXPIPE_NONPIPELINED == pCmd->TheStructure.Common._3DCommandOpcode &&
|
||||
STATE_SIP::_3D_COMMAND_SUB_OPCODE_STATE_SIP == pCmd->TheStructure.Common._3DCommandSubOpcode
|
||||
? pCmd
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
size_t CmdParse<GenGfxFamily>::getCommandLengthHwSpecific(void *cmd) {
|
||||
{
|
||||
auto pCmd = genCmdCast<STATE_COMPUTE_MODE *>(cmd);
|
||||
if (pCmd)
|
||||
return pCmd->TheStructure.Common.DwordLength + 2;
|
||||
}
|
||||
{
|
||||
auto pCmd = genCmdCast<COMPUTE_WALKER *>(cmd);
|
||||
if (pCmd)
|
||||
return pCmd->TheStructure.Common.DwordLength + 2;
|
||||
}
|
||||
{
|
||||
auto pCmd = genCmdCast<CFE_STATE *>(cmd);
|
||||
if (pCmd)
|
||||
return pCmd->TheStructure.Common.DwordLength + 2;
|
||||
}
|
||||
{
|
||||
auto pCmd = genCmdCast<_3DSTATE_BINDING_TABLE_POOL_ALLOC *>(cmd);
|
||||
if (pCmd)
|
||||
return pCmd->TheStructure.Common.DwordLength + 2;
|
||||
}
|
||||
{
|
||||
auto pCmd = genCmdCast<MI_SET_PREDICATE *>(cmd);
|
||||
if (pCmd)
|
||||
return 1;
|
||||
}
|
||||
{
|
||||
auto pCmd = genCmdCast<_3DSTATE_BTD *>(cmd);
|
||||
if (pCmd)
|
||||
return pCmd->TheStructure.Common.DwordLength + 2;
|
||||
}
|
||||
{
|
||||
auto pCmd = genCmdCast<STATE_SIP *>(cmd);
|
||||
if (pCmd)
|
||||
return pCmd->TheStructure.Common.DwordLength + 2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <>
|
||||
const char *CmdParse<GenGfxFamily>::getCommandNameHwSpecific(void *cmd) {
|
||||
if (nullptr != genCmdCast<STATE_COMPUTE_MODE *>(cmd)) {
|
||||
return "STATE_COMPUTE_MODE";
|
||||
}
|
||||
|
||||
if (nullptr != genCmdCast<COMPUTE_WALKER *>(cmd)) {
|
||||
return "COMPUTE_WALKER";
|
||||
}
|
||||
|
||||
if (nullptr != genCmdCast<CFE_STATE *>(cmd)) {
|
||||
return "CFE_STATE";
|
||||
}
|
||||
|
||||
if (nullptr != genCmdCast<_3DSTATE_BINDING_TABLE_POOL_ALLOC *>(cmd)) {
|
||||
return "_3DSTATE_BINDING_TABLE_POOL_ALLOC";
|
||||
}
|
||||
|
||||
if (nullptr != genCmdCast<MI_SET_PREDICATE *>(cmd)) {
|
||||
return "MI_SET_PREDICATE";
|
||||
}
|
||||
|
||||
if (nullptr != genCmdCast<_3DSTATE_BTD *>(cmd)) {
|
||||
return "_3DSTATE_BTD";
|
||||
}
|
||||
|
||||
if (nullptr != genCmdCast<STATE_SIP *>(cmd)) {
|
||||
return "STATE_SIP";
|
||||
}
|
||||
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
||||
template struct CmdParse<GenGfxFamily>;
|
||||
|
||||
namespace NEO {
|
||||
|
||||
template <>
|
||||
void HardwareParse::findHardwareCommands<GenGfxFamily>(IndirectHeap *dsh) {
|
||||
typedef typename GenGfxFamily::COMPUTE_WALKER COMPUTE_WALKER;
|
||||
typedef typename GenGfxFamily::CFE_STATE CFE_STATE;
|
||||
typedef typename GenGfxFamily::PIPELINE_SELECT PIPELINE_SELECT;
|
||||
typedef typename GenGfxFamily::STATE_BASE_ADDRESS STATE_BASE_ADDRESS;
|
||||
typedef typename GenGfxFamily::INTERFACE_DESCRIPTOR_DATA INTERFACE_DESCRIPTOR_DATA;
|
||||
typedef typename GenGfxFamily::MI_BATCH_BUFFER_START MI_BATCH_BUFFER_START;
|
||||
typedef typename GenGfxFamily::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM;
|
||||
|
||||
itorWalker = find<COMPUTE_WALKER *>(cmdList.begin(), cmdList.end());
|
||||
if (itorWalker != cmdList.end()) {
|
||||
cmdWalker = *itorWalker;
|
||||
}
|
||||
|
||||
itorBBStartAfterWalker = find<MI_BATCH_BUFFER_START *>(itorWalker, cmdList.end());
|
||||
if (itorBBStartAfterWalker != cmdList.end()) {
|
||||
cmdBBStartAfterWalker = *itorBBStartAfterWalker;
|
||||
}
|
||||
for (auto it = cmdList.begin(); it != cmdList.end(); it++) {
|
||||
auto lri = genCmdCast<MI_LOAD_REGISTER_IMM *>(*it);
|
||||
if (lri) {
|
||||
lriList.push_back(*it);
|
||||
}
|
||||
}
|
||||
|
||||
if (parsePipeControl) {
|
||||
for (auto it = cmdList.begin(); it != cmdList.end(); it++) {
|
||||
auto pipeControl = genCmdCast<PIPE_CONTROL *>(*it);
|
||||
if (pipeControl) {
|
||||
pipeControlList.push_back(*it);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
itorPipelineSelect = find<PIPELINE_SELECT *>(cmdList.begin(), itorWalker);
|
||||
if (itorPipelineSelect != itorWalker) {
|
||||
cmdPipelineSelect = *itorPipelineSelect;
|
||||
}
|
||||
|
||||
itorMediaVfeState = find<CFE_STATE *>(itorPipelineSelect, itorWalker);
|
||||
if (itorMediaVfeState != itorWalker) {
|
||||
cmdMediaVfeState = *itorMediaVfeState;
|
||||
}
|
||||
|
||||
STATE_BASE_ADDRESS *cmdSBA = nullptr;
|
||||
uint64_t dynamicStateHeap = 0;
|
||||
itorStateBaseAddress = find<STATE_BASE_ADDRESS *>(cmdList.begin(), itorWalker);
|
||||
if (itorStateBaseAddress != itorWalker) {
|
||||
cmdSBA = (STATE_BASE_ADDRESS *)*itorStateBaseAddress;
|
||||
cmdStateBaseAddress = *itorStateBaseAddress;
|
||||
|
||||
// Extract the dynamicStateHeap
|
||||
dynamicStateHeap = cmdSBA->getDynamicStateBaseAddress();
|
||||
if (dsh && (dsh->getHeapGpuBase() == dynamicStateHeap)) {
|
||||
dynamicStateHeap = reinterpret_cast<uint64_t>(dsh->getCpuBase());
|
||||
}
|
||||
ASSERT_NE(0u, dynamicStateHeap);
|
||||
}
|
||||
|
||||
// interfaceDescriptorData should be located within COMPUTE_WALKER
|
||||
if (cmdWalker) {
|
||||
// Extract the interfaceDescriptorData
|
||||
INTERFACE_DESCRIPTOR_DATA &idd = reinterpret_cast<COMPUTE_WALKER *>(cmdWalker)->getInterfaceDescriptor();
|
||||
cmdInterfaceDescriptorData = &idd;
|
||||
}
|
||||
}
|
||||
|
||||
template <>
|
||||
const void *HardwareParse::getStatelessArgumentPointer<GenGfxFamily>(const KernelInfo &kernelInfo, uint32_t indexArg, IndirectHeap &ioh, uint32_t rootDeviceIndex) {
|
||||
typedef typename GenGfxFamily::COMPUTE_WALKER COMPUTE_WALKER;
|
||||
typedef typename GenGfxFamily::STATE_BASE_ADDRESS STATE_BASE_ADDRESS;
|
||||
|
||||
auto cmdWalker = (COMPUTE_WALKER *)this->cmdWalker;
|
||||
EXPECT_NE(nullptr, cmdWalker);
|
||||
auto inlineInComputeWalker = cmdWalker->getInlineDataPointer();
|
||||
|
||||
auto cmdSBA = (STATE_BASE_ADDRESS *)cmdStateBaseAddress;
|
||||
EXPECT_NE(nullptr, cmdSBA);
|
||||
auto argOffset = std::numeric_limits<uint32_t>::max();
|
||||
// Determine where the argument is
|
||||
const auto &arg = kernelInfo.getArgDescriptorAt(indexArg);
|
||||
if (arg.is<ArgDescriptor::ArgTPointer>() && isValidOffset(arg.as<ArgDescPointer>().stateless)) {
|
||||
argOffset = arg.as<ArgDescPointer>().stateless;
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool inlineDataActive = kernelInfo.kernelDescriptor.kernelAttributes.flags.passInlineData;
|
||||
auto inlineDataSize = 32u;
|
||||
|
||||
auto offsetCrossThreadData = cmdWalker->getIndirectDataStartAddress();
|
||||
|
||||
offsetCrossThreadData -= static_cast<uint32_t>(ioh.getGraphicsAllocation()->getGpuAddressToPatch());
|
||||
|
||||
// Get the base of cross thread
|
||||
auto pCrossThreadData = ptrOffset(
|
||||
reinterpret_cast<const void *>(ioh.getCpuBase()),
|
||||
offsetCrossThreadData);
|
||||
|
||||
if (inlineDataActive) {
|
||||
if (argOffset < inlineDataSize) {
|
||||
return ptrOffset(inlineInComputeWalker, argOffset);
|
||||
} else {
|
||||
return ptrOffset(pCrossThreadData, argOffset - inlineDataSize);
|
||||
}
|
||||
}
|
||||
|
||||
return ptrOffset(pCrossThreadData, argOffset);
|
||||
}
|
||||
|
||||
template <>
|
||||
void HardwareParse::findHardwareCommands<GenGfxFamily>() {
|
||||
findHardwareCommands<GenGfxFamily>(nullptr);
|
||||
}
|
||||
} // namespace NEO
|
||||
@@ -50,6 +50,13 @@ if(TESTS_DG2_AND_LATER)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(TESTS_PVC_AND_LATER)
|
||||
list(APPEND NEO_CORE_HELPERS_TESTS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_blit_commands_helper_pvc_and_later.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/simd_helper_tests_pvc_and_later.inl
|
||||
)
|
||||
endif()
|
||||
|
||||
add_subdirectories()
|
||||
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
|
||||
@@ -11,4 +11,5 @@
|
||||
#include "shared/test/common/gen8/test_traits_gen8.h"
|
||||
#include "shared/test/common/gen9/test_traits_gen9.h"
|
||||
#include "shared/test/common/xe_hp_core/test_traits_xe_hp_core.h"
|
||||
#include "shared/test/common/xe_hpg_core/test_traits_xe_hpg_core.h"
|
||||
#include "shared/test/common/xe_hpc_core/test_traits_xe_hpc_core.h"
|
||||
#include "shared/test/common/xe_hpg_core/test_traits_xe_hpg_core.h"
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/simd_helper.h"
|
||||
|
||||
#include "test.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
template <typename WALKER_TYPE>
|
||||
class GivenSimdSizeWhenGetSimdConfigCalledThenCorrectEnumReturnedPVCAndLater {
|
||||
public:
|
||||
static void TestBodyImpl() {
|
||||
uint32_t simd = 32;
|
||||
auto result = getSimdConfig<WALKER_TYPE>(simd);
|
||||
EXPECT_EQ(result, WALKER_TYPE::SIMD_SIZE::SIMD_SIZE_SIMT32);
|
||||
|
||||
simd = 16;
|
||||
result = getSimdConfig<WALKER_TYPE>(simd);
|
||||
EXPECT_EQ(result, WALKER_TYPE::SIMD_SIZE::SIMD_SIZE_SIMT16);
|
||||
|
||||
simd = 1;
|
||||
result = getSimdConfig<WALKER_TYPE>(simd);
|
||||
EXPECT_EQ(result, WALKER_TYPE::SIMD_SIZE::SIMD_SIZE_SIMT32);
|
||||
}
|
||||
};
|
||||
} // namespace NEO
|
||||
@@ -0,0 +1,342 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/gmm_helper/client_context/gmm_client_context.h"
|
||||
#include "shared/test/common/helpers/blit_commands_helper_tests.inl"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using BlitTests = Test<DeviceFixture>;
|
||||
|
||||
HWTEST2_F(BlitTests, givenOneBytePatternWhenFillPatternWithBlitThenCommandIsProgrammed, IsPVC) {
|
||||
using MEM_SET = typename FamilyType::MEM_SET;
|
||||
uint32_t pattern = 1;
|
||||
uint32_t streamBuffer[100] = {};
|
||||
LinearStream stream(streamBuffer, sizeof(streamBuffer));
|
||||
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
|
||||
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
|
||||
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
|
||||
BlitCommandsHelper<FamilyType>::dispatchBlitMemoryColorFill(&mockAllocation, 0, &pattern, sizeof(uint8_t), stream, mockAllocation.getUnderlyingBufferSize(), *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]);
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||
cmdList, ptrOffset(stream.getCpuBase(), 0), stream.getUsed()));
|
||||
auto itor = find<MEM_SET *>(cmdList.begin(), cmdList.end());
|
||||
EXPECT_NE(cmdList.end(), itor);
|
||||
}
|
||||
|
||||
HWTEST2_F(BlitTests, givenDeviceWithoutDefaultGmmWhenAppendBlitCommandsForVillBufferThenDstCompressionDisabled, IsPVC) {
|
||||
using MEM_SET = typename FamilyType::MEM_SET;
|
||||
uint32_t pattern = 1;
|
||||
uint32_t streamBuffer[100] = {};
|
||||
LinearStream stream(streamBuffer, sizeof(streamBuffer));
|
||||
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
|
||||
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
|
||||
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
|
||||
BlitCommandsHelper<FamilyType>::dispatchBlitMemoryColorFill(&mockAllocation, 0, &pattern, sizeof(uint8_t), stream, mockAllocation.getUnderlyingBufferSize(), *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]);
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||
cmdList, ptrOffset(stream.getCpuBase(), 0), stream.getUsed()));
|
||||
auto itor = find<MEM_SET *>(cmdList.begin(), cmdList.end());
|
||||
EXPECT_NE(cmdList.end(), itor);
|
||||
{
|
||||
auto blitCmd = genCmdCast<MEM_SET *>(*itor);
|
||||
EXPECT_EQ(blitCmd->getDestinationCompressible(), MEM_SET::DESTINATION_COMPRESSIBLE::DESTINATION_COMPRESSIBLE_NOT_COMPRESSIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST2_F(BlitTests, givenGmmWithDisabledCompresionWhenAppendBlitCommandsForVillBufferThenDstCompressionDisabled, IsPVC) {
|
||||
using MEM_SET = typename FamilyType::MEM_SET;
|
||||
auto gmm = std::make_unique<MockGmm>(pDevice->getGmmClientContext());
|
||||
gmm->isCompressionEnabled = false;
|
||||
|
||||
uint32_t pattern = 1;
|
||||
uint32_t streamBuffer[100] = {};
|
||||
LinearStream stream(streamBuffer, sizeof(streamBuffer));
|
||||
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
|
||||
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
|
||||
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
|
||||
mockAllocation.setGmm(gmm.get(), 0u);
|
||||
BlitCommandsHelper<FamilyType>::dispatchBlitMemoryColorFill(&mockAllocation, 0, &pattern, sizeof(uint8_t), stream, mockAllocation.getUnderlyingBufferSize(), *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]);
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||
cmdList, ptrOffset(stream.getCpuBase(), 0), stream.getUsed()));
|
||||
auto itor = find<MEM_SET *>(cmdList.begin(), cmdList.end());
|
||||
EXPECT_NE(cmdList.end(), itor);
|
||||
{
|
||||
auto blitCmd = genCmdCast<MEM_SET *>(*itor);
|
||||
EXPECT_EQ(blitCmd->getDestinationCompressible(), MEM_SET::DESTINATION_COMPRESSIBLE::DESTINATION_COMPRESSIBLE_NOT_COMPRESSIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST2_F(BlitTests, givenGmmWithEnabledCompresionWhenAppendBlitCommandsForVillBufferThenDstCompressionEnabled, IsPVC) {
|
||||
using MEM_SET = typename FamilyType::MEM_SET;
|
||||
auto gmm = std::make_unique<MockGmm>(pDevice->getGmmClientContext());
|
||||
gmm->isCompressionEnabled = true;
|
||||
|
||||
uint32_t pattern = 1;
|
||||
uint32_t streamBuffer[100] = {};
|
||||
LinearStream stream(streamBuffer, sizeof(streamBuffer));
|
||||
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
|
||||
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
|
||||
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
|
||||
mockAllocation.setGmm(gmm.get(), 0u);
|
||||
const auto &rootDeviceEnvironment = pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()];
|
||||
BlitCommandsHelper<FamilyType>::dispatchBlitMemoryColorFill(&mockAllocation, 0, &pattern, sizeof(uint8_t), stream, mockAllocation.getUnderlyingBufferSize(), *rootDeviceEnvironment);
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||
cmdList, ptrOffset(stream.getCpuBase(), 0), stream.getUsed()));
|
||||
auto itor = find<MEM_SET *>(cmdList.begin(), cmdList.end());
|
||||
EXPECT_NE(cmdList.end(), itor);
|
||||
{
|
||||
auto blitCmd = genCmdCast<MEM_SET *>(*itor);
|
||||
EXPECT_EQ(blitCmd->getDestinationCompressible(), MEM_SET::DESTINATION_COMPRESSIBLE::DESTINATION_COMPRESSIBLE_COMPRESSIBLE);
|
||||
|
||||
auto resourceFormat = gmm->gmmResourceInfo->getResourceFormat();
|
||||
auto compressionFormat = rootDeviceEnvironment->getGmmClientContext()->getSurfaceStateCompressionFormat(resourceFormat);
|
||||
EXPECT_EQ(compressionFormat, blitCmd->getCompressionFormat40());
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST2_F(BlitTests, givenOverridedMocksValueWhenAppendBlitCommandsForVillBufferThenDebugMocksValueIsSet, IsPVC) {
|
||||
using MEM_SET = typename FamilyType::MEM_SET;
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
uint32_t mockValue = 5;
|
||||
DebugManager.flags.OverrideBlitterMocs.set(mockValue);
|
||||
|
||||
uint32_t pattern = 1;
|
||||
uint32_t streamBuffer[100] = {};
|
||||
LinearStream stream(streamBuffer, sizeof(streamBuffer));
|
||||
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
|
||||
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
|
||||
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
|
||||
BlitCommandsHelper<FamilyType>::dispatchBlitMemoryColorFill(&mockAllocation, 0, &pattern, sizeof(uint8_t), stream, mockAllocation.getUnderlyingBufferSize(), *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]);
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||
cmdList, ptrOffset(stream.getCpuBase(), 0), stream.getUsed()));
|
||||
auto itor = find<MEM_SET *>(cmdList.begin(), cmdList.end());
|
||||
EXPECT_NE(cmdList.end(), itor);
|
||||
{
|
||||
auto blitCmd = genCmdCast<MEM_SET *>(*itor);
|
||||
EXPECT_EQ(blitCmd->getDestinationMOCS(), mockValue);
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST2_F(BlitTests, givenEnableStatelessCompressionWithUnifiedMemoryAndSystemMemWhenAppendBlitCommandsForVillBufferThenCompresionDisabled, IsPVC) {
|
||||
using MEM_SET = typename FamilyType::MEM_SET;
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.EnableStatelessCompressionWithUnifiedMemory.set(true);
|
||||
|
||||
uint32_t pattern = 1;
|
||||
uint32_t streamBuffer[100] = {};
|
||||
LinearStream stream(streamBuffer, sizeof(streamBuffer));
|
||||
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
|
||||
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
|
||||
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
|
||||
BlitCommandsHelper<FamilyType>::dispatchBlitMemoryColorFill(&mockAllocation, 0, &pattern, sizeof(uint8_t), stream, mockAllocation.getUnderlyingBufferSize(), *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]);
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||
cmdList, ptrOffset(stream.getCpuBase(), 0), stream.getUsed()));
|
||||
auto itor = find<MEM_SET *>(cmdList.begin(), cmdList.end());
|
||||
EXPECT_NE(cmdList.end(), itor);
|
||||
{
|
||||
auto blitCmd = genCmdCast<MEM_SET *>(*itor);
|
||||
EXPECT_EQ(blitCmd->getDestinationCompressible(), MEM_SET::DESTINATION_COMPRESSIBLE::DESTINATION_COMPRESSIBLE_NOT_COMPRESSIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST2_F(BlitTests, givenEnableStatelessCompressionWithUnifiedMemoryAndLocalMemWhenAppendBlitCommandsForVillBufferThenCompresionEnabled, IsPVC) {
|
||||
using MEM_SET = typename FamilyType::MEM_SET;
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.EnableStatelessCompressionWithUnifiedMemory.set(true);
|
||||
|
||||
uint32_t pattern = 1;
|
||||
uint32_t streamBuffer[100] = {};
|
||||
LinearStream stream(streamBuffer, sizeof(streamBuffer));
|
||||
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
|
||||
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
|
||||
MemoryPool::LocalMemory, MemoryManager::maxOsContextCount);
|
||||
BlitCommandsHelper<FamilyType>::dispatchBlitMemoryColorFill(&mockAllocation, 0, &pattern, sizeof(uint8_t), stream, mockAllocation.getUnderlyingBufferSize(), *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]);
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||
cmdList, ptrOffset(stream.getCpuBase(), 0), stream.getUsed()));
|
||||
auto itor = find<MEM_SET *>(cmdList.begin(), cmdList.end());
|
||||
EXPECT_NE(cmdList.end(), itor);
|
||||
{
|
||||
auto blitCmd = genCmdCast<MEM_SET *>(*itor);
|
||||
EXPECT_EQ(blitCmd->getDestinationCompressible(), MEM_SET::DESTINATION_COMPRESSIBLE::DESTINATION_COMPRESSIBLE_COMPRESSIBLE);
|
||||
EXPECT_EQ(static_cast<uint32_t>(DebugManager.flags.FormatForStatelessCompressionWithUnifiedMemory.get()), blitCmd->getCompressionFormat40());
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST2_F(BlitTests, givenMemorySizeBiggerThanMaxWidthButLessThanTwiceMaxWidthWhenFillPatternWithBlitThenHeightIsOne, IsPVC) {
|
||||
using MEM_SET = typename FamilyType::MEM_SET;
|
||||
uint32_t pattern = 1;
|
||||
uint32_t streamBuffer[100] = {};
|
||||
LinearStream stream(streamBuffer, sizeof(streamBuffer));
|
||||
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
|
||||
reinterpret_cast<void *>(0x1234), 0x1000, 0, (2 * BlitterConstants::maxBlitSetWidth) - 1,
|
||||
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
|
||||
BlitCommandsHelper<FamilyType>::dispatchBlitMemoryColorFill(&mockAllocation, 0, &pattern, sizeof(uint8_t), stream, mockAllocation.getUnderlyingBufferSize(), *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]);
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||
cmdList, ptrOffset(stream.getCpuBase(), 0), stream.getUsed()));
|
||||
auto itor = find<MEM_SET *>(cmdList.begin(), cmdList.end());
|
||||
EXPECT_NE(cmdList.end(), itor);
|
||||
{
|
||||
auto cmd = genCmdCast<MEM_SET *>(*itor);
|
||||
EXPECT_EQ(cmd->getFillHeight(), 1u);
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST2_F(BlitTests, givenMemorySizeTwiceBiggerThanMaxWidthWhenFillPatternWithBlitThenHeightIsTwo, IsPVC) {
|
||||
using MEM_SET = typename FamilyType::MEM_SET;
|
||||
uint32_t pattern = 1;
|
||||
uint32_t streamBuffer[100] = {};
|
||||
LinearStream stream(streamBuffer, sizeof(streamBuffer));
|
||||
MockGraphicsAllocation mockAllocation(0, GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
|
||||
reinterpret_cast<void *>(0x1234), 0x1000, 0, (2 * BlitterConstants::maxBlitSetWidth),
|
||||
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
|
||||
BlitCommandsHelper<FamilyType>::dispatchBlitMemoryColorFill(&mockAllocation, 0, &pattern, sizeof(uint8_t), stream, mockAllocation.getUnderlyingBufferSize(), *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]);
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||
cmdList, ptrOffset(stream.getCpuBase(), 0), stream.getUsed()));
|
||||
auto itor = find<MEM_SET *>(cmdList.begin(), cmdList.end());
|
||||
EXPECT_NE(cmdList.end(), itor);
|
||||
{
|
||||
auto cmd = genCmdCast<MEM_SET *>(*itor);
|
||||
EXPECT_EQ(cmd->getFillHeight(), 2u);
|
||||
}
|
||||
}
|
||||
|
||||
struct BlitTestsTestPvc : BlitColorTests {};
|
||||
|
||||
template <typename FamilyType>
|
||||
class GivenLinearStreamWhenCallDispatchBlitMemoryColorFillThenCorrectDepthIsProgrammedPVC : public GivenLinearStreamWhenCallDispatchBlitMemoryColorFillThenCorrectDepthIsProgrammed<FamilyType> {
|
||||
public:
|
||||
GivenLinearStreamWhenCallDispatchBlitMemoryColorFillThenCorrectDepthIsProgrammedPVC(Device *device) : GivenLinearStreamWhenCallDispatchBlitMemoryColorFillThenCorrectDepthIsProgrammed<FamilyType>(device) {}
|
||||
};
|
||||
|
||||
template <typename FamilyType>
|
||||
typename FamilyType::XY_COLOR_BLT::COLOR_DEPTH getColorDepth(size_t patternSize) {
|
||||
using COLOR_DEPTH = typename FamilyType::XY_COLOR_BLT::COLOR_DEPTH;
|
||||
COLOR_DEPTH depth = {};
|
||||
switch (patternSize) {
|
||||
case 1:
|
||||
depth = COLOR_DEPTH::COLOR_DEPTH_8_BIT_COLOR;
|
||||
break;
|
||||
case 2:
|
||||
depth = COLOR_DEPTH::COLOR_DEPTH_16_BIT_COLOR;
|
||||
break;
|
||||
case 4:
|
||||
depth = COLOR_DEPTH::COLOR_DEPTH_32_BIT_COLOR;
|
||||
break;
|
||||
case 8:
|
||||
depth = COLOR_DEPTH::COLOR_DEPTH_64_BIT_COLOR;
|
||||
break;
|
||||
case 16:
|
||||
depth = COLOR_DEPTH::COLOR_DEPTH_128_BIT_COLOR;
|
||||
break;
|
||||
}
|
||||
return depth;
|
||||
}
|
||||
|
||||
HWTEST2_P(BlitTestsTestPvc, givenCommandStreamWhenCallToDispatchMemoryFillThenColorDepthAreProgrammedCorrectly, IsXeHpcCore) {
|
||||
auto patternSize = GetParam();
|
||||
auto expecttedDepth = getColorDepth<FamilyType>(patternSize);
|
||||
GivenLinearStreamWhenCallDispatchBlitMemoryColorFillThenCorrectDepthIsProgrammedPVC<FamilyType> test(pDevice);
|
||||
test.TestBodyImpl(patternSize, expecttedDepth);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(size_t,
|
||||
BlitTestsTestPvc,
|
||||
testing::Values(2,
|
||||
4,
|
||||
8,
|
||||
16));
|
||||
|
||||
HWTEST2_F(BlitTests, givenMemoryAndImageWhenDispatchCopyImageCallThenCommandAddedToStream, IsPVC) {
|
||||
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
|
||||
MockGraphicsAllocation srcAlloc;
|
||||
MockGraphicsAllocation dstAlloc;
|
||||
MockGraphicsAllocation clearColorAlloc;
|
||||
|
||||
Vec3<size_t> dstOffsets = {0, 0, 0};
|
||||
Vec3<size_t> srcOffsets = {0, 0, 0};
|
||||
|
||||
Vec3<size_t> copySize = {0x100, 0x40, 0x1};
|
||||
Vec3<size_t> srcSize = {0x100, 0x40, 0x1};
|
||||
Vec3<size_t> dstSize = {0x100, 0x40, 0x1};
|
||||
|
||||
size_t srcRowPitch = srcSize.x;
|
||||
size_t srcSlicePitch = srcSize.y;
|
||||
size_t dstRowPitch = dstSize.x;
|
||||
size_t dstSlicePitch = dstSize.y;
|
||||
|
||||
auto blitProperties = BlitProperties::constructPropertiesForCopy(&dstAlloc, &srcAlloc,
|
||||
dstOffsets, srcOffsets, copySize, srcRowPitch, srcSlicePitch,
|
||||
dstRowPitch, dstSlicePitch, &clearColorAlloc);
|
||||
|
||||
uint32_t streamBuffer[100] = {};
|
||||
LinearStream stream(streamBuffer, sizeof(streamBuffer));
|
||||
blitProperties.bytesPerPixel = 4;
|
||||
blitProperties.srcSize = srcSize;
|
||||
blitProperties.dstSize = dstSize;
|
||||
NEO::BlitCommandsHelper<FamilyType>::dispatchBlitCommandsRegion(blitProperties, stream, *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]);
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||
cmdList, ptrOffset(stream.getCpuBase(), 0), stream.getUsed()));
|
||||
auto itor = find<XY_COPY_BLT *>(cmdList.begin(), cmdList.end());
|
||||
EXPECT_EQ(cmdList.end(), itor);
|
||||
}
|
||||
|
||||
HWTEST2_F(BlitTests, givenBlockCopyCommandWhenAppendBlitCommandsForImagesThenNothingChanged, IsPVC) {
|
||||
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
|
||||
auto bltCmd = FamilyType::cmdInitXyCopyBlt;
|
||||
auto bltCmdBefore = bltCmd;
|
||||
BlitProperties properties = {};
|
||||
auto srcSlicePitch = static_cast<uint32_t>(properties.srcSlicePitch);
|
||||
auto dstSlicePitch = static_cast<uint32_t>(properties.dstSlicePitch);
|
||||
NEO::BlitCommandsHelper<FamilyType>::appendBlitCommandsForImages(properties, bltCmd, pDevice->getRootDeviceEnvironment(), srcSlicePitch, dstSlicePitch);
|
||||
EXPECT_EQ(memcmp(&bltCmd, &bltCmdBefore, sizeof(XY_COPY_BLT)), 0);
|
||||
}
|
||||
HWTEST2_F(BlitTests, givenBlockCopyCommandWhenAppendColorDepthThenNothingChanged, IsPVC) {
|
||||
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
|
||||
auto bltCmd = FamilyType::cmdInitXyCopyBlt;
|
||||
auto bltCmdBefore = bltCmd;
|
||||
BlitProperties properties = {};
|
||||
NEO::BlitCommandsHelper<FamilyType>::appendColorDepth(properties, bltCmd);
|
||||
EXPECT_EQ(memcmp(&bltCmd, &bltCmdBefore, sizeof(XY_COPY_BLT)), 0);
|
||||
}
|
||||
HWTEST2_F(BlitTests, givenBlockCopyCommandWhenAppendSliceOffsetThenNothingChanged, IsPVC) {
|
||||
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
|
||||
auto bltCmd = FamilyType::cmdInitXyCopyBlt;
|
||||
auto bltCmdBefore = bltCmd;
|
||||
BlitProperties properties = {};
|
||||
auto srcSlicePitch = 0u;
|
||||
auto dstSlicePitch = 0u;
|
||||
|
||||
NEO::BlitCommandsHelper<FamilyType>::appendSliceOffsets(properties, bltCmd, 0, pDevice->getRootDeviceEnvironment(), srcSlicePitch, dstSlicePitch);
|
||||
EXPECT_EQ(memcmp(&bltCmd, &bltCmdBefore, sizeof(XY_COPY_BLT)), 0);
|
||||
}
|
||||
HWTEST2_F(BlitTests, givenBlockCopyCommandWhenAppendSurfaceTypeThenNothingChanged, IsPVC) {
|
||||
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
|
||||
auto bltCmd = FamilyType::cmdInitXyCopyBlt;
|
||||
auto bltCmdBefore = bltCmd;
|
||||
BlitProperties properties = {};
|
||||
NEO::BlitCommandsHelper<FamilyType>::appendSurfaceType(properties, bltCmd);
|
||||
EXPECT_EQ(memcmp(&bltCmd, &bltCmdBefore, sizeof(XY_COPY_BLT)), 0);
|
||||
}
|
||||
HWTEST2_F(BlitTests, givenBlockCopyCommandWhenAppendTilingTypeThenNothingChanged, IsPVC) {
|
||||
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
|
||||
auto bltCmd = FamilyType::cmdInitXyCopyBlt;
|
||||
auto bltCmdBefore = bltCmd;
|
||||
BlitProperties properties = {};
|
||||
NEO::BlitCommandsHelper<FamilyType>::appendTilingType(GMM_NOT_TILED, GMM_NOT_TILED, bltCmd);
|
||||
EXPECT_EQ(memcmp(&bltCmd, &bltCmdBefore, sizeof(XY_COPY_BLT)), 0);
|
||||
}
|
||||
33
shared/test/common/libult/xe_hpc_core.cpp
Normal file
33
shared/test/common/libult/xe_hpc_core.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/populate_factory.h"
|
||||
#include "shared/test/common/libult/ult_command_stream_receiver.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
typedef XE_HPC_COREFamily Family;
|
||||
|
||||
static auto gfxCore = IGFX_XE_HPC_CORE;
|
||||
|
||||
extern CommandStreamReceiverCreateFunc commandStreamReceiverFactory[2 * IGFX_MAX_CORE];
|
||||
|
||||
template <>
|
||||
void populateFactoryTable<UltCommandStreamReceiver<Family>>() {
|
||||
commandStreamReceiverFactory[IGFX_MAX_CORE + gfxCore] = UltCommandStreamReceiver<Family>::create;
|
||||
}
|
||||
|
||||
struct enableXeHpcCore {
|
||||
enableXeHpcCore() {
|
||||
populateFactoryTable<UltCommandStreamReceiver<Family>>();
|
||||
}
|
||||
};
|
||||
|
||||
static enableXeHpcCore enable;
|
||||
|
||||
template class UltCommandStreamReceiver<XE_HPC_COREFamily>;
|
||||
} // namespace NEO
|
||||
@@ -0,0 +1,15 @@
|
||||
#
|
||||
# Copyright (C) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
if(TESTS_XE_HPC_CORE)
|
||||
set(NEO_SHARED_aub_tests_configurations
|
||||
${NEO_SHARED_aub_tests_configurations}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/aub_tests_configuration_xe_hpc_core.cpp
|
||||
)
|
||||
|
||||
set(NEO_SHARED_aub_tests_configurations ${NEO_SHARED_aub_tests_configurations} PARENT_SCOPE)
|
||||
endif()
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/test_configuration/aub_tests/aub_tests_configuration.h"
|
||||
|
||||
#include "test.h"
|
||||
|
||||
#include "hw_cmds.h"
|
||||
using namespace NEO;
|
||||
|
||||
template <>
|
||||
AubTestsConfig GetAubTestsConfig<XE_HPC_COREFamily>() {
|
||||
AubTestsConfig aubTestsConfig;
|
||||
aubTestsConfig.testCanonicalAddress = false;
|
||||
return aubTestsConfig;
|
||||
}
|
||||
32
shared/test/common/xe_hpc_core/CMakeLists.txt
Normal file
32
shared/test/common/xe_hpc_core/CMakeLists.txt
Normal file
@@ -0,0 +1,32 @@
|
||||
#
|
||||
# Copyright (C) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
if(TESTS_XE_HPC_CORE)
|
||||
|
||||
set(NEO_CORE_TESTS_XE_HPC_CORE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/simd_helper_tests_xe_hpc_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_traits_xe_hpc_core.h
|
||||
)
|
||||
set_property(GLOBAL PROPERTY NEO_CORE_TESTS_XE_HPC_CORE ${NEO_CORE_TESTS_XE_HPC_CORE})
|
||||
|
||||
add_subdirectories()
|
||||
|
||||
set(IGDRCL_SRCS_tests_xe_hpc_core_excludes
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/excludes_xe_hpc_core.cpp
|
||||
)
|
||||
set_property(GLOBAL APPEND PROPERTY IGDRCL_SRCS_tests_excludes ${IGDRCL_SRCS_tests_xe_hpc_core_excludes})
|
||||
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
${IGDRCL_SRCS_tests_xe_hpc_core_excludes}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/image_surface_state_tests_xe_hpc_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_encode_xe_hpc_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_preemption_xe_hpc_core.cpp
|
||||
${COMPUTE_RUNTIME_ULT_XE_HPC_CORE}
|
||||
)
|
||||
|
||||
endif()
|
||||
112
shared/test/common/xe_hpc_core/cmd_parse_xe_hpc_core.cpp
Normal file
112
shared/test/common/xe_hpc_core/cmd_parse_xe_hpc_core.cpp
Normal file
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/xe_hpc_core/hw_cmds.h"
|
||||
using GenStruct = NEO::XE_HPC_CORE;
|
||||
using GenGfxFamily = NEO::XE_HPC_COREFamily;
|
||||
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
|
||||
using MI_MEM_FENCE = GenStruct::MI_MEM_FENCE;
|
||||
using STATE_SYSTEM_MEM_FENCE_ADDRESS = GenStruct::STATE_SYSTEM_MEM_FENCE_ADDRESS;
|
||||
using STATE_PREFETCH = GenStruct::STATE_PREFETCH;
|
||||
using MEM_SET = GenStruct::MEM_SET;
|
||||
|
||||
template <>
|
||||
MI_MEM_FENCE *genCmdCast<MI_MEM_FENCE *>(void *buffer) {
|
||||
auto pCmd = reinterpret_cast<MI_MEM_FENCE *>(buffer);
|
||||
|
||||
return (0x0 == pCmd->TheStructure.Common.MiCommandSubOpcode &&
|
||||
0x9 == pCmd->TheStructure.Common.MiCommandOpcode &&
|
||||
0x0 == pCmd->TheStructure.Common.CommandType)
|
||||
? pCmd
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
STATE_SYSTEM_MEM_FENCE_ADDRESS *genCmdCast<STATE_SYSTEM_MEM_FENCE_ADDRESS *>(void *buffer) {
|
||||
auto pCmd = reinterpret_cast<STATE_SYSTEM_MEM_FENCE_ADDRESS *>(buffer);
|
||||
|
||||
return (0x1 == pCmd->TheStructure.Common.DwordLength &&
|
||||
0x9 == pCmd->TheStructure.Common._3DCommandSubOpcode &&
|
||||
0x1 == pCmd->TheStructure.Common._3DCommandOpcode &&
|
||||
0x0 == pCmd->TheStructure.Common.CommandSubType &&
|
||||
0x3 == pCmd->TheStructure.Common.CommandType)
|
||||
? pCmd
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
STATE_PREFETCH *genCmdCast<STATE_PREFETCH *>(void *buffer) {
|
||||
auto pCmd = reinterpret_cast<STATE_PREFETCH *>(buffer);
|
||||
|
||||
return (0x2 == pCmd->TheStructure.Common.DwordLength &&
|
||||
0x3 == pCmd->TheStructure.Common._3dCommandSubOpcode &&
|
||||
0x0 == pCmd->TheStructure.Common._3dCommandOpcode &&
|
||||
0x0 == pCmd->TheStructure.Common.CommandSubType &&
|
||||
0x3 == pCmd->TheStructure.Common.CommandType)
|
||||
? pCmd
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
MEM_SET *genCmdCast<MEM_SET *>(void *buffer) {
|
||||
auto pCmd = reinterpret_cast<MEM_SET *>(buffer);
|
||||
|
||||
return (0x5 == pCmd->TheStructure.Common.DwordLength &&
|
||||
0x5B == pCmd->TheStructure.Common.InstructionTarget_Opcode &&
|
||||
0x2 == pCmd->TheStructure.Common.Client)
|
||||
? pCmd
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
size_t CmdParse<GenGfxFamily>::getAdditionalCommandLength(void *cmd) {
|
||||
{
|
||||
if (genCmdCast<MI_MEM_FENCE *>(cmd)) {
|
||||
return sizeof(MI_MEM_FENCE) / sizeof(uint32_t);
|
||||
}
|
||||
}
|
||||
{
|
||||
if (genCmdCast<STATE_SYSTEM_MEM_FENCE_ADDRESS *>(cmd)) {
|
||||
return sizeof(STATE_SYSTEM_MEM_FENCE_ADDRESS) / sizeof(uint32_t);
|
||||
}
|
||||
}
|
||||
{
|
||||
if (genCmdCast<STATE_PREFETCH *>(cmd)) {
|
||||
return sizeof(STATE_PREFETCH) / sizeof(uint32_t);
|
||||
}
|
||||
}
|
||||
{
|
||||
if (genCmdCast<MEM_SET *>(cmd)) {
|
||||
return sizeof(MEM_SET) / sizeof(uint32_t);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <>
|
||||
const char *CmdParse<GenGfxFamily>::getAdditionalCommandName(void *cmd) {
|
||||
|
||||
if (genCmdCast<MI_MEM_FENCE *>(cmd)) {
|
||||
return "MI_MEM_FENCE";
|
||||
}
|
||||
if (genCmdCast<STATE_SYSTEM_MEM_FENCE_ADDRESS *>(cmd)) {
|
||||
return "STATE_SYSTEM_MEM_FENCE_ADDRESS";
|
||||
}
|
||||
if (genCmdCast<STATE_PREFETCH *>(cmd)) {
|
||||
return "STATE_PREFETCH";
|
||||
}
|
||||
if (genCmdCast<MEM_SET *>(cmd)) {
|
||||
return "MEM_SET";
|
||||
}
|
||||
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
||||
#include "shared/test/common/cmd_parse/cmd_parse_pvc_and_later.inl"
|
||||
14
shared/test/common/xe_hpc_core/excludes_xe_hpc_core.cpp
Normal file
14
shared/test/common/xe_hpc_core/excludes_xe_hpc_core.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "test.h"
|
||||
|
||||
HWTEST_EXCLUDE_PRODUCT(CommandEncodeStatesTest, givenSlmTotalSizeEqualZeroWhenDispatchingKernelThenSharedMemorySizeIsSetCorrectly, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(CommandEncodeStatesTest, givenOverrideSlmTotalSizeDebugVariableWhenDispatchingKernelThenSharedMemorySizeIsSetCorrectly, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(WalkerPartitionTests, givenMiAtomicWhenItIsProgrammedThenAllFieldsAreSetCorrectly, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(WalkerPartitionTests, givenProgramBatchBufferStartCommandWhenItIsCalledThenCommandIsProgrammedCorrectly, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(XeHPAndLaterPreemptionTests, GivenDebuggerUsedWhenProgrammingStateSipThenStateSipIsAdded, IGFX_XE_HPC_CORE);
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/unit_test/image/image_surface_state_fixture.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using ImageSurfaceStateTestsXeHpcCore = ImageSurfaceStateTests;
|
||||
|
||||
XE_HPC_CORETEST_F(ImageSurfaceStateTestsXeHpcCore, givenGmmWithMediaCompressedWhenSetFlagsForMediaCompressionThenAuxiliarySurfaceNoneIsSetAndMemoryCompressionEnable) {
|
||||
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);
|
||||
EXPECT_EQ(castSurfaceState->getMemoryCompressionEnable(), false);
|
||||
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);
|
||||
EXPECT_EQ(castSurfaceState->getMemoryCompressionEnable(), true);
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(ImageSurfaceStateTestsXeHpcCore, givenGmmWhenSetClearColorParamsThenClearValueAddressEnable) {
|
||||
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());
|
||||
|
||||
mockGmm->gmmResourceInfo->getResourceFlags()->Gpu.IndirectClearColor = true;
|
||||
EncodeSurfaceState<FamilyType>::setClearColorParams(castSurfaceState, mockGmm.get());
|
||||
EXPECT_EQ(castSurfaceState->getClearValueAddressEnable(), true);
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(ImageSurfaceStateTestsXeHpcCore, 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);
|
||||
|
||||
EXPECT_EQ(castSurfaceState->getMipTailStartLod(), 0u);
|
||||
|
||||
setMipTailStartLod<FamilyType>(castSurfaceState, mockGmm.get());
|
||||
|
||||
EXPECT_EQ(castSurfaceState->getMipTailStartLod(), mockGmm->gmmResourceInfo->getMipTailStartLodSurfaceState());
|
||||
}
|
||||
15
shared/test/common/xe_hpc_core/pvc/CMakeLists.txt
Normal file
15
shared/test/common/xe_hpc_core/pvc/CMakeLists.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
#
|
||||
# Copyright (C) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
if(TESTS_PVC)
|
||||
set(NEO_CORE_TESTS_XE_HPC_CORE_PVC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_encode_dispatch_kernel_pvc.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_hw_helper_pvc.cpp
|
||||
)
|
||||
|
||||
target_sources(${TARGET_NAME} PRIVATE ${NEO_CORE_TESTS_XE_HPC_CORE_PVC})
|
||||
endif()
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_container/command_encoder.h"
|
||||
#include "shared/test/common/helpers/default_hw_info.h"
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
|
||||
#include "test.h"
|
||||
|
||||
#include "hw_cmds.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using CommandEncodeStatesPvcTest = ::testing::Test;
|
||||
|
||||
PVCTEST_F(CommandEncodeStatesPvcTest, GivenSmallSlmTotalSizesWhenSetAdditionalInfoIsCalledThenCorrectValuesAreSet) {
|
||||
using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA;
|
||||
using PREFERRED_SLM_SIZE_OVERRIDE = typename INTERFACE_DESCRIPTOR_DATA::PREFERRED_SLM_SIZE_OVERRIDE;
|
||||
using PREFERRED_SLM_ALLOCATION_SIZE_PER_DSS = typename INTERFACE_DESCRIPTOR_DATA::PREFERRED_SLM_ALLOCATION_SIZE_PER_DSS;
|
||||
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
uint32_t threadsCount = 1;
|
||||
uint32_t slmTotalSize = 0;
|
||||
|
||||
struct {
|
||||
unsigned short revisionId;
|
||||
bool isWaRequired;
|
||||
} revisionsToTest[] = {
|
||||
{0x0, true},
|
||||
{0x1, true},
|
||||
{0x2, true},
|
||||
{0x41, true},
|
||||
{0x3, false},
|
||||
{0x9d, false},
|
||||
};
|
||||
|
||||
for (auto &revisionToTest : revisionsToTest) {
|
||||
hwInfo.platform.usRevId = revisionToTest.revisionId;
|
||||
INTERFACE_DESCRIPTOR_DATA idd = FamilyType::cmdInitInterfaceDescriptorData;
|
||||
EncodeDispatchKernel<FamilyType>::appendAdditionalIDDFields(&idd, hwInfo, threadsCount, slmTotalSize, SlmPolicy::SlmPolicyNone);
|
||||
if (revisionToTest.isWaRequired) {
|
||||
EXPECT_EQ(PREFERRED_SLM_ALLOCATION_SIZE_PER_DSS::PREFERRED_SLM_SIZE_IS_16K, idd.getPreferredSlmAllocationSizePerDss());
|
||||
} else {
|
||||
EXPECT_EQ(PREFERRED_SLM_ALLOCATION_SIZE_PER_DSS::PREFERRED_SLM_SIZE_IS_0K, idd.getPreferredSlmAllocationSizePerDss());
|
||||
}
|
||||
}
|
||||
}
|
||||
61
shared/test/common/xe_hpc_core/pvc/test_hw_helper_pvc.cpp
Normal file
61
shared/test/common/xe_hpc_core/pvc/test_hw_helper_pvc.cpp
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/test/common/helpers/default_hw_info.h"
|
||||
#include "shared/test/common/helpers/hw_helper_tests.h"
|
||||
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
using HwHelperTestPvc = ::testing::Test;
|
||||
|
||||
PVCTEST_F(HwHelperTestPvc, givenSlmSizeWhenEncodingThenReturnCorrectValues) {
|
||||
ComputeSlmTestInput computeSlmValuesPvcAndLaterTestsInput[] = {
|
||||
{0, 0 * KB},
|
||||
{1, 0 * KB + 1},
|
||||
{1, 1 * KB},
|
||||
{2, 1 * KB + 1},
|
||||
{2, 2 * KB},
|
||||
{3, 2 * KB + 1},
|
||||
{3, 4 * KB},
|
||||
{4, 4 * KB + 1},
|
||||
{4, 8 * KB},
|
||||
{5, 8 * KB + 1},
|
||||
{5, 16 * KB},
|
||||
{8, 16 * KB + 1},
|
||||
{8, 24 * KB},
|
||||
{6, 24 * KB + 1},
|
||||
{6, 32 * KB},
|
||||
{9, 32 * KB + 1},
|
||||
{9, 48 * KB},
|
||||
{7, 48 * KB + 1},
|
||||
{7, 64 * KB},
|
||||
{10, 64 * KB + 1},
|
||||
{10, 96 * KB},
|
||||
{11, 96 * KB + 1},
|
||||
{11, 128 * KB}};
|
||||
|
||||
auto hwInfo = *defaultHwInfo;
|
||||
auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
|
||||
|
||||
for (auto &testInput : computeSlmValuesPvcAndLaterTestsInput) {
|
||||
EXPECT_EQ(testInput.expected, hwHelper.computeSlmValues(hwInfo, testInput.slmSize));
|
||||
}
|
||||
|
||||
EXPECT_THROW(hwHelper.computeSlmValues(hwInfo, 129 * KB), std::exception);
|
||||
}
|
||||
|
||||
PVCTEST_F(HwHelperTestPvc, WhenGettingIsCpuImageTransferPreferredThenTrueIsReturned) {
|
||||
auto &hwHelper = HwHelper::get(renderCoreFamily);
|
||||
EXPECT_TRUE(hwHelper.isCpuImageTransferPreferred(*defaultHwInfo));
|
||||
}
|
||||
|
||||
PVCTEST_F(HwHelperTestPvc, givenHwHelperWhenGettingISAPaddingThenCorrectValueIsReturned) {
|
||||
auto &hwHelper = NEO::HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily);
|
||||
EXPECT_EQ(hwHelper.getPaddingForISAAllocation(), 3584u);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/helpers/simd_helper_tests_pvc_and_later.inl"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using TestSimdConfigSet = ::testing::Test;
|
||||
|
||||
XE_HPC_CORETEST_F(TestSimdConfigSet, GivenSimdSizeWhenGetSimdConfigCalledThenCorrectEnumReturnedXeHpcCore) {
|
||||
GivenSimdSizeWhenGetSimdConfigCalledThenCorrectEnumReturnedPVCAndLater<typename FamilyType::COMPUTE_WALKER>::TestBodyImpl();
|
||||
}
|
||||
500
shared/test/common/xe_hpc_core/test_encode_xe_hpc_core.cpp
Normal file
500
shared/test/common/xe_hpc_core/test_encode_xe_hpc_core.cpp
Normal file
@@ -0,0 +1,500 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_container/command_encoder.h"
|
||||
#include "shared/source/command_container/memory_fence_encoder.h"
|
||||
#include "shared/source/command_stream/stream_properties.h"
|
||||
#include "shared/source/gmm_helper/gmm.h"
|
||||
#include "shared/source/gmm_helper/gmm_helper.h"
|
||||
#include "shared/source/kernel/kernel_descriptor.h"
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/common/fixtures/command_container_fixture.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/default_hw_info.h"
|
||||
#include "shared/test/common/mocks/mock_dispatch_kernel_encoder_interface.h"
|
||||
|
||||
#include "test.h"
|
||||
|
||||
#include "hw_cmds.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
HWTEST_EXCLUDE_PRODUCT(XeHPAndLaterEncodeMiFlushDWTest, whenMiFlushDwIsProgrammedThenSetFlushCcsAndLlc, IGFX_XE_HPC_CORE);
|
||||
HWTEST_EXCLUDE_PRODUCT(CommandEncoderTests, whenEncodeMemoryPrefetchCalledThenDoNothing, IGFX_XE_HPC_CORE);
|
||||
|
||||
using CommandEncodeXeHpcCoreTest = ::testing::Test;
|
||||
|
||||
XE_HPC_CORETEST_F(CommandEncodeXeHpcCoreTest, whenMiFlushDwIsProgrammedThenSetAndFlushLlcWithoutCcs) {
|
||||
using MI_FLUSH_DW = typename FamilyType::MI_FLUSH_DW;
|
||||
uint8_t buffer[2 * sizeof(MI_FLUSH_DW)] = {};
|
||||
LinearStream linearStream(buffer, sizeof(buffer));
|
||||
|
||||
MiFlushArgs args;
|
||||
args.commandWithPostSync = true;
|
||||
EncodeMiFlushDW<FamilyType>::programMiFlushDw(linearStream, 0x1230000, 456, args);
|
||||
auto miFlushDwCmd = reinterpret_cast<MI_FLUSH_DW *>(buffer);
|
||||
EXPECT_EQ(0u, miFlushDwCmd->getFlushCcs());
|
||||
EXPECT_EQ(1u, miFlushDwCmd->getFlushLlc());
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(CommandEncodeXeHpcCoreTest, givenOffsetWhenProgrammingStatePrefetchThenSetCorrectGpuVa) {
|
||||
using STATE_PREFETCH = typename FamilyType::STATE_PREFETCH;
|
||||
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
hwInfo.platform.usRevId = 0b0011'1000; // [3:5] - BaseDie != A0
|
||||
|
||||
uint8_t buffer[sizeof(STATE_PREFETCH) * 4] = {};
|
||||
auto statePrefetchCmd = reinterpret_cast<STATE_PREFETCH *>(buffer);
|
||||
|
||||
constexpr uint64_t gpuVa = 0x100000;
|
||||
constexpr uint32_t gpuVaOffset = 0x10000;
|
||||
|
||||
const GraphicsAllocation allocation(0, GraphicsAllocation::AllocationType::BUFFER, nullptr, gpuVa, 0, 4096, MemoryPool::LocalMemory, MemoryManager::maxOsContextCount);
|
||||
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
LinearStream linearStream(buffer, sizeof(buffer));
|
||||
|
||||
uint32_t expectedCmdsCount = 3;
|
||||
uint32_t alignedSize = MemoryConstants::pageSize64k * expectedCmdsCount;
|
||||
|
||||
EncodeMemoryPrefetch<FamilyType>::programMemoryPrefetch(linearStream, allocation, alignedSize, gpuVaOffset, hwInfo);
|
||||
EXPECT_EQ(sizeof(STATE_PREFETCH) * expectedCmdsCount, linearStream.getUsed());
|
||||
|
||||
for (uint32_t i = 0; i < expectedCmdsCount; i++) {
|
||||
uint64_t expectedVa = gpuVa + gpuVaOffset + (i * MemoryConstants::pageSize64k);
|
||||
EXPECT_EQ(expectedVa, statePrefetchCmd[i].getAddress());
|
||||
}
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(CommandEncodeXeHpcCoreTest, givenDebugVariableSetwhenProgramingStatePrefetchThenSetCorrectFields) {
|
||||
using STATE_PREFETCH = typename FamilyType::STATE_PREFETCH;
|
||||
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
hwInfo.platform.usRevId = 0b0011'1000; // [3:5] - BaseDie != A0
|
||||
|
||||
uint8_t buffer[sizeof(STATE_PREFETCH) * 4] = {};
|
||||
auto statePrefetchCmd = reinterpret_cast<STATE_PREFETCH *>(buffer);
|
||||
|
||||
constexpr uint64_t gpuVa = 0x100000;
|
||||
constexpr uint32_t mocsIndexForL3 = (2 << 1);
|
||||
constexpr size_t numCachelines = 3;
|
||||
|
||||
const GraphicsAllocation allocation(0, GraphicsAllocation::AllocationType::BUFFER, nullptr, gpuVa, 0, 4096, MemoryPool::LocalMemory, MemoryManager::maxOsContextCount);
|
||||
|
||||
constexpr std::array<uint32_t, 7> expectedSizes = {{
|
||||
MemoryConstants::cacheLineSize - 1,
|
||||
MemoryConstants::cacheLineSize,
|
||||
MemoryConstants::cacheLineSize + 1,
|
||||
MemoryConstants::cacheLineSize * numCachelines,
|
||||
MemoryConstants::pageSize64k - 1,
|
||||
MemoryConstants::pageSize64k,
|
||||
(MemoryConstants::pageSize64k * 2) + 1,
|
||||
}};
|
||||
|
||||
for (auto expectedSize : expectedSizes) {
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
LinearStream linearStream(buffer, sizeof(buffer));
|
||||
|
||||
uint32_t alignedSize = alignUp(expectedSize, MemoryConstants::pageSize64k);
|
||||
uint32_t expectedCmdsCount = std::max((alignedSize / static_cast<uint32_t>(MemoryConstants::pageSize64k)), 1u);
|
||||
|
||||
EXPECT_EQ(sizeof(STATE_PREFETCH) * expectedCmdsCount, EncodeMemoryPrefetch<FamilyType>::getSizeForMemoryPrefetch(expectedSize));
|
||||
|
||||
EncodeMemoryPrefetch<FamilyType>::programMemoryPrefetch(linearStream, allocation, expectedSize, 0, hwInfo);
|
||||
EXPECT_EQ(sizeof(STATE_PREFETCH) * expectedCmdsCount, linearStream.getUsed());
|
||||
|
||||
for (uint32_t i = 0; i < expectedCmdsCount; i++) {
|
||||
uint32_t programmedSize = (statePrefetchCmd[i].getPrefetchSize() + 1) * MemoryConstants::cacheLineSize;
|
||||
|
||||
EXPECT_EQ(statePrefetchCmd[i].getAddress(), gpuVa + (i * MemoryConstants::pageSize64k));
|
||||
EXPECT_FALSE(statePrefetchCmd[i].getKernelInstructionPrefetch());
|
||||
EXPECT_FALSE(statePrefetchCmd[i].getParserStall());
|
||||
EXPECT_EQ(mocsIndexForL3, statePrefetchCmd[i].getMemoryObjectControlState());
|
||||
|
||||
if (programmedSize > expectedSize) {
|
||||
// cacheline alignemnt
|
||||
EXPECT_TRUE((programmedSize - expectedSize) < MemoryConstants::cacheLineSize);
|
||||
expectedSize = 0;
|
||||
} else {
|
||||
expectedSize -= programmedSize;
|
||||
}
|
||||
}
|
||||
EXPECT_EQ(0u, expectedSize);
|
||||
}
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(CommandEncodeXeHpcCoreTest, givenIsaAllocationWhenProgrammingPrefetchThenSetKernelInstructionPrefetchBit) {
|
||||
using STATE_PREFETCH = typename FamilyType::STATE_PREFETCH;
|
||||
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
hwInfo.platform.usRevId = 0b0011'1000; // [3:5] - BaseDie != A0
|
||||
|
||||
uint8_t buffer[sizeof(STATE_PREFETCH)] = {};
|
||||
auto statePrefetchCmd = reinterpret_cast<STATE_PREFETCH *>(buffer);
|
||||
|
||||
EXPECT_EQ(sizeof(STATE_PREFETCH), EncodeMemoryPrefetch<FamilyType>::getSizeForMemoryPrefetch(1));
|
||||
|
||||
GraphicsAllocation::AllocationType isaTypes[] = {GraphicsAllocation::AllocationType::KERNEL_ISA, GraphicsAllocation::AllocationType::KERNEL_ISA_INTERNAL};
|
||||
|
||||
for (uint32_t i = 0; i < 2; i++) {
|
||||
memset(buffer, 0, sizeof(STATE_PREFETCH));
|
||||
LinearStream linearStream(buffer, sizeof(buffer));
|
||||
|
||||
const GraphicsAllocation allocation(0, isaTypes[i],
|
||||
nullptr, 1234, 0, 4096, MemoryPool::LocalMemory, MemoryManager::maxOsContextCount);
|
||||
|
||||
EncodeMemoryPrefetch<FamilyType>::programMemoryPrefetch(linearStream, allocation, 123, 0, hwInfo);
|
||||
EXPECT_EQ(sizeof(STATE_PREFETCH), linearStream.getUsed());
|
||||
|
||||
EXPECT_TRUE(statePrefetchCmd->getKernelInstructionPrefetch());
|
||||
}
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(CommandEncodeXeHpcCoreTest, givenDebugFlagSetWhenProgramPrefetchCalledThenDoPrefetchIfSetToOne) {
|
||||
using STATE_PREFETCH = typename FamilyType::STATE_PREFETCH;
|
||||
DebugManagerStateRestore restore;
|
||||
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
hwInfo.platform.usRevId = 0b0011'1000; // [3:5] - BaseDie != A0
|
||||
|
||||
uint8_t buffer[sizeof(STATE_PREFETCH)] = {};
|
||||
|
||||
GraphicsAllocation::AllocationType isaTypes[] = {GraphicsAllocation::AllocationType::KERNEL_ISA, GraphicsAllocation::AllocationType::KERNEL_ISA_INTERNAL};
|
||||
|
||||
for (uint32_t i = 0; i < 2; i++) {
|
||||
memset(buffer, 0, sizeof(STATE_PREFETCH));
|
||||
const GraphicsAllocation allocation(0, isaTypes[i],
|
||||
nullptr, 1234, 0, 4096, MemoryPool::LocalMemory, MemoryManager::maxOsContextCount);
|
||||
|
||||
LinearStream linearStream(buffer, sizeof(buffer));
|
||||
|
||||
DebugManager.flags.EnableMemoryPrefetch.set(0);
|
||||
EXPECT_EQ(0u, EncodeMemoryPrefetch<FamilyType>::getSizeForMemoryPrefetch(100));
|
||||
EncodeMemoryPrefetch<FamilyType>::programMemoryPrefetch(linearStream, allocation, 100, 0, hwInfo);
|
||||
EXPECT_EQ(0u, linearStream.getUsed());
|
||||
|
||||
DebugManager.flags.EnableMemoryPrefetch.set(1);
|
||||
EncodeMemoryPrefetch<FamilyType>::programMemoryPrefetch(linearStream, allocation, 123, 0, hwInfo);
|
||||
EXPECT_EQ(sizeof(STATE_PREFETCH), linearStream.getUsed());
|
||||
auto statePrefetchCmd = reinterpret_cast<STATE_PREFETCH *>(buffer);
|
||||
EXPECT_TRUE(statePrefetchCmd->getKernelInstructionPrefetch());
|
||||
}
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(CommandEncodeXeHpcCoreTest, givenSteppingWhenProgrammingPrefetchThenProgramOnlyAboveAzero) {
|
||||
using STATE_PREFETCH = typename FamilyType::STATE_PREFETCH;
|
||||
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
hwInfo.platform.usRevId = 0b0100'0111; // [3:5] - BaseDie == A0;
|
||||
|
||||
const GraphicsAllocation allocation(0, GraphicsAllocation::AllocationType::KERNEL_ISA,
|
||||
nullptr, 1234, 0, 4096, MemoryPool::LocalMemory, MemoryManager::maxOsContextCount);
|
||||
uint8_t buffer[sizeof(STATE_PREFETCH)] = {};
|
||||
|
||||
LinearStream linearStream(buffer, sizeof(buffer));
|
||||
|
||||
EncodeMemoryPrefetch<FamilyType>::programMemoryPrefetch(linearStream, allocation, 123, 0, hwInfo);
|
||||
EXPECT_EQ(0u, linearStream.getUsed());
|
||||
|
||||
hwInfo.platform.usRevId = 0b0010'1000; // [3:5] - BaseDie != A0
|
||||
EncodeMemoryPrefetch<FamilyType>::programMemoryPrefetch(linearStream, allocation, 123, 0, hwInfo);
|
||||
EXPECT_EQ(sizeof(STATE_PREFETCH), linearStream.getUsed());
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(CommandEncodeXeHpcCoreTest, givenDebugFlagSetWhenProgrammingPrefetchThenSetParserStall) {
|
||||
using STATE_PREFETCH = typename FamilyType::STATE_PREFETCH;
|
||||
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.ForceCsStallForStatePrefetch.set(1);
|
||||
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
hwInfo.platform.usRevId = 0b0010'1000; // [3:5] - BaseDie != A0
|
||||
|
||||
const GraphicsAllocation allocation(0, GraphicsAllocation::AllocationType::BUFFER,
|
||||
nullptr, 1234, 0, 4096, MemoryPool::LocalMemory, MemoryManager::maxOsContextCount);
|
||||
uint8_t buffer[sizeof(STATE_PREFETCH)] = {};
|
||||
|
||||
LinearStream linearStream(buffer, sizeof(buffer));
|
||||
|
||||
EncodeMemoryPrefetch<FamilyType>::programMemoryPrefetch(linearStream, allocation, 123, 0, hwInfo);
|
||||
|
||||
auto statePrefetchCmd = reinterpret_cast<STATE_PREFETCH *>(buffer);
|
||||
|
||||
EXPECT_TRUE(statePrefetchCmd->getParserStall());
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(CommandEncodeXeHpcCoreTest, whenProgrammingStateComputeModeThenProperFieldsAreSet) {
|
||||
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
|
||||
using EU_THREAD_SCHEDULING_MODE_OVERRIDE = typename STATE_COMPUTE_MODE::EU_THREAD_SCHEDULING_MODE_OVERRIDE;
|
||||
uint8_t buffer[64]{};
|
||||
|
||||
StateComputeModeProperties properties;
|
||||
auto pLinearStream = std::make_unique<LinearStream>(buffer, sizeof(buffer));
|
||||
EncodeComputeMode<FamilyType>::adjustComputeMode(*pLinearStream, nullptr, properties, *defaultHwInfo);
|
||||
auto pScm = reinterpret_cast<STATE_COMPUTE_MODE *>(pLinearStream->getCpuBase());
|
||||
EXPECT_EQ(0u, pScm->getMaskBits());
|
||||
EXPECT_EQ(STATE_COMPUTE_MODE::FORCE_NON_COHERENT_FORCE_DISABLED, pScm->getForceNonCoherent());
|
||||
EXPECT_EQ(EU_THREAD_SCHEDULING_MODE_OVERRIDE::EU_THREAD_SCHEDULING_MODE_OVERRIDE_HW_DEFAULT, pScm->getEuThreadSchedulingModeOverride());
|
||||
EXPECT_FALSE(pScm->getLargeGrfMode());
|
||||
|
||||
properties.isCoherencyRequired.value = 0;
|
||||
properties.threadArbitrationPolicy.value = ThreadArbitrationPolicy::RoundRobin;
|
||||
properties.largeGrfMode.value = 1;
|
||||
pLinearStream = std::make_unique<LinearStream>(buffer, sizeof(buffer));
|
||||
EncodeComputeMode<FamilyType>::adjustComputeMode(*pLinearStream, nullptr, properties, *defaultHwInfo);
|
||||
pScm = reinterpret_cast<STATE_COMPUTE_MODE *>(pLinearStream->getCpuBase());
|
||||
EXPECT_EQ(0u, pScm->getMaskBits());
|
||||
EXPECT_EQ(STATE_COMPUTE_MODE::FORCE_NON_COHERENT_FORCE_DISABLED, pScm->getForceNonCoherent());
|
||||
EXPECT_EQ(EU_THREAD_SCHEDULING_MODE_OVERRIDE::EU_THREAD_SCHEDULING_MODE_OVERRIDE_HW_DEFAULT, pScm->getEuThreadSchedulingModeOverride());
|
||||
EXPECT_FALSE(pScm->getLargeGrfMode());
|
||||
|
||||
properties.isCoherencyRequired.isDirty = true;
|
||||
properties.threadArbitrationPolicy.isDirty = true;
|
||||
properties.largeGrfMode.isDirty = true;
|
||||
pLinearStream = std::make_unique<LinearStream>(buffer, sizeof(buffer));
|
||||
EncodeComputeMode<FamilyType>::adjustComputeMode(*pLinearStream, nullptr, properties, *defaultHwInfo);
|
||||
pScm = reinterpret_cast<STATE_COMPUTE_MODE *>(pLinearStream->getCpuBase());
|
||||
auto expectedMask = FamilyType::stateComputeModeForceNonCoherentMask | FamilyType::stateComputeModeEuThreadSchedulingModeOverrideMask |
|
||||
FamilyType::stateComputeModeLargeGrfModeMask;
|
||||
EXPECT_EQ(expectedMask, pScm->getMaskBits());
|
||||
EXPECT_EQ(STATE_COMPUTE_MODE::FORCE_NON_COHERENT_FORCE_GPU_NON_COHERENT, pScm->getForceNonCoherent());
|
||||
EXPECT_EQ(EU_THREAD_SCHEDULING_MODE_OVERRIDE::EU_THREAD_SCHEDULING_MODE_OVERRIDE_ROUND_ROBIN, pScm->getEuThreadSchedulingModeOverride());
|
||||
EXPECT_TRUE(pScm->getLargeGrfMode());
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(CommandEncodeXeHpcCoreTest, whenAdjustComputeModeIsCalledThenCorrectPolicyIsProgrammed) {
|
||||
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
|
||||
using EU_THREAD_SCHEDULING_MODE_OVERRIDE = typename STATE_COMPUTE_MODE::EU_THREAD_SCHEDULING_MODE_OVERRIDE;
|
||||
|
||||
uint8_t buffer[64]{};
|
||||
StreamProperties properties{};
|
||||
|
||||
auto pLinearStream = std::make_unique<LinearStream>(buffer, sizeof(buffer));
|
||||
properties.stateComputeMode.setProperties(false, 0, ThreadArbitrationPolicy::AgeBased);
|
||||
EncodeComputeMode<FamilyType>::adjustComputeMode(*pLinearStream, nullptr, properties.stateComputeMode, *defaultHwInfo);
|
||||
auto pScm = reinterpret_cast<STATE_COMPUTE_MODE *>(pLinearStream->getCpuBase());
|
||||
EXPECT_EQ(EU_THREAD_SCHEDULING_MODE_OVERRIDE::EU_THREAD_SCHEDULING_MODE_OVERRIDE_OLDEST_FIRST, pScm->getEuThreadSchedulingModeOverride());
|
||||
|
||||
pLinearStream = std::make_unique<LinearStream>(buffer, sizeof(buffer));
|
||||
properties.stateComputeMode.setProperties(false, 0, ThreadArbitrationPolicy::RoundRobin);
|
||||
EncodeComputeMode<FamilyType>::adjustComputeMode(*pLinearStream, nullptr, properties.stateComputeMode, *defaultHwInfo);
|
||||
pScm = reinterpret_cast<STATE_COMPUTE_MODE *>(pLinearStream->getCpuBase());
|
||||
EXPECT_EQ(EU_THREAD_SCHEDULING_MODE_OVERRIDE::EU_THREAD_SCHEDULING_MODE_OVERRIDE_ROUND_ROBIN, pScm->getEuThreadSchedulingModeOverride());
|
||||
|
||||
pLinearStream = std::make_unique<LinearStream>(buffer, sizeof(buffer));
|
||||
properties.stateComputeMode.setProperties(false, 0, ThreadArbitrationPolicy::RoundRobinAfterDependency);
|
||||
EncodeComputeMode<FamilyType>::adjustComputeMode(*pLinearStream, nullptr, properties.stateComputeMode, *defaultHwInfo);
|
||||
pScm = reinterpret_cast<STATE_COMPUTE_MODE *>(pLinearStream->getCpuBase());
|
||||
EXPECT_EQ(EU_THREAD_SCHEDULING_MODE_OVERRIDE::EU_THREAD_SCHEDULING_MODE_OVERRIDE_STALL_BASED_ROUND_ROBIN, pScm->getEuThreadSchedulingModeOverride());
|
||||
|
||||
pLinearStream = std::make_unique<LinearStream>(buffer, sizeof(buffer));
|
||||
properties.stateComputeMode.setProperties(false, 0, ThreadArbitrationPolicy::NotPresent);
|
||||
EncodeComputeMode<FamilyType>::adjustComputeMode(*pLinearStream, nullptr, properties.stateComputeMode, *defaultHwInfo);
|
||||
pScm = reinterpret_cast<STATE_COMPUTE_MODE *>(pLinearStream->getCpuBase());
|
||||
EXPECT_EQ(EU_THREAD_SCHEDULING_MODE_OVERRIDE::EU_THREAD_SCHEDULING_MODE_OVERRIDE_HW_DEFAULT, pScm->getEuThreadSchedulingModeOverride());
|
||||
}
|
||||
|
||||
using EncodeKernelXeHpcCoreTest = Test<CommandEncodeStatesFixture>;
|
||||
|
||||
XE_HPC_CORETEST_F(EncodeKernelXeHpcCoreTest, givenNoFenceAsPostSyncOperationInComputeWalkerWhenEnqueueKernelIsCalledThenDoNotGenerateFenceCommands) {
|
||||
using WALKER_TYPE = typename FamilyType::WALKER_TYPE;
|
||||
using MI_MEM_FENCE = typename FamilyType::MI_MEM_FENCE;
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.ProgramGlobalFenceAsPostSyncOperationInComputeWalker.set(0);
|
||||
|
||||
uint32_t dims[] = {1, 1, 1};
|
||||
std::unique_ptr<MockDispatchKernelEncoder> dispatchInterface(new MockDispatchKernelEncoder());
|
||||
|
||||
EXPECT_CALL(*dispatchInterface.get(), getCrossThreadDataSize()).WillRepeatedly(::testing::Return(0));
|
||||
|
||||
bool requiresUncachedMocs = false;
|
||||
uint32_t partitionCount = 0;
|
||||
EncodeDispatchKernel<FamilyType>::encode(*cmdContainer.get(), dims, false, false, dispatchInterface.get(), 0, false, false,
|
||||
pDevice, NEO::PreemptionMode::Disabled, requiresUncachedMocs, false, partitionCount,
|
||||
false, false);
|
||||
|
||||
GenCmdList commands;
|
||||
CmdParse<FamilyType>::parseCommandBuffer(commands, ptrOffset(cmdContainer->getCommandStream()->getCpuBase(), 0), cmdContainer->getCommandStream()->getUsed());
|
||||
|
||||
auto itor = find<WALKER_TYPE *>(commands.begin(), commands.end());
|
||||
ASSERT_NE(itor, commands.end());
|
||||
|
||||
auto walkerCmd = genCmdCast<WALKER_TYPE *>(*itor);
|
||||
auto &postSyncData = walkerCmd->getPostSync();
|
||||
EXPECT_FALSE(postSyncData.getSystemMemoryFenceRequest());
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(EncodeKernelXeHpcCoreTest, givenFenceAsPostSyncOperationInComputeWalkerWhenEnqueueKernelIsCalledThenGenerateFenceCommands) {
|
||||
using WALKER_TYPE = typename FamilyType::WALKER_TYPE;
|
||||
using MI_MEM_FENCE = typename FamilyType::MI_MEM_FENCE;
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.ProgramGlobalFenceAsPostSyncOperationInComputeWalker.set(1);
|
||||
|
||||
uint32_t dims[] = {1, 1, 1};
|
||||
std::unique_ptr<MockDispatchKernelEncoder> dispatchInterface(new MockDispatchKernelEncoder());
|
||||
|
||||
EXPECT_CALL(*dispatchInterface.get(), getCrossThreadDataSize()).WillRepeatedly(::testing::Return(0));
|
||||
|
||||
bool requiresUncachedMocs = false;
|
||||
uint32_t partitionCount = 0;
|
||||
EncodeDispatchKernel<FamilyType>::encode(*cmdContainer.get(), dims, false, false, dispatchInterface.get(), 0, false, false,
|
||||
pDevice, NEO::PreemptionMode::Disabled, requiresUncachedMocs, false, partitionCount,
|
||||
false, false);
|
||||
|
||||
GenCmdList commands;
|
||||
CmdParse<FamilyType>::parseCommandBuffer(commands, ptrOffset(cmdContainer->getCommandStream()->getCpuBase(), 0), cmdContainer->getCommandStream()->getUsed());
|
||||
|
||||
auto itor = find<WALKER_TYPE *>(commands.begin(), commands.end());
|
||||
ASSERT_NE(itor, commands.end());
|
||||
|
||||
auto walkerCmd = genCmdCast<WALKER_TYPE *>(*itor);
|
||||
auto &postSyncData = walkerCmd->getPostSync();
|
||||
EXPECT_TRUE(postSyncData.getSystemMemoryFenceRequest());
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(EncodeKernelXeHpcCoreTest, givenDefaultSettingForFenceAsPostSyncOperationInComputeWalkerWhenEnqueueKernelIsCalledThenDoNotGenerateFenceCommands) {
|
||||
using WALKER_TYPE = typename FamilyType::WALKER_TYPE;
|
||||
using MI_MEM_FENCE = typename FamilyType::MI_MEM_FENCE;
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.ProgramGlobalFenceAsPostSyncOperationInComputeWalker.set(-1);
|
||||
|
||||
uint32_t dims[] = {1, 1, 1};
|
||||
std::unique_ptr<MockDispatchKernelEncoder> dispatchInterface(new MockDispatchKernelEncoder());
|
||||
|
||||
EXPECT_CALL(*dispatchInterface.get(), getCrossThreadDataSize()).WillRepeatedly(::testing::Return(0));
|
||||
|
||||
bool requiresUncachedMocs = false;
|
||||
uint32_t partitionCount = 0;
|
||||
EncodeDispatchKernel<FamilyType>::encode(*cmdContainer.get(), dims, false, false, dispatchInterface.get(), 0, false, false,
|
||||
pDevice, NEO::PreemptionMode::Disabled, requiresUncachedMocs, false, partitionCount,
|
||||
false, false);
|
||||
|
||||
GenCmdList commands;
|
||||
CmdParse<FamilyType>::parseCommandBuffer(commands, ptrOffset(cmdContainer->getCommandStream()->getCpuBase(), 0), cmdContainer->getCommandStream()->getUsed());
|
||||
|
||||
auto itor = find<WALKER_TYPE *>(commands.begin(), commands.end());
|
||||
ASSERT_NE(itor, commands.end());
|
||||
|
||||
auto walkerCmd = genCmdCast<WALKER_TYPE *>(*itor);
|
||||
auto &postSyncData = walkerCmd->getPostSync();
|
||||
EXPECT_FALSE(postSyncData.getSystemMemoryFenceRequest());
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(EncodeKernelXeHpcCoreTest, givenCleanHeapsAndSlmNotChangedAndUncachedMocsRequestedThenSBAIsProgrammedAndMocsAreSet) {
|
||||
uint32_t dims[] = {2, 1, 1};
|
||||
std::unique_ptr<MockDispatchKernelEncoder> dispatchInterface(new MockDispatchKernelEncoder());
|
||||
cmdContainer->slmSize = 1;
|
||||
EXPECT_CALL(*dispatchInterface.get(), getSlmTotalSize()).WillRepeatedly(::testing::Return(cmdContainer->slmSize));
|
||||
cmdContainer->setDirtyStateForAllHeaps(false);
|
||||
|
||||
bool requiresUncachedMocs = true;
|
||||
uint32_t partitionCount = 0;
|
||||
EncodeDispatchKernel<FamilyType>::encode(*cmdContainer.get(), dims, false, false, dispatchInterface.get(), 0, false, false,
|
||||
pDevice, NEO::PreemptionMode::Disabled, requiresUncachedMocs, false, partitionCount,
|
||||
false, false);
|
||||
|
||||
GenCmdList commands;
|
||||
CmdParse<FamilyType>::parseCommandBuffer(commands, ptrOffset(cmdContainer->getCommandStream()->getCpuBase(), 0), cmdContainer->getCommandStream()->getUsed());
|
||||
|
||||
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
|
||||
auto itor = find<STATE_BASE_ADDRESS *>(commands.begin(), commands.end());
|
||||
ASSERT_NE(commands.end(), itor);
|
||||
|
||||
auto cmdSba = genCmdCast<STATE_BASE_ADDRESS *>(*itor);
|
||||
auto gmmHelper = cmdContainer->getDevice()->getGmmHelper();
|
||||
EXPECT_EQ(cmdSba->getStatelessDataPortAccessMemoryObjectControlState(),
|
||||
(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED)));
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(EncodeKernelXeHpcCoreTest, givenStreamWhenEncodingSystemMemoryFenceThenCorrectFenceAddressIsSet) {
|
||||
using STATE_SYSTEM_MEM_FENCE_ADDRESS = typename FamilyType::STATE_SYSTEM_MEM_FENCE_ADDRESS;
|
||||
|
||||
const GraphicsAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN,
|
||||
nullptr, 1234, 0, 4096, MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
|
||||
|
||||
auto before = cmdContainer->getCommandStream()->getUsed();
|
||||
auto cmd = reinterpret_cast<STATE_SYSTEM_MEM_FENCE_ADDRESS *>(cmdContainer->getCommandStream()->getSpace(0));
|
||||
EncodeMemoryFence<FamilyType>::encodeSystemMemoryFence(*cmdContainer->getCommandStream(), &allocation);
|
||||
auto after = cmdContainer->getCommandStream()->getUsed();
|
||||
|
||||
EXPECT_EQ(sizeof(STATE_SYSTEM_MEM_FENCE_ADDRESS), after - before);
|
||||
|
||||
STATE_SYSTEM_MEM_FENCE_ADDRESS expectedCmd = FamilyType::cmdInitStateSystemMemFenceAddress;
|
||||
expectedCmd.setSystemMemoryFenceAddress(allocation.getGpuAddress());
|
||||
|
||||
EXPECT_EQ(expectedCmd.getSystemMemoryFenceAddress(), cmd->getSystemMemoryFenceAddress());
|
||||
EXPECT_EQ(expectedCmd.TheStructure.RawData[0], cmd->TheStructure.RawData[0]);
|
||||
EXPECT_EQ(expectedCmd.TheStructure.RawData[1], cmd->TheStructure.RawData[1]);
|
||||
EXPECT_EQ(expectedCmd.TheStructure.RawData[2], cmd->TheStructure.RawData[2]);
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(EncodeKernelXeHpcCoreTest, whenSizeForEncodeSystemMemoryFenceQueriedThenCorrectValueIsReturned) {
|
||||
using STATE_SYSTEM_MEM_FENCE_ADDRESS = typename FamilyType::STATE_SYSTEM_MEM_FENCE_ADDRESS;
|
||||
|
||||
auto size = EncodeMemoryFence<FamilyType>::getSystemMemoryFenceSize();
|
||||
EXPECT_EQ(sizeof(STATE_SYSTEM_MEM_FENCE_ADDRESS), size);
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(EncodeKernelXeHpcCoreTest, givenRevisionBAndAboveWhenSpecialModeRequiredThenDontReprogramPipelineSelect) {
|
||||
bool requiresUncachedMocs = false;
|
||||
uint32_t partitionCount = 0;
|
||||
auto hwInfo = pDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
uint32_t dims[] = {1, 1, 1};
|
||||
std::unique_ptr<MockDispatchKernelEncoder> dispatchInterface(new MockDispatchKernelEncoder());
|
||||
dispatchInterface->kernelDescriptor.kernelAttributes.flags.usesSpecialPipelineSelectMode = true;
|
||||
|
||||
struct {
|
||||
unsigned short revId;
|
||||
bool expectedValue;
|
||||
} testInputs[] = {
|
||||
{0x0, true},
|
||||
{0x1, true},
|
||||
{0x3, true},
|
||||
{0x5, false},
|
||||
{0x6, false},
|
||||
{0x7, false},
|
||||
};
|
||||
for (auto &testInput : testInputs) {
|
||||
hwInfo->platform.usRevId = testInput.revId;
|
||||
cmdContainer->lastPipelineSelectModeRequired = false;
|
||||
EncodeDispatchKernel<FamilyType>::encode(*cmdContainer.get(), dims, false, false, dispatchInterface.get(), 0, false, false,
|
||||
pDevice, NEO::PreemptionMode::Initial, requiresUncachedMocs, false, partitionCount, false, false);
|
||||
EXPECT_EQ(testInput.expectedValue, cmdContainer->lastPipelineSelectModeRequired);
|
||||
}
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(EncodeKernelXeHpcCoreTest, givenRevisionBAndAboveWhenSpecialModeRequiredAndAdjustPipelineSelectCalledThenDontEnableSystolicMode) {
|
||||
using PIPELINE_SELECT = typename FamilyType::PIPELINE_SELECT;
|
||||
auto hwInfo = pDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
std::unique_ptr<MockDispatchKernelEncoder> dispatchInterface(new MockDispatchKernelEncoder());
|
||||
dispatchInterface->kernelDescriptor.kernelAttributes.flags.usesSpecialPipelineSelectMode = true;
|
||||
|
||||
struct {
|
||||
unsigned short revId;
|
||||
bool expectedValue;
|
||||
} testInputs[] = {
|
||||
{0x0, true},
|
||||
{0x1, true},
|
||||
{0x3, true},
|
||||
{0x5, false},
|
||||
{0x6, false},
|
||||
{0x7, false},
|
||||
};
|
||||
for (auto &testInput : testInputs) {
|
||||
hwInfo->platform.usRevId = testInput.revId;
|
||||
EncodeComputeMode<FamilyType>::adjustPipelineSelect(*cmdContainer.get(), dispatchInterface->kernelDescriptor);
|
||||
GenCmdList commands;
|
||||
CmdParse<FamilyType>::parseCommandBuffer(commands, ptrOffset(cmdContainer->getCommandStream()->getCpuBase(), 0), cmdContainer->getCommandStream()->getUsed());
|
||||
|
||||
auto itor = find<PIPELINE_SELECT *>(commands.begin(), commands.end());
|
||||
ASSERT_NE(itor, commands.end());
|
||||
|
||||
auto pipelineSelectCmd = genCmdCast<PIPELINE_SELECT *>(*itor);
|
||||
EXPECT_EQ(testInput.expectedValue, pipelineSelectCmd->getSystolicModeEnable());
|
||||
cmdContainer->reset();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/test/common/fixtures/preemption_fixture.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
template <>
|
||||
PreemptionTestHwDetails GetPreemptionTestHwDetails<XE_HPC_COREFamily>() {
|
||||
PreemptionTestHwDetails ret;
|
||||
ret.modeToRegValueMap[PreemptionMode::ThreadGroup] = DwordBuilder::build(1, true) | DwordBuilder::build(2, true, false);
|
||||
ret.modeToRegValueMap[PreemptionMode::MidBatch] = DwordBuilder::build(2, true) | DwordBuilder::build(1, true, false);
|
||||
ret.modeToRegValueMap[PreemptionMode::MidThread] = DwordBuilder::build(2, true, false) | DwordBuilder::build(1, true, false);
|
||||
ret.defaultRegValue = ret.modeToRegValueMap[PreemptionMode::MidBatch];
|
||||
ret.regAddress = 0x2580u;
|
||||
return ret;
|
||||
}
|
||||
27
shared/test/common/xe_hpc_core/test_traits_xe_hpc_core.h
Normal file
27
shared/test/common/xe_hpc_core/test_traits_xe_hpc_core.h
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "shared/test/common/helpers/test_traits.h"
|
||||
|
||||
template <>
|
||||
struct TestTraits<IGFX_XE_HPC_CORE> {
|
||||
static constexpr bool surfaceStateCompressionParamsSupported = true;
|
||||
static constexpr bool clearColorAddressMatcher = false;
|
||||
static constexpr bool auxBuiltinsSupported = true;
|
||||
static constexpr bool localMemCompressionAubsSupported = false;
|
||||
static constexpr bool systemMemCompressionAubsSupported = false;
|
||||
static constexpr bool l3ControlSupported = false;
|
||||
static constexpr bool forceNonCoherentSupported = true;
|
||||
static constexpr bool threadPreemptionDisableBitMatcher = true;
|
||||
static constexpr bool programOnlyChangedFieldsInComputeStateMode = true;
|
||||
static constexpr bool iohInSbaSupported = false;
|
||||
static constexpr bool auxTranslationSupported = true;
|
||||
static constexpr bool deviceEnqueueSupport = false;
|
||||
static constexpr bool fusedEuDispatchSupported = true;
|
||||
static constexpr bool numberOfWalkersInCfeStateSupported = true;
|
||||
};
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/xe_hpc_core/hw_info.h"
|
||||
#include "shared/test/common/helpers/unit_test_helper.h"
|
||||
#include "shared/test/common/helpers/unit_test_helper.inl"
|
||||
using Family = NEO::XE_HPC_COREFamily;
|
||||
#include "shared/test/common/helpers/unit_test_helper_xehp_and_later.inl"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
template <>
|
||||
const AuxTranslationMode UnitTestHelper<Family>::requiredAuxTranslationMode = AuxTranslationMode::Blit;
|
||||
|
||||
template <>
|
||||
uint64_t UnitTestHelper<Family>::getAtomicMemoryAddress(const Family::MI_ATOMIC &atomic) {
|
||||
return atomic.getMemoryAddress();
|
||||
}
|
||||
|
||||
template <>
|
||||
const bool UnitTestHelper<Family>::tiledImagesSupported = false;
|
||||
|
||||
template <>
|
||||
const uint32_t UnitTestHelper<Family>::smallestTestableSimdSize = 16;
|
||||
|
||||
template <>
|
||||
uint32_t UnitTestHelper<Family>::getAppropriateThreadArbitrationPolicy(uint32_t policy) {
|
||||
using STATE_COMPUTE_MODE = typename Family::STATE_COMPUTE_MODE;
|
||||
switch (policy) {
|
||||
case ThreadArbitrationPolicy::RoundRobin:
|
||||
return STATE_COMPUTE_MODE::EU_THREAD_SCHEDULING_MODE_OVERRIDE::EU_THREAD_SCHEDULING_MODE_OVERRIDE_ROUND_ROBIN;
|
||||
case ThreadArbitrationPolicy::AgeBased:
|
||||
return STATE_COMPUTE_MODE::EU_THREAD_SCHEDULING_MODE_OVERRIDE::EU_THREAD_SCHEDULING_MODE_OVERRIDE_OLDEST_FIRST;
|
||||
case ThreadArbitrationPolicy::RoundRobinAfterDependency:
|
||||
return STATE_COMPUTE_MODE::EU_THREAD_SCHEDULING_MODE_OVERRIDE::EU_THREAD_SCHEDULING_MODE_OVERRIDE_STALL_BASED_ROUND_ROBIN;
|
||||
default:
|
||||
return STATE_COMPUTE_MODE::EU_THREAD_SCHEDULING_MODE_OVERRIDE::EU_THREAD_SCHEDULING_MODE_OVERRIDE_HW_DEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
template <>
|
||||
bool UnitTestHelper<Family>::requiresTimestampPacketsInSystemMemory(HardwareInfo &hwInfo) {
|
||||
return false;
|
||||
}
|
||||
|
||||
template <>
|
||||
bool UnitTestHelper<Family>::isAdditionalSynchronizationRequired() {
|
||||
return true;
|
||||
}
|
||||
|
||||
template <>
|
||||
bool UnitTestHelper<Family>::isAdditionalMiSemaphoreWaitRequired(const HardwareInfo &hwInfo) {
|
||||
auto programGlobalFenceAsMiMemFenceCommandInCommandStream = !Family::isXlA0(hwInfo);
|
||||
if (DebugManager.flags.ProgramGlobalFenceAsMiMemFenceCommandInCommandStream.get() != -1) {
|
||||
programGlobalFenceAsMiMemFenceCommandInCommandStream = !!DebugManager.flags.ProgramGlobalFenceAsMiMemFenceCommandInCommandStream.get();
|
||||
}
|
||||
return !programGlobalFenceAsMiMemFenceCommandInCommandStream;
|
||||
}
|
||||
|
||||
template <>
|
||||
const bool UnitTestHelper<Family>::additionalMiFlushDwRequired = false;
|
||||
|
||||
template <>
|
||||
uint32_t UnitTestHelper<Family>::getDebugModeRegisterOffset() {
|
||||
return 0x20d8;
|
||||
}
|
||||
|
||||
template <>
|
||||
uint32_t UnitTestHelper<Family>::getDebugModeRegisterValue() {
|
||||
return (1u << 5) | (1u << 21);
|
||||
}
|
||||
|
||||
template <>
|
||||
uint32_t UnitTestHelper<Family>::getTdCtlRegisterOffset() {
|
||||
return 0xe400;
|
||||
}
|
||||
|
||||
template <>
|
||||
uint32_t UnitTestHelper<Family>::getTdCtlRegisterValue() {
|
||||
return (1u << 7) | (1u << 4) | (1u << 2) | (1u << 0);
|
||||
}
|
||||
|
||||
template struct UnitTestHelper<Family>;
|
||||
|
||||
} // namespace NEO
|
||||
@@ -61,4 +61,18 @@ if(TESTS_XE_HPG_CORE)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(TESTS_XE_HPC_CORE)
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_implicit_scaling_xe_hpc.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
if(TESTS_PVC_AND_LATER)
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_encode_dispatch_kernel_pvc_and_later.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_encode_3dstate_btd_pvc_and_later.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/walker_partition_tests_pvc_and_later.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
add_subdirectories()
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_container/command_encoder.h"
|
||||
#include "shared/source/command_stream/linear_stream.h"
|
||||
#include "shared/source/helpers/ptr_math.h"
|
||||
#include "shared/test/common/cmd_parse/hw_parse.h"
|
||||
#include "shared/test/common/fixtures/command_container_fixture.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using CommandEncodeEnableRayTracing = Test<CommandEncodeStatesFixture>;
|
||||
|
||||
HWTEST2_F(CommandEncodeEnableRayTracing, whenEnableRayTracingIsProgrammedThen3DStateBtdIsEncodedInStream, IsAtLeastXeHpcCore) {
|
||||
using _3DSTATE_BTD = typename FamilyType::_3DSTATE_BTD;
|
||||
|
||||
uint32_t pCmdBuffer[1024];
|
||||
uint32_t pMemoryBackedBuffer[1024];
|
||||
|
||||
MockGraphicsAllocation gfxAllocation(static_cast<void *>(pCmdBuffer), sizeof(pCmdBuffer));
|
||||
LinearStream stream(&gfxAllocation);
|
||||
|
||||
MockGraphicsAllocation memoryBackedBuffer(static_cast<void *>(pMemoryBackedBuffer), sizeof(pMemoryBackedBuffer));
|
||||
|
||||
EncodeEnableRayTracing<FamilyType>::programEnableRayTracing(stream, memoryBackedBuffer);
|
||||
|
||||
GenCmdList commands;
|
||||
CmdParse<FamilyType>::parseCommandBuffer(commands, stream.getCpuBase(), stream.getUsed());
|
||||
|
||||
auto itor = commands.begin();
|
||||
itor = find<_3DSTATE_BTD *>(itor, commands.end());
|
||||
ASSERT_NE(itor, commands.end());
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_stream/stream_properties.h"
|
||||
#include "shared/source/kernel/grf_config.h"
|
||||
#include "shared/source/os_interface/hw_info_config.h"
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/common/fixtures/command_container_fixture.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/mock_dispatch_kernel_encoder_interface.h"
|
||||
#include "shared/test/unit_test/encoders/test_encode_dispatch_kernel_dg2_and_later.h"
|
||||
|
||||
#include "test.h"
|
||||
|
||||
#include "hw_cmds.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using CommandEncodeStatesTestPvcAndLater = Test<CommandEncodeStatesFixture>;
|
||||
|
||||
HWTEST2_F(CommandEncodeStatesTestPvcAndLater, givenOverrideSlmTotalSizeDebugVariableWhenDispatchingKernelThenSharedMemorySizeIsSetCorrectly, IsAtLeastXeHpcCore) {
|
||||
using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA;
|
||||
using WALKER_TYPE = typename FamilyType::WALKER_TYPE;
|
||||
DebugManagerStateRestore restorer;
|
||||
uint32_t dims[] = {2, 1, 1};
|
||||
std::unique_ptr<MockDispatchKernelEncoder> dispatchInterface(new MockDispatchKernelEncoder());
|
||||
uint32_t slmTotalSize = 0;
|
||||
EXPECT_CALL(*dispatchInterface.get(), getSlmTotalSize()).WillRepeatedly(::testing::Return(slmTotalSize));
|
||||
|
||||
bool requiresUncachedMocs = false;
|
||||
|
||||
int32_t maxValueToProgram = 0xC;
|
||||
|
||||
for (int32_t valueToProgram = 0x0; valueToProgram < maxValueToProgram; valueToProgram++) {
|
||||
DebugManager.flags.OverrideSlmAllocationSize.set(valueToProgram);
|
||||
cmdContainer->reset();
|
||||
uint32_t partitionCount = 0;
|
||||
EncodeDispatchKernel<FamilyType>::encode(*cmdContainer.get(), dims, false, false, dispatchInterface.get(), 0, false, false,
|
||||
pDevice, NEO::PreemptionMode::Disabled, requiresUncachedMocs, false, partitionCount,
|
||||
false, false);
|
||||
|
||||
GenCmdList commands;
|
||||
CmdParse<FamilyType>::parseCommandBuffer(commands, ptrOffset(cmdContainer->getCommandStream()->getCpuBase(), 0), cmdContainer->getCommandStream()->getUsed());
|
||||
auto itor = find<WALKER_TYPE *>(commands.begin(), commands.end());
|
||||
ASSERT_NE(itor, commands.end());
|
||||
auto cmd = genCmdCast<WALKER_TYPE *>(*itor);
|
||||
auto &idd = cmd->getInterfaceDescriptor();
|
||||
|
||||
EXPECT_EQ(valueToProgram, idd.getSharedLocalMemorySize());
|
||||
}
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncodeStatesTestPvcAndLater, givenCommandContainerWhenNumGrfRequiredIsGreaterThanDefaultThenLargeGrfModeEnabled) {
|
||||
using PIPELINE_SELECT = typename FamilyType::PIPELINE_SELECT;
|
||||
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
|
||||
cmdContainer->lastSentNumGrfRequired = GrfConfig::DefaultGrfNumber;
|
||||
auto stateComputeMode = FamilyType::cmdInitStateComputeMode;
|
||||
StreamProperties streamProperties{};
|
||||
streamProperties.stateComputeMode.setProperties(false, GrfConfig::LargeGrfNumber, 0u);
|
||||
EncodeComputeMode<FamilyType>::adjustComputeMode(*cmdContainer->getCommandStream(), &stateComputeMode, streamProperties.stateComputeMode, *defaultHwInfo);
|
||||
GenCmdList commands;
|
||||
CmdParse<FamilyType>::parseCommandBuffer(commands, ptrOffset(cmdContainer->getCommandStream()->getCpuBase(), 0), cmdContainer->getCommandStream()->getUsed());
|
||||
|
||||
auto itorCmd = find<STATE_COMPUTE_MODE *>(commands.begin(), commands.end());
|
||||
ASSERT_NE(itorCmd, commands.end());
|
||||
|
||||
auto cmd = genCmdCast<STATE_COMPUTE_MODE *>(*itorCmd);
|
||||
EXPECT_TRUE(cmd->getLargeGrfMode());
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandEncodeStatesTestPvcAndLater, GivenVariousSlmTotalSizesAndSettingRevIDToDifferentValuesWhenSetAdditionalInfoIsCalledThenCorrectValuesAreSet, IsXeHpcCore) {
|
||||
using PREFERRED_SLM_ALLOCATION_SIZE_PER_DSS = typename FamilyType::INTERFACE_DESCRIPTOR_DATA::PREFERRED_SLM_ALLOCATION_SIZE_PER_DSS;
|
||||
|
||||
const std::vector<PreferredSlmTestValues<FamilyType>> valuesToTest = {
|
||||
{0, PREFERRED_SLM_ALLOCATION_SIZE_PER_DSS::PREFERRED_SLM_SIZE_IS_0K},
|
||||
{16 * KB, PREFERRED_SLM_ALLOCATION_SIZE_PER_DSS::PREFERRED_SLM_SIZE_IS_16K},
|
||||
{32 * KB, PREFERRED_SLM_ALLOCATION_SIZE_PER_DSS::PREFERRED_SLM_SIZE_IS_32K},
|
||||
{64 * KB, PREFERRED_SLM_ALLOCATION_SIZE_PER_DSS::PREFERRED_SLM_SIZE_IS_64K},
|
||||
{96 * KB, PREFERRED_SLM_ALLOCATION_SIZE_PER_DSS::PREFERRED_SLM_SIZE_IS_96K},
|
||||
{128 * KB, PREFERRED_SLM_ALLOCATION_SIZE_PER_DSS::PREFERRED_SLM_SIZE_IS_128K},
|
||||
};
|
||||
|
||||
const std::vector<PreferredSlmTestValues<FamilyType>> valuesToTestForPvcAStep = {
|
||||
{0, PREFERRED_SLM_ALLOCATION_SIZE_PER_DSS::PREFERRED_SLM_SIZE_IS_16K},
|
||||
{16 * KB, PREFERRED_SLM_ALLOCATION_SIZE_PER_DSS::PREFERRED_SLM_SIZE_IS_16K},
|
||||
{32 * KB, PREFERRED_SLM_ALLOCATION_SIZE_PER_DSS::PREFERRED_SLM_SIZE_IS_32K},
|
||||
{64 * KB, PREFERRED_SLM_ALLOCATION_SIZE_PER_DSS::PREFERRED_SLM_SIZE_IS_64K},
|
||||
{96 * KB, PREFERRED_SLM_ALLOCATION_SIZE_PER_DSS::PREFERRED_SLM_SIZE_IS_96K},
|
||||
{128 * KB, PREFERRED_SLM_ALLOCATION_SIZE_PER_DSS::PREFERRED_SLM_SIZE_IS_128K},
|
||||
};
|
||||
|
||||
const std::array<REVID, 5> revs{REVISION_A0, REVISION_B, REVISION_C, REVISION_D, REVISION_K};
|
||||
auto &hwInfo = *pDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
for (auto rev : revs) {
|
||||
hwInfo.platform.usRevId = HwInfoConfig::get(productFamily)->getHwRevIdFromStepping(rev, hwInfo);
|
||||
if ((hwInfo.platform.eProductFamily == IGFX_PVC) && (rev == REVISION_A0)) {
|
||||
verifyPreferredSlmValues<FamilyType>(valuesToTestForPvcAStep, hwInfo);
|
||||
} else {
|
||||
verifyPreferredSlmValues<FamilyType>(valuesToTest, hwInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/fixtures/implicit_scaling_fixture.h"
|
||||
|
||||
HWTEST2_F(ImplicitScalingTests, GivenXeHpcWhenCheckingPipeControlStallRequiredThenExpectTrue, IsXeHpcCore) {
|
||||
EXPECT_TRUE(ImplicitScalingDispatch<FamilyType>::getPipeControlStallRequired());
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_container/walker_partition_xehp_and_later.h"
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/common/cmd_parse/hw_parse.h"
|
||||
#include "shared/test/common/helpers/unit_test_helper.h"
|
||||
|
||||
#include "test.h"
|
||||
|
||||
using namespace WalkerPartition;
|
||||
using namespace NEO;
|
||||
|
||||
struct WalkerPartitionPvcAndLaterTests : public ::testing::Test {
|
||||
void TearDown() override {
|
||||
auto initialCommandBufferPointer = cmdBuffer;
|
||||
if (checkForProperCmdBufferAddressOffset) {
|
||||
EXPECT_EQ(ptrDiff(cmdBufferAddress, initialCommandBufferPointer), totalBytesProgrammed);
|
||||
}
|
||||
}
|
||||
char cmdBuffer[4096u];
|
||||
uint32_t totalBytesProgrammed = 0u;
|
||||
void *cmdBufferAddress = cmdBuffer;
|
||||
bool checkForProperCmdBufferAddressOffset = true;
|
||||
bool synchronizeBeforeExecution = false;
|
||||
};
|
||||
|
||||
HWTEST2_F(WalkerPartitionPvcAndLaterTests, givenMiAtomicWhenItIsProgrammedThenAllFieldsAreSetCorrectly, IsAtLeastXeHpcCore) {
|
||||
auto expectedUsedSize = sizeof(WalkerPartition::MI_ATOMIC<FamilyType>);
|
||||
uint64_t gpuAddress = 0xFFFFFFDFEEDBAC10llu;
|
||||
|
||||
void *miAtomicAddress = cmdBufferAddress;
|
||||
programMiAtomic<FamilyType>(cmdBufferAddress,
|
||||
totalBytesProgrammed, gpuAddress, true, MI_ATOMIC<FamilyType>::ATOMIC_OPCODES::ATOMIC_4B_INCREMENT);
|
||||
|
||||
auto miAtomic = genCmdCast<WalkerPartition::MI_ATOMIC<FamilyType> *>(miAtomicAddress);
|
||||
ASSERT_NE(nullptr, miAtomic);
|
||||
EXPECT_EQ(expectedUsedSize, totalBytesProgrammed);
|
||||
EXPECT_EQ(MI_ATOMIC<FamilyType>::ATOMIC_OPCODES::ATOMIC_4B_INCREMENT, miAtomic->getAtomicOpcode());
|
||||
EXPECT_EQ(0u, miAtomic->getDataSize());
|
||||
EXPECT_TRUE(miAtomic->getCsStall());
|
||||
EXPECT_EQ(MI_ATOMIC<FamilyType>::MEMORY_TYPE::MEMORY_TYPE_PER_PROCESS_GRAPHICS_ADDRESS, miAtomic->getMemoryType());
|
||||
EXPECT_TRUE(miAtomic->getReturnDataControl());
|
||||
EXPECT_FALSE(miAtomic->getWorkloadPartitionIdOffsetEnable());
|
||||
auto memoryAddress = UnitTestHelper<FamilyType>::getAtomicMemoryAddress(*miAtomic);
|
||||
|
||||
EXPECT_EQ(gpuAddress, memoryAddress);
|
||||
}
|
||||
|
||||
HWTEST2_F(WalkerPartitionPvcAndLaterTests, givenProgramBatchBufferStartCommandWhenItIsCalledThenCommandIsProgrammedCorrectly, IsAtLeastXeHpcCore) {
|
||||
auto expectedUsedSize = sizeof(WalkerPartition::BATCH_BUFFER_START<FamilyType>);
|
||||
uint64_t gpuAddress = 0xFFFFFFDFEEDBAC10llu;
|
||||
|
||||
void *batchBufferStartAddress = cmdBufferAddress;
|
||||
WalkerPartition::programMiBatchBufferStart<FamilyType>(cmdBufferAddress, totalBytesProgrammed, gpuAddress, true, false);
|
||||
auto batchBufferStart = genCmdCast<WalkerPartition::BATCH_BUFFER_START<FamilyType> *>(batchBufferStartAddress);
|
||||
ASSERT_NE(nullptr, batchBufferStart);
|
||||
EXPECT_EQ(expectedUsedSize, totalBytesProgrammed);
|
||||
|
||||
if (productFamily == IGFX_PVC) {
|
||||
//bits 57-63 are zeroed
|
||||
EXPECT_EQ((gpuAddress & 0x1FFFFFFFFFFFFFF), batchBufferStart->getBatchBufferStartAddress());
|
||||
} else {
|
||||
//bits 48-63 are zeroed
|
||||
EXPECT_EQ((gpuAddress & 0xFFFFFFFFFFFF), batchBufferStart->getBatchBufferStartAddress());
|
||||
}
|
||||
EXPECT_TRUE(batchBufferStart->getPredicationEnable());
|
||||
EXPECT_FALSE(batchBufferStart->getEnableCommandCache());
|
||||
EXPECT_EQ(BATCH_BUFFER_START<FamilyType>::SECOND_LEVEL_BATCH_BUFFER::SECOND_LEVEL_BATCH_BUFFER_FIRST_LEVEL_BATCH, batchBufferStart->getSecondLevelBatchBuffer());
|
||||
EXPECT_EQ(BATCH_BUFFER_START<FamilyType>::ADDRESS_SPACE_INDICATOR::ADDRESS_SPACE_INDICATOR_PPGTT, batchBufferStart->getAddressSpaceIndicator());
|
||||
}
|
||||
Reference in New Issue
Block a user