mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-25 13:33:02 +08:00
test: refactor hw parse cmds
Related-To: NEO-10641 Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
bfbcb7c05c
commit
4048cbc0c2
@@ -17,18 +17,22 @@ target_sources(neo_libult_common PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmd_parse_l3_control.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmd_parse_mi_arb.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmd_parse_sip.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmd_parse_xy_block_copy.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gen_cmd_parse.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_parse.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_parse.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_parse_base.inl
|
||||
)
|
||||
|
||||
if(TESTS_XEHP_AND_LATER)
|
||||
if(TESTS_DG2_AND_LATER)
|
||||
target_sources(neo_libult_common PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmd_parse_l3_control_xehp_and_later.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmd_parse_xehp_and_later.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmd_parse_xe_hpg_and_later.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_parse_xe_hpg_and_later.inl
|
||||
)
|
||||
endif()
|
||||
|
||||
if(TESTS_PVC_AND_LATER)
|
||||
target_sources(neo_libult_common PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/cmd_parse_pvc_and_later.inl)
|
||||
endif()
|
||||
if(TESTS_XE2_AND_LATER)
|
||||
target_sources(neo_libult_common PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_parse_xe2_hpg_and_later.inl
|
||||
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
using namespace NEO;
|
||||
using L3_CONTROL = GenStruct::L3_CONTROL;
|
||||
|
||||
template <>
|
||||
L3_CONTROL *genCmdCast<L3_CONTROL *>(void *buffer) {
|
||||
auto pCmd = reinterpret_cast<L3_CONTROL *>(buffer);
|
||||
|
||||
return L3_CONTROL::TYPE_GFXPIPE == pCmd->TheStructure.Common.Type &&
|
||||
L3_CONTROL::COMMAND_SUBTYPE_GFXPIPE_3D == pCmd->TheStructure.Common.CommandSubtype &&
|
||||
L3_CONTROL::_3D_COMMAND_OPCODE_L3_CONTROL == pCmd->TheStructure.Common._3DCommandOpcode &&
|
||||
L3_CONTROL::_3D_COMMAND_SUB_OPCODE_L3_CONTROL == pCmd->TheStructure.Common._3DCommandSubOpcode
|
||||
? pCmd
|
||||
: nullptr;
|
||||
}
|
||||
101
shared/test/common/cmd_parse/cmd_parse_xe_hpg_and_later.inl
Normal file
101
shared/test/common/cmd_parse/cmd_parse_xe_hpg_and_later.inl
Normal file
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#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/cmd_parse_sip.inl"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using STATE_SIP = GenStruct::STATE_SIP;
|
||||
|
||||
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;
|
||||
}
|
||||
{
|
||||
auto pCmd = genCmdCast<XY_BLOCK_COPY_BLT *>(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";
|
||||
}
|
||||
if (genCmdCast<XY_BLOCK_COPY_BLT *>(cmd)) {
|
||||
return "XY_BLOCK_COPY_BLT";
|
||||
}
|
||||
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
||||
template struct CmdParse<GenGfxFamily>;
|
||||
@@ -1,235 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/cmd_parse/cmd_parse_base.inl"
|
||||
//
|
||||
#include "shared/source/indirect_heap/indirect_heap.h"
|
||||
#include "shared/test/common/cmd_parse/cmd_parse_3d_state_btd.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/cmd_parse_l3_control_xehp_and_later.inl"
|
||||
#include "shared/test/common/cmd_parse/cmd_parse_sip.inl"
|
||||
#include "shared/test/common/cmd_parse/hw_parse.h"
|
||||
#include "shared/test/common/cmd_parse/hw_parse.inl"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
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<L3_CONTROL *>(cmd);
|
||||
if (pCmd)
|
||||
return pCmd->TheStructure.Common.Length + 2;
|
||||
}
|
||||
{
|
||||
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<L3_CONTROL *>(cmd)) {
|
||||
auto l3Command = genCmdCast<L3_CONTROL *>(cmd);
|
||||
if (l3Command->getPostSyncOperation() == L3_CONTROL::POST_SYNC_OPERATION::POST_SYNC_OPERATION_NO_WRITE) {
|
||||
|
||||
return "L3_CONTROL(NO_POST_SYNC)";
|
||||
} else {
|
||||
return "L3_CONTROL(POST_SYNC)";
|
||||
}
|
||||
}
|
||||
|
||||
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::DefaultWalkerType DefaultWalkerType;
|
||||
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::MI_BATCH_BUFFER_START MI_BATCH_BUFFER_START;
|
||||
typedef typename GenGfxFamily::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM;
|
||||
using _3DSTATE_BINDING_TABLE_POOL_ALLOC = typename GenGfxFamily::_3DSTATE_BINDING_TABLE_POOL_ALLOC;
|
||||
|
||||
itorWalker = find<DefaultWalkerType *>(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);
|
||||
}
|
||||
|
||||
itorBindingTableBaseAddress = find<_3DSTATE_BINDING_TABLE_POOL_ALLOC *>(cmdList.begin(), itorWalker);
|
||||
if (itorBindingTableBaseAddress != itorWalker) {
|
||||
cmdBindingTableBaseAddress = *itorBindingTableBaseAddress;
|
||||
}
|
||||
|
||||
// interfaceDescriptorData should be located within DefaultWalkerType
|
||||
if (cmdWalker) {
|
||||
// Extract the interfaceDescriptorData
|
||||
auto &idd = reinterpret_cast<DefaultWalkerType *>(cmdWalker)->getInterfaceDescriptor();
|
||||
cmdInterfaceDescriptorData = &idd;
|
||||
}
|
||||
}
|
||||
|
||||
template <>
|
||||
const void *HardwareParse::getStatelessArgumentPointer<GenGfxFamily>(const KernelInfo &kernelInfo, uint32_t indexArg, IndirectHeap &ioh, uint32_t rootDeviceIndex) {
|
||||
typedef typename GenGfxFamily::DefaultWalkerType DefaultWalkerType;
|
||||
typedef typename GenGfxFamily::STATE_BASE_ADDRESS STATE_BASE_ADDRESS;
|
||||
|
||||
auto cmdWalker = (DefaultWalkerType *)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
|
||||
21
shared/test/common/cmd_parse/cmd_parse_xy_block_copy.inl
Normal file
21
shared/test/common/cmd_parse/cmd_parse_xy_block_copy.inl
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
|
||||
using namespace NEO;
|
||||
using XY_BLOCK_COPY_BLT = GenStruct::XY_BLOCK_COPY_BLT;
|
||||
|
||||
template <>
|
||||
XY_BLOCK_COPY_BLT *genCmdCast<XY_BLOCK_COPY_BLT *>(void *buffer) {
|
||||
auto pCmd = reinterpret_cast<XY_BLOCK_COPY_BLT *>(buffer);
|
||||
|
||||
return XY_BLOCK_COPY_BLT::INSTRUCTIONTARGET_OPCODE_OPCODE == pCmd->TheStructure.Common.InstructionTarget_Opcode &&
|
||||
XY_BLOCK_COPY_BLT::CLIENT_2D_PROCESSOR == pCmd->TheStructure.Common.Client
|
||||
? pCmd
|
||||
: nullptr;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2023 Intel Corporation
|
||||
* Copyright (C) 2018-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
26
shared/test/common/cmd_parse/hw_parse_xe2_hpg_and_later.inl
Normal file
26
shared/test/common/cmd_parse/hw_parse_xe2_hpg_and_later.inl
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/cmd_parse/hw_parse.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
template <>
|
||||
void HardwareParse::findCsrBaseAddress<GenGfxFamily>() {
|
||||
using STATE_CONTEXT_DATA_BASE_ADDRESS = typename GenGfxFamily::STATE_CONTEXT_DATA_BASE_ADDRESS;
|
||||
itorGpgpuCsrBaseAddress = find<STATE_CONTEXT_DATA_BASE_ADDRESS *>(cmdList.begin(), cmdList.end());
|
||||
if (itorGpgpuCsrBaseAddress != cmdList.end()) {
|
||||
cmdGpgpuCsrBaseAddress = *itorGpgpuCsrBaseAddress;
|
||||
}
|
||||
}
|
||||
|
||||
template <>
|
||||
bool HardwareParse::requiresPipelineSelectBeforeMediaState<GenGfxFamily>() {
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2024 Intel Corporation
|
||||
* Copyright (C) 2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -7,113 +7,10 @@
|
||||
|
||||
#include "shared/source/indirect_heap/indirect_heap.h"
|
||||
#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/cmd_parse_sip.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 <>
|
||||
XY_BLOCK_COPY_BLT *genCmdCast<XY_BLOCK_COPY_BLT *>(void *buffer) {
|
||||
auto pCmd = reinterpret_cast<XY_BLOCK_COPY_BLT *>(buffer);
|
||||
|
||||
return XY_BLOCK_COPY_BLT::INSTRUCTIONTARGET_OPCODE_OPCODE == pCmd->TheStructure.Common.InstructionTarget_Opcode &&
|
||||
XY_BLOCK_COPY_BLT::CLIENT_2D_PROCESSOR == pCmd->TheStructure.Common.Client
|
||||
? 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;
|
||||
}
|
||||
{
|
||||
auto pCmd = genCmdCast<XY_BLOCK_COPY_BLT *>(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";
|
||||
}
|
||||
if (genCmdCast<XY_BLOCK_COPY_BLT *>(cmd)) {
|
||||
return "XY_BLOCK_COPY_BLT";
|
||||
}
|
||||
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
||||
template struct CmdParse<GenGfxFamily>;
|
||||
|
||||
namespace NEO {
|
||||
|
||||
template <>
|
||||
@@ -16,7 +16,7 @@ using GenGfxFamily = NEO::Gen11Family;
|
||||
#include "shared/test/common/cmd_parse/cmd_parse_sip.inl"
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/common/cmd_parse/hw_parse.h"
|
||||
#include "shared/test/common/cmd_parse/hw_parse.inl"
|
||||
#include "shared/test/common/cmd_parse/hw_parse_base.inl"
|
||||
|
||||
template <>
|
||||
size_t CmdParse<GenGfxFamily>::getCommandLengthHwSpecific(void *cmd) {
|
||||
|
||||
@@ -18,7 +18,7 @@ using GenGfxFamily = NEO::Gen12LpFamily;
|
||||
#include "shared/test/common/cmd_parse/cmd_parse_sip.inl"
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/common/cmd_parse/hw_parse.h"
|
||||
#include "shared/test/common/cmd_parse/hw_parse.inl"
|
||||
#include "shared/test/common/cmd_parse/hw_parse_base.inl"
|
||||
|
||||
size_t getAdditionalCommandLengthHwSpecific(void *cmd) {
|
||||
using L3_CONTROL_WITH_POST_SYNC = typename GenGfxFamily::L3_CONTROL;
|
||||
|
||||
@@ -16,7 +16,7 @@ using GenGfxFamily = NEO::Gen8Family;
|
||||
#include "shared/test/common/cmd_parse/cmd_parse_sip.inl"
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/common/cmd_parse/hw_parse.h"
|
||||
#include "shared/test/common/cmd_parse/hw_parse.inl"
|
||||
#include "shared/test/common/cmd_parse/hw_parse_base.inl"
|
||||
|
||||
template <>
|
||||
size_t CmdParse<GenGfxFamily>::getCommandLengthHwSpecific(void *cmd) {
|
||||
|
||||
@@ -16,7 +16,7 @@ using GenGfxFamily = NEO::Gen9Family;
|
||||
#include "shared/test/common/cmd_parse/cmd_parse_sip.inl"
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/common/cmd_parse/hw_parse.h"
|
||||
#include "shared/test/common/cmd_parse/hw_parse.inl"
|
||||
#include "shared/test/common/cmd_parse/hw_parse_base.inl"
|
||||
|
||||
template <>
|
||||
size_t CmdParse<GenGfxFamily>::getCommandLengthHwSpecific(void *cmd) {
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
using GenStruct = NEO::Xe2HpgCore;
|
||||
using GenGfxFamily = NEO::Xe2HpgCoreFamily;
|
||||
|
||||
#include "shared/test/common/cmd_parse/cmd_parse_xy_block_copy.inl"
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
|
||||
using MI_MEM_FENCE = GenStruct::MI_MEM_FENCE;
|
||||
@@ -130,22 +131,10 @@ const char *CmdParse<GenGfxFamily>::getAdditionalCommandName(void *cmd) {
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
||||
#include "shared/test/common/cmd_parse/cmd_parse_xe_hpg_and_later.inl"
|
||||
#include "shared/test/common/cmd_parse/hw_parse.h"
|
||||
|
||||
template <>
|
||||
bool NEO::HardwareParse::requiresPipelineSelectBeforeMediaState<GenGfxFamily>() {
|
||||
return false;
|
||||
}
|
||||
|
||||
#include "shared/test/common/cmd_parse/cmd_parse_pvc_and_later.inl"
|
||||
|
||||
template <>
|
||||
void HardwareParse::findCsrBaseAddress<GenGfxFamily>() {
|
||||
using STATE_CONTEXT_DATA_BASE_ADDRESS = typename GenGfxFamily::STATE_CONTEXT_DATA_BASE_ADDRESS;
|
||||
itorGpgpuCsrBaseAddress = find<STATE_CONTEXT_DATA_BASE_ADDRESS *>(cmdList.begin(), cmdList.end());
|
||||
if (itorGpgpuCsrBaseAddress != cmdList.end()) {
|
||||
cmdGpgpuCsrBaseAddress = *itorGpgpuCsrBaseAddress;
|
||||
}
|
||||
}
|
||||
#include "shared/test/common/cmd_parse/hw_parse_base.inl"
|
||||
#include "shared/test/common/cmd_parse/hw_parse_xe2_hpg_and_later.inl"
|
||||
#include "shared/test/common/cmd_parse/hw_parse_xe_hpg_and_later.inl"
|
||||
|
||||
template const typename GenGfxFamily::RENDER_SURFACE_STATE *NEO::HardwareParse::getSurfaceState<GenGfxFamily>(IndirectHeap *ssh, uint32_t index);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
* Copyright (C) 2021-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -9,6 +9,7 @@
|
||||
using GenStruct = NEO::XeHpcCore;
|
||||
using GenGfxFamily = NEO::XeHpcCoreFamily;
|
||||
|
||||
#include "shared/test/common/cmd_parse/cmd_parse_xy_block_copy.inl"
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
|
||||
using MI_MEM_FENCE = GenStruct::MI_MEM_FENCE;
|
||||
@@ -109,6 +110,9 @@ const char *CmdParse<GenGfxFamily>::getAdditionalCommandName(void *cmd) {
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
||||
#include "shared/test/common/cmd_parse/cmd_parse_pvc_and_later.inl"
|
||||
#include "shared/test/common/cmd_parse/cmd_parse_xe_hpg_and_later.inl"
|
||||
#include "shared/test/common/cmd_parse/hw_parse.h"
|
||||
#include "shared/test/common/cmd_parse/hw_parse_base.inl"
|
||||
#include "shared/test/common/cmd_parse/hw_parse_xe_hpg_and_later.inl"
|
||||
|
||||
template const typename GenGfxFamily::RENDER_SURFACE_STATE *NEO::HardwareParse::getSurfaceState<GenGfxFamily>(IndirectHeap *ssh, uint32_t index);
|
||||
|
||||
@@ -1,13 +1,60 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
* Copyright (C) 2021-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/xe_hpg_core/hw_cmds_xe_hpg_core_base.h"
|
||||
|
||||
using GenStruct = NEO::XeHpgCore;
|
||||
using GenGfxFamily = NEO::XeHpgCoreFamily;
|
||||
#include "shared/test/common/cmd_parse/cmd_parse_xehp_and_later.inl"
|
||||
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
|
||||
using L3_CONTROL = GenStruct::L3_CONTROL;
|
||||
|
||||
template <>
|
||||
L3_CONTROL *genCmdCast<L3_CONTROL *>(void *buffer) {
|
||||
auto pCmd = reinterpret_cast<L3_CONTROL *>(buffer);
|
||||
|
||||
return L3_CONTROL::TYPE_GFXPIPE == pCmd->TheStructure.Common.Type &&
|
||||
L3_CONTROL::COMMAND_SUBTYPE_GFXPIPE_3D == pCmd->TheStructure.Common.CommandSubtype &&
|
||||
L3_CONTROL::_3D_COMMAND_OPCODE_L3_CONTROL == pCmd->TheStructure.Common._3DCommandOpcode &&
|
||||
L3_CONTROL::_3D_COMMAND_SUB_OPCODE_L3_CONTROL == pCmd->TheStructure.Common._3DCommandSubOpcode
|
||||
? pCmd
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
size_t CmdParse<GenGfxFamily>::getAdditionalCommandLength(void *cmd) {
|
||||
{
|
||||
auto pCmd = genCmdCast<L3_CONTROL *>(cmd);
|
||||
if (pCmd)
|
||||
return pCmd->TheStructure.Common.Length + 2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <>
|
||||
const char *CmdParse<GenGfxFamily>::getAdditionalCommandName(void *cmd) {
|
||||
|
||||
if (nullptr != genCmdCast<L3_CONTROL *>(cmd)) {
|
||||
auto l3Command = genCmdCast<L3_CONTROL *>(cmd);
|
||||
if (l3Command->getPostSyncOperation() == L3_CONTROL::POST_SYNC_OPERATION::POST_SYNC_OPERATION_NO_WRITE) {
|
||||
|
||||
return "L3_CONTROL(NO_POST_SYNC)";
|
||||
} else {
|
||||
return "L3_CONTROL(POST_SYNC)";
|
||||
}
|
||||
}
|
||||
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
||||
#include "shared/test/common/cmd_parse/cmd_parse_xe_hpg_and_later.inl"
|
||||
#include "shared/test/common/cmd_parse/hw_parse_base.inl"
|
||||
#include "shared/test/common/cmd_parse/hw_parse_xe_hpg_and_later.inl"
|
||||
|
||||
template const typename GenGfxFamily::RENDER_SURFACE_STATE *NEO::HardwareParse::getSurfaceState<GenGfxFamily>(IndirectHeap *ssh, uint32_t index);
|
||||
|
||||
Reference in New Issue
Block a user