mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Move cmd parse files to shared directory
Related-To: NEO-4519 Change-Id: Id055631d68f1d73ae39c4976843080b8f8e05f1c Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
70a28f4bd9
commit
0791b25214
@ -6,15 +6,8 @@
|
||||
|
||||
set(IGDRCL_SRCS_tests_gen_common
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmd_parse_base.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmd_parse_base_mi_arb.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmd_parse_compute_mode.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmd_parse_gpgpu_walker.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmd_parse_mi_arb.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmd_parse_sip.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/exclude_tests/exclude_test_declare.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/exclude_tests/exclude_test_exclude.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gen_cmd_parse.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gen_commands_common_validation.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_cmds_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/matchers.h
|
||||
|
@ -1,352 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "opencl/test/unit_test/gen_common/gen_cmd_parse.h"
|
||||
|
||||
// clang-format off
|
||||
using namespace NEO;
|
||||
using MI_ARB_CHECK = GenStruct::MI_ARB_CHECK;
|
||||
using MI_ATOMIC = GenStruct::MI_ATOMIC;
|
||||
using MI_BATCH_BUFFER_END = GenStruct::MI_BATCH_BUFFER_END;
|
||||
using MI_BATCH_BUFFER_START = GenStruct::MI_BATCH_BUFFER_START;
|
||||
using MI_LOAD_REGISTER_IMM = GenStruct::MI_LOAD_REGISTER_IMM;
|
||||
using MI_LOAD_REGISTER_MEM = GenStruct::MI_LOAD_REGISTER_MEM;
|
||||
using MI_STORE_REGISTER_MEM = GenStruct::MI_STORE_REGISTER_MEM;
|
||||
using MI_NOOP = GenStruct::MI_NOOP;
|
||||
using PIPE_CONTROL = GenStruct::PIPE_CONTROL;
|
||||
using PIPELINE_SELECT = GenStruct::PIPELINE_SELECT;
|
||||
using STATE_BASE_ADDRESS = GenStruct::STATE_BASE_ADDRESS;
|
||||
using MI_REPORT_PERF_COUNT = GenStruct::MI_REPORT_PERF_COUNT;
|
||||
using MI_MATH = GenStruct::MI_MATH;
|
||||
using MI_LOAD_REGISTER_REG = GenStruct::MI_LOAD_REGISTER_REG;
|
||||
using MI_SEMAPHORE_WAIT = GenStruct::MI_SEMAPHORE_WAIT;
|
||||
using MI_STORE_DATA_IMM = GenStruct::MI_STORE_DATA_IMM;
|
||||
using MI_FLUSH_DW = GenStruct::MI_FLUSH_DW;
|
||||
using XY_COPY_BLT = GenGfxFamily::XY_COPY_BLT;
|
||||
// clang-format on
|
||||
|
||||
template <>
|
||||
STATE_BASE_ADDRESS *genCmdCast<STATE_BASE_ADDRESS *>(void *buffer) {
|
||||
auto pCmd = reinterpret_cast<STATE_BASE_ADDRESS *>(buffer);
|
||||
|
||||
return STATE_BASE_ADDRESS::COMMAND_TYPE_GFXPIPE == pCmd->TheStructure.Common.CommandType &&
|
||||
STATE_BASE_ADDRESS::COMMAND_SUBTYPE_GFXPIPE_COMMON == pCmd->TheStructure.Common.CommandSubtype &&
|
||||
STATE_BASE_ADDRESS::_3D_COMMAND_OPCODE_GFXPIPE_NONPIPELINED == pCmd->TheStructure.Common._3DCommandOpcode &&
|
||||
STATE_BASE_ADDRESS::_3D_COMMAND_SUB_OPCODE_STATE_BASE_ADDRESS == pCmd->TheStructure.Common._3DCommandSubOpcode
|
||||
? pCmd
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
PIPE_CONTROL *genCmdCast<PIPE_CONTROL *>(void *buffer) {
|
||||
auto pCmd = reinterpret_cast<PIPE_CONTROL *>(buffer);
|
||||
|
||||
return PIPE_CONTROL::COMMAND_TYPE_GFXPIPE == pCmd->TheStructure.Common.CommandType &&
|
||||
PIPE_CONTROL::COMMAND_SUBTYPE_GFXPIPE_3D == pCmd->TheStructure.Common.CommandSubtype &&
|
||||
PIPE_CONTROL::_3D_COMMAND_OPCODE_PIPE_CONTROL == pCmd->TheStructure.Common._3DCommandOpcode &&
|
||||
PIPE_CONTROL::_3D_COMMAND_SUB_OPCODE_PIPE_CONTROL == pCmd->TheStructure.Common._3DCommandSubOpcode
|
||||
? pCmd
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
PIPELINE_SELECT *genCmdCast<PIPELINE_SELECT *>(void *buffer) {
|
||||
auto pCmd = reinterpret_cast<PIPELINE_SELECT *>(buffer);
|
||||
|
||||
return PIPELINE_SELECT::COMMAND_TYPE_GFXPIPE == pCmd->TheStructure.Common.CommandType &&
|
||||
PIPELINE_SELECT::COMMAND_SUBTYPE_GFXPIPE_SINGLE_DW == pCmd->TheStructure.Common.CommandSubtype &&
|
||||
PIPELINE_SELECT::_3D_COMMAND_OPCODE_GFXPIPE_NONPIPELINED == pCmd->TheStructure.Common._3DCommandOpcode &&
|
||||
PIPELINE_SELECT::_3D_COMMAND_SUB_OPCODE_PIPELINE_SELECT == pCmd->TheStructure.Common._3DCommandSubOpcode
|
||||
? pCmd
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
MI_LOAD_REGISTER_IMM *genCmdCast<MI_LOAD_REGISTER_IMM *>(void *buffer) {
|
||||
auto pCmd = reinterpret_cast<MI_LOAD_REGISTER_IMM *>(buffer);
|
||||
|
||||
return MI_LOAD_REGISTER_IMM::COMMAND_TYPE_MI_COMMAND == pCmd->TheStructure.Common.CommandType &&
|
||||
MI_LOAD_REGISTER_IMM::MI_COMMAND_OPCODE_MI_LOAD_REGISTER_IMM == pCmd->TheStructure.Common.MiCommandOpcode
|
||||
? pCmd
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
MI_NOOP *genCmdCast<MI_NOOP *>(void *buffer) {
|
||||
auto pCmd = reinterpret_cast<MI_NOOP *>(buffer);
|
||||
|
||||
return MI_NOOP::COMMAND_TYPE_MI_COMMAND == pCmd->TheStructure.Common.CommandType &&
|
||||
MI_NOOP::MI_COMMAND_OPCODE_MI_NOOP == pCmd->TheStructure.Common.MiCommandOpcode
|
||||
? pCmd
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
MI_ATOMIC *genCmdCast<MI_ATOMIC *>(void *buffer) {
|
||||
auto pCmd = reinterpret_cast<MI_ATOMIC *>(buffer);
|
||||
|
||||
return MI_ATOMIC::COMMAND_TYPE_MI_COMMAND == pCmd->TheStructure.Common.CommandType &&
|
||||
MI_ATOMIC::MI_COMMAND_OPCODE_MI_ATOMIC == pCmd->TheStructure.Common.MiCommandOpcode
|
||||
? pCmd
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
MI_BATCH_BUFFER_END *genCmdCast<MI_BATCH_BUFFER_END *>(void *buffer) {
|
||||
auto pCmd = reinterpret_cast<MI_BATCH_BUFFER_END *>(buffer);
|
||||
|
||||
return MI_BATCH_BUFFER_END::COMMAND_TYPE_MI_COMMAND == pCmd->TheStructure.Common.CommandType &&
|
||||
MI_BATCH_BUFFER_END::MI_COMMAND_OPCODE_MI_BATCH_BUFFER_END == pCmd->TheStructure.Common.MiCommandOpcode
|
||||
? pCmd
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
MI_BATCH_BUFFER_START *genCmdCast<MI_BATCH_BUFFER_START *>(void *buffer) {
|
||||
auto pCmd = reinterpret_cast<MI_BATCH_BUFFER_START *>(buffer);
|
||||
|
||||
return MI_BATCH_BUFFER_START::COMMAND_TYPE_MI_COMMAND == pCmd->TheStructure.Common.CommandType &&
|
||||
MI_BATCH_BUFFER_START::MI_COMMAND_OPCODE_MI_BATCH_BUFFER_START == pCmd->TheStructure.Common.MiCommandOpcode
|
||||
? pCmd
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
MI_LOAD_REGISTER_MEM *genCmdCast<MI_LOAD_REGISTER_MEM *>(void *buffer) {
|
||||
auto pCmd = reinterpret_cast<MI_LOAD_REGISTER_MEM *>(buffer);
|
||||
|
||||
return MI_LOAD_REGISTER_MEM::COMMAND_TYPE_MI_COMMAND == pCmd->TheStructure.Common.CommandType &&
|
||||
MI_LOAD_REGISTER_MEM::MI_COMMAND_OPCODE_MI_LOAD_REGISTER_MEM == pCmd->TheStructure.Common.MiCommandOpcode
|
||||
? pCmd
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
MI_STORE_REGISTER_MEM *genCmdCast<MI_STORE_REGISTER_MEM *>(void *buffer) {
|
||||
auto pCmd = reinterpret_cast<MI_STORE_REGISTER_MEM *>(buffer);
|
||||
|
||||
return MI_STORE_REGISTER_MEM::COMMAND_TYPE_MI_COMMAND == pCmd->TheStructure.Common.CommandType &&
|
||||
MI_STORE_REGISTER_MEM::MI_COMMAND_OPCODE_MI_STORE_REGISTER_MEM == pCmd->TheStructure.Common.MiCommandOpcode
|
||||
? pCmd
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
MI_REPORT_PERF_COUNT *genCmdCast<MI_REPORT_PERF_COUNT *>(void *buffer) {
|
||||
auto pCmd = reinterpret_cast<MI_REPORT_PERF_COUNT *>(buffer);
|
||||
|
||||
return MI_REPORT_PERF_COUNT::COMMAND_TYPE_MI_COMMAND == pCmd->TheStructure.Common.CommandType &&
|
||||
MI_REPORT_PERF_COUNT::MI_COMMAND_OPCODE_MI_REPORT_PERF_COUNT == pCmd->TheStructure.Common.MiCommandOpcode
|
||||
? pCmd
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
MI_MATH *genCmdCast<MI_MATH *>(void *buffer) {
|
||||
auto pCmd = reinterpret_cast<MI_MATH *>(buffer);
|
||||
|
||||
return MI_MATH::COMMAND_TYPE_MI_COMMAND == pCmd->DW0.BitField.InstructionType &&
|
||||
MI_MATH::MI_COMMAND_OPCODE_MI_MATH == pCmd->DW0.BitField.InstructionOpcode
|
||||
? pCmd
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
MI_LOAD_REGISTER_REG *genCmdCast<MI_LOAD_REGISTER_REG *>(void *buffer) {
|
||||
auto pCmd = reinterpret_cast<MI_LOAD_REGISTER_REG *>(buffer);
|
||||
|
||||
return MI_LOAD_REGISTER_REG::COMMAND_TYPE_MI_COMMAND == pCmd->TheStructure.Common.CommandType &&
|
||||
MI_LOAD_REGISTER_REG::MI_COMMAND_OPCODE_MI_LOAD_REGISTER_REG == pCmd->TheStructure.Common.MiCommandOpcode
|
||||
? pCmd
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
MI_SEMAPHORE_WAIT *genCmdCast<MI_SEMAPHORE_WAIT *>(void *buffer) {
|
||||
auto pCmd = reinterpret_cast<MI_SEMAPHORE_WAIT *>(buffer);
|
||||
|
||||
return MI_SEMAPHORE_WAIT::COMMAND_TYPE_MI_COMMAND == pCmd->TheStructure.Common.CommandType &&
|
||||
MI_SEMAPHORE_WAIT::MI_COMMAND_OPCODE_MI_SEMAPHORE_WAIT == pCmd->TheStructure.Common.MiCommandOpcode
|
||||
? pCmd
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
MI_STORE_DATA_IMM *genCmdCast<MI_STORE_DATA_IMM *>(void *buffer) {
|
||||
auto pCmd = reinterpret_cast<MI_STORE_DATA_IMM *>(buffer);
|
||||
|
||||
return MI_STORE_DATA_IMM::COMMAND_TYPE_MI_COMMAND == pCmd->TheStructure.Common.CommandType &&
|
||||
MI_STORE_DATA_IMM::MI_COMMAND_OPCODE_MI_STORE_DATA_IMM == pCmd->TheStructure.Common.MiCommandOpcode
|
||||
? pCmd
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
MI_FLUSH_DW *genCmdCast<MI_FLUSH_DW *>(void *buffer) {
|
||||
auto pCmd = reinterpret_cast<MI_FLUSH_DW *>(buffer);
|
||||
|
||||
return MI_FLUSH_DW::COMMAND_TYPE_MI_COMMAND == pCmd->TheStructure.Common.CommandType &&
|
||||
MI_FLUSH_DW::MI_COMMAND_OPCODE_MI_FLUSH_DW == pCmd->TheStructure.Common.MiCommandOpcode
|
||||
? pCmd
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
XY_COPY_BLT *genCmdCast<XY_COPY_BLT *>(void *buffer) {
|
||||
auto pCmd = reinterpret_cast<XY_COPY_BLT *>(buffer);
|
||||
|
||||
return XY_COPY_BLT::INSTRUCTIONTARGET_OPCODE_OPCODE == pCmd->TheStructure.Common.InstructionTarget_Opcode &&
|
||||
XY_COPY_BLT::CLIENT_2D_PROCESSOR == pCmd->TheStructure.Common.Client
|
||||
? pCmd
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
size_t CmdParse<T>::getCommandLength(void *cmd) {
|
||||
{
|
||||
auto pCmd = genCmdCast<STATE_BASE_ADDRESS *>(cmd);
|
||||
if (pCmd)
|
||||
return pCmd->TheStructure.Common.DwordLength + 2;
|
||||
}
|
||||
{
|
||||
auto pCmd = genCmdCast<PIPE_CONTROL *>(cmd);
|
||||
if (pCmd)
|
||||
return pCmd->TheStructure.Common.DwordLength + 2;
|
||||
}
|
||||
{
|
||||
auto pCmd = genCmdCast<MI_ARB_CHECK *>(cmd);
|
||||
if (pCmd)
|
||||
return SIZE32(*pCmd);
|
||||
}
|
||||
{
|
||||
auto pCmd = genCmdCast<MI_ATOMIC *>(cmd);
|
||||
if (pCmd)
|
||||
return sizeof(MI_ATOMIC) / sizeof(uint32_t);
|
||||
}
|
||||
{
|
||||
auto pCmd = genCmdCast<MI_BATCH_BUFFER_END *>(cmd);
|
||||
if (pCmd)
|
||||
return SIZE32(*pCmd);
|
||||
}
|
||||
{
|
||||
auto pCmd = genCmdCast<MI_BATCH_BUFFER_START *>(cmd);
|
||||
if (pCmd)
|
||||
return pCmd->TheStructure.Common.DwordLength + 2;
|
||||
}
|
||||
{
|
||||
auto pCmd = genCmdCast<MI_LOAD_REGISTER_IMM *>(cmd);
|
||||
if (pCmd)
|
||||
return pCmd->TheStructure.Common.DwordLength + 2;
|
||||
}
|
||||
{
|
||||
auto pCmd = genCmdCast<MI_LOAD_REGISTER_MEM *>(cmd);
|
||||
if (pCmd)
|
||||
return pCmd->TheStructure.Common.DwordLength + 2;
|
||||
}
|
||||
{
|
||||
auto pCmd = genCmdCast<MI_STORE_REGISTER_MEM *>(cmd);
|
||||
if (pCmd)
|
||||
return pCmd->TheStructure.Common.DwordLength + 2;
|
||||
}
|
||||
{
|
||||
auto pCmd = genCmdCast<MI_NOOP *>(cmd);
|
||||
if (pCmd)
|
||||
return SIZE32(*pCmd);
|
||||
}
|
||||
{
|
||||
auto pCmd = genCmdCast<PIPELINE_SELECT *>(cmd);
|
||||
if (pCmd)
|
||||
return SIZE32(*pCmd);
|
||||
}
|
||||
{
|
||||
auto pCmd = genCmdCast<MI_REPORT_PERF_COUNT *>(cmd);
|
||||
if (pCmd)
|
||||
return pCmd->TheStructure.Common.DwordLength + 2;
|
||||
}
|
||||
{
|
||||
auto pCmd = genCmdCast<MI_MATH *>(cmd);
|
||||
if (pCmd)
|
||||
return pCmd->DW0.BitField.DwordLength + 2;
|
||||
}
|
||||
{
|
||||
auto pCmd = genCmdCast<MI_LOAD_REGISTER_REG *>(cmd);
|
||||
if (pCmd)
|
||||
return pCmd->TheStructure.Common.DwordLength + 2;
|
||||
}
|
||||
{
|
||||
auto pCmd = genCmdCast<MI_SEMAPHORE_WAIT *>(cmd);
|
||||
if (pCmd)
|
||||
return pCmd->TheStructure.Common.DwordLength + 2;
|
||||
}
|
||||
{
|
||||
auto pCmd = genCmdCast<MI_STORE_DATA_IMM *>(cmd);
|
||||
if (pCmd)
|
||||
return pCmd->TheStructure.Common.DwordLength + 3;
|
||||
}
|
||||
{
|
||||
auto pCmd = genCmdCast<MI_FLUSH_DW *>(cmd);
|
||||
if (pCmd)
|
||||
return pCmd->TheStructure.Common.DwordLength + 2;
|
||||
}
|
||||
{
|
||||
auto pCmd = genCmdCast<XY_COPY_BLT *>(cmd);
|
||||
if (pCmd)
|
||||
return pCmd->TheStructure.Common.DwordLength + 2;
|
||||
}
|
||||
|
||||
auto commandLengthHwSpecific = getCommandLengthHwSpecific(cmd);
|
||||
|
||||
if (commandLengthHwSpecific != 0) {
|
||||
return commandLengthHwSpecific;
|
||||
}
|
||||
return getAdditionalCommandLength(cmd);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
const char *CmdParse<T>::getCommandName(void *cmd) {
|
||||
#define RETURN_NAME_IF(CMD_NAME) \
|
||||
if (nullptr != genCmdCast<CMD_NAME *>(cmd)) \
|
||||
return #CMD_NAME;
|
||||
|
||||
RETURN_NAME_IF(STATE_BASE_ADDRESS);
|
||||
RETURN_NAME_IF(PIPE_CONTROL);
|
||||
RETURN_NAME_IF(MI_ARB_CHECK);
|
||||
RETURN_NAME_IF(MI_ATOMIC);
|
||||
RETURN_NAME_IF(MI_BATCH_BUFFER_END);
|
||||
RETURN_NAME_IF(MI_BATCH_BUFFER_START);
|
||||
RETURN_NAME_IF(MI_LOAD_REGISTER_IMM);
|
||||
RETURN_NAME_IF(MI_LOAD_REGISTER_MEM);
|
||||
RETURN_NAME_IF(MI_STORE_REGISTER_MEM);
|
||||
RETURN_NAME_IF(MI_NOOP);
|
||||
RETURN_NAME_IF(PIPELINE_SELECT);
|
||||
RETURN_NAME_IF(MI_REPORT_PERF_COUNT);
|
||||
RETURN_NAME_IF(MI_MATH);
|
||||
RETURN_NAME_IF(MI_LOAD_REGISTER_REG);
|
||||
RETURN_NAME_IF(MI_SEMAPHORE_WAIT);
|
||||
RETURN_NAME_IF(MI_STORE_DATA_IMM);
|
||||
RETURN_NAME_IF(MI_FLUSH_DW);
|
||||
RETURN_NAME_IF(XY_COPY_BLT);
|
||||
|
||||
#undef RETURN_NAME_IF
|
||||
|
||||
auto commandNameHwSpecific = getCommandNameHwSpecific(cmd);
|
||||
if (strcmp(commandNameHwSpecific, "UNKNOWN") != 0) {
|
||||
return commandNameHwSpecific;
|
||||
}
|
||||
|
||||
return getAdditionalCommandName(cmd);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
size_t CmdParse<T>::getAdditionalCommandLength(void *cmd) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
const char *CmdParse<T>::getAdditionalCommandName(void *cmd) {
|
||||
return "UNKNOWN";
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
template <>
|
||||
MI_ARB_CHECK *genCmdCast<MI_ARB_CHECK *>(void *buffer) {
|
||||
auto pCmd = reinterpret_cast<MI_ARB_CHECK *>(buffer);
|
||||
|
||||
return MI_ARB_CHECK::MI_INSTRUCTION_TYPE_MI_INSTRUCTION == pCmd->TheStructure.Common.MiInstructionType &&
|
||||
MI_ARB_CHECK::MI_INSTRUCTION_OPCODE_MI_ARB_CHECK == pCmd->TheStructure.Common.MiInstructionOpcode
|
||||
? pCmd
|
||||
: nullptr;
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
// clang-format off
|
||||
using namespace NEO;
|
||||
using STATE_COMPUTE_MODE = GenStruct::STATE_COMPUTE_MODE;
|
||||
// clang-format on
|
||||
|
||||
template <>
|
||||
STATE_COMPUTE_MODE *genCmdCast<STATE_COMPUTE_MODE *>(void *buffer) {
|
||||
auto pCmd = reinterpret_cast<STATE_COMPUTE_MODE *>(buffer);
|
||||
|
||||
return STATE_COMPUTE_MODE::COMMAND_TYPE_GFXPIPE == pCmd->TheStructure.Common.CommandType &&
|
||||
STATE_COMPUTE_MODE::COMMAND_SUBTYPE_GFXPIPE_COMMON == pCmd->TheStructure.Common.CommandSubtype &&
|
||||
STATE_COMPUTE_MODE::_3D_COMMAND_OPCODE_GFXPIPE_NONPIPELINED == pCmd->TheStructure.Common._3DCommandOpcode &&
|
||||
STATE_COMPUTE_MODE::_3D_COMMAND_SUB_OPCODE_STATE_COMPUTE_MODE == pCmd->TheStructure.Common._3DCommandSubOpcode
|
||||
? pCmd
|
||||
: nullptr;
|
||||
}
|
@ -1,162 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
// clang-format off
|
||||
using namespace NEO;
|
||||
using GPGPU_WALKER = GenStruct::GPGPU_WALKER;
|
||||
using MEDIA_INTERFACE_DESCRIPTOR_LOAD = GenStruct::MEDIA_INTERFACE_DESCRIPTOR_LOAD;
|
||||
using MEDIA_STATE_FLUSH = GenStruct::MEDIA_STATE_FLUSH;
|
||||
using MEDIA_VFE_STATE = GenStruct::MEDIA_VFE_STATE;
|
||||
// clang-format on
|
||||
|
||||
template <>
|
||||
GPGPU_WALKER *genCmdCast<GPGPU_WALKER *>(void *buffer) {
|
||||
auto pCmd = reinterpret_cast<GPGPU_WALKER *>(buffer);
|
||||
|
||||
return GPGPU_WALKER::COMMAND_TYPE_GFXPIPE == pCmd->TheStructure.Common.CommandType &&
|
||||
GPGPU_WALKER::PIPELINE_MEDIA == pCmd->TheStructure.Common.Pipeline &&
|
||||
GPGPU_WALKER::MEDIA_COMMAND_OPCODE_GPGPU_WALKER == pCmd->TheStructure.Common.MediaCommandOpcode &&
|
||||
GPGPU_WALKER::SUBOPCODE_GPGPU_WALKER_SUBOP == pCmd->TheStructure.Common.Subopcode
|
||||
? pCmd
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
MEDIA_INTERFACE_DESCRIPTOR_LOAD *genCmdCast<MEDIA_INTERFACE_DESCRIPTOR_LOAD *>(void *buffer) {
|
||||
auto pCmd = reinterpret_cast<MEDIA_INTERFACE_DESCRIPTOR_LOAD *>(buffer);
|
||||
|
||||
return MEDIA_INTERFACE_DESCRIPTOR_LOAD::COMMAND_TYPE_GFXPIPE == pCmd->TheStructure.Common.CommandType &&
|
||||
MEDIA_INTERFACE_DESCRIPTOR_LOAD::PIPELINE_MEDIA == pCmd->TheStructure.Common.Pipeline &&
|
||||
MEDIA_INTERFACE_DESCRIPTOR_LOAD::MEDIA_COMMAND_OPCODE_MEDIA_INTERFACE_DESCRIPTOR_LOAD == pCmd->TheStructure.Common.MediaCommandOpcode &&
|
||||
MEDIA_INTERFACE_DESCRIPTOR_LOAD::SUBOPCODE_MEDIA_INTERFACE_DESCRIPTOR_LOAD_SUBOP == pCmd->TheStructure.Common.Subopcode
|
||||
? pCmd
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
MEDIA_VFE_STATE *genCmdCast<MEDIA_VFE_STATE *>(void *buffer) {
|
||||
auto pCmd = reinterpret_cast<MEDIA_VFE_STATE *>(buffer);
|
||||
|
||||
return MEDIA_VFE_STATE::COMMAND_TYPE_GFXPIPE == pCmd->TheStructure.Common.CommandType &&
|
||||
MEDIA_VFE_STATE::PIPELINE_MEDIA == pCmd->TheStructure.Common.Pipeline &&
|
||||
MEDIA_VFE_STATE::MEDIA_COMMAND_OPCODE_MEDIA_VFE_STATE == pCmd->TheStructure.Common.MediaCommandOpcode &&
|
||||
MEDIA_VFE_STATE::SUBOPCODE_MEDIA_VFE_STATE_SUBOP == pCmd->TheStructure.Common.Subopcode
|
||||
? pCmd
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
MEDIA_STATE_FLUSH *genCmdCast<MEDIA_STATE_FLUSH *>(void *buffer) {
|
||||
auto pCmd = reinterpret_cast<MEDIA_STATE_FLUSH *>(buffer);
|
||||
|
||||
return MEDIA_STATE_FLUSH::COMMAND_TYPE_GFXPIPE == pCmd->TheStructure.Common.CommandType &&
|
||||
MEDIA_STATE_FLUSH::PIPELINE_MEDIA == pCmd->TheStructure.Common.Pipeline &&
|
||||
MEDIA_STATE_FLUSH::MEDIA_COMMAND_OPCODE_MEDIA_STATE_FLUSH == pCmd->TheStructure.Common.MediaCommandOpcode &&
|
||||
MEDIA_STATE_FLUSH::SUBOPCODE_MEDIA_STATE_FLUSH_SUBOP == pCmd->TheStructure.Common.Subopcode
|
||||
? pCmd
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool CmdParse<T>::parseCommandBuffer(GenCmdList &cmds, void *buffer, size_t length) {
|
||||
if (!buffer || length % sizeof(uint32_t)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void *bufferEnd = reinterpret_cast<uint8_t *>(buffer) + length;
|
||||
while (buffer < bufferEnd) {
|
||||
size_t length = getCommandLength(buffer);
|
||||
if (!length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
cmds.push_back(buffer);
|
||||
|
||||
buffer = reinterpret_cast<uint32_t *>(buffer) + length;
|
||||
}
|
||||
|
||||
return buffer == bufferEnd;
|
||||
}
|
||||
|
||||
// MIDL should have a MSF between it and a previous walker
|
||||
template <>
|
||||
template <>
|
||||
void CmdParse<GenGfxFamily>::validateCommand<MEDIA_INTERFACE_DESCRIPTOR_LOAD *>(GenCmdList::iterator itorBegin, GenCmdList::iterator itorEnd) {
|
||||
auto itorCurrent = itorBegin;
|
||||
auto itorWalker = itorEnd;
|
||||
|
||||
// Find last GPGPU_WALKER prior to itorCmd
|
||||
while (itorCurrent != itorEnd) {
|
||||
if (genCmdCast<GPGPU_WALKER *>(*itorCurrent)) {
|
||||
itorWalker = itorCurrent;
|
||||
}
|
||||
|
||||
++itorCurrent;
|
||||
}
|
||||
|
||||
// If we don't find a GPGPU_WALKER, assume the beginning of a cmd list
|
||||
itorWalker = itorWalker == itorEnd
|
||||
? itorBegin
|
||||
: itorWalker;
|
||||
|
||||
// Look for MEDIA_STATE_FLUSH between last GPGPU_WALKER and MIDL.
|
||||
auto itorMSF = itorEnd;
|
||||
|
||||
itorCurrent = itorWalker;
|
||||
++itorCurrent;
|
||||
while (itorCurrent != itorEnd) {
|
||||
if (genCmdCast<MEDIA_STATE_FLUSH *>(*itorCurrent)) {
|
||||
itorMSF = itorCurrent;
|
||||
break;
|
||||
}
|
||||
++itorCurrent;
|
||||
}
|
||||
|
||||
ASSERT_FALSE(itorMSF == itorEnd) << "A MEDIA_STATE_FLUSH is required before a MEDIA_INTERFACE_DESCRIPTOR_LOAD.";
|
||||
}
|
||||
|
||||
template <>
|
||||
template <>
|
||||
void CmdParse<GenGfxFamily>::validateCommand<STATE_BASE_ADDRESS *>(GenCmdList::iterator itorBegin, GenCmdList::iterator itorEnd) {
|
||||
}
|
||||
|
||||
// MVFES should have a stalling PC between it and a previous walker
|
||||
template <>
|
||||
template <>
|
||||
void CmdParse<GenGfxFamily>::validateCommand<MEDIA_VFE_STATE *>(GenCmdList::iterator itorBegin, GenCmdList::iterator itorEnd) {
|
||||
auto itorCurrent = itorBegin;
|
||||
auto itorWalker = itorEnd;
|
||||
|
||||
// Find last GPGPU_WALKER prior to itorCmd
|
||||
while (itorCurrent != itorEnd) {
|
||||
if (genCmdCast<GPGPU_WALKER *>(*itorCurrent)) {
|
||||
itorWalker = itorCurrent;
|
||||
}
|
||||
|
||||
++itorCurrent;
|
||||
}
|
||||
|
||||
// If we don't find a GPGPU_WALKER, assume the beginning of a cmd list
|
||||
itorWalker = itorWalker == itorEnd
|
||||
? itorBegin
|
||||
: itorWalker;
|
||||
|
||||
// Look for PIPE_CONTROL between last GPGPU_WALKER and MVFES.
|
||||
itorCurrent = itorWalker;
|
||||
++itorCurrent;
|
||||
while (itorCurrent != itorEnd) {
|
||||
if (genCmdCast<PIPE_CONTROL *>(*itorCurrent)) {
|
||||
auto pPC = genCmdCast<PIPE_CONTROL *>(*itorCurrent);
|
||||
if (pPC->getCommandStreamerStallEnable()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
++itorCurrent;
|
||||
}
|
||||
|
||||
ASSERT_TRUE(false) << "A PIPE_CONTROL w/ CS stall is required before a MEDIA_VFE_STATE.";
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
template <>
|
||||
MI_ARB_CHECK *genCmdCast<MI_ARB_CHECK *>(void *buffer) {
|
||||
auto pCmd = reinterpret_cast<MI_ARB_CHECK *>(buffer);
|
||||
|
||||
return MI_ARB_CHECK::COMMAND_TYPE_MI_COMMAND == pCmd->TheStructure.Common.CommandType &&
|
||||
MI_ARB_CHECK::MI_COMMAND_OPCODE_MI_ARB_CHECK == pCmd->TheStructure.Common.MiCommandOpcode
|
||||
? pCmd
|
||||
: nullptr;
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
// clang-format off
|
||||
using namespace NEO;
|
||||
using GPGPU_CSR_BASE_ADDRESS = GenStruct::GPGPU_CSR_BASE_ADDRESS;
|
||||
using STATE_SIP = GenStruct::STATE_SIP;
|
||||
// clang-format on
|
||||
|
||||
template <>
|
||||
GPGPU_CSR_BASE_ADDRESS *genCmdCast<GPGPU_CSR_BASE_ADDRESS *>(void *buffer) {
|
||||
auto pCmd = reinterpret_cast<GPGPU_CSR_BASE_ADDRESS *>(buffer);
|
||||
|
||||
return GPGPU_CSR_BASE_ADDRESS::COMMAND_TYPE_GFXPIPE == pCmd->TheStructure.Common.CommandType &&
|
||||
GPGPU_CSR_BASE_ADDRESS::COMMAND_SUBTYPE_GFXPIPE_COMMON == pCmd->TheStructure.Common.CommandSubtype &&
|
||||
GPGPU_CSR_BASE_ADDRESS::_3D_COMMAND_OPCODE_GFXPIPE_NONPIPELINED == pCmd->TheStructure.Common._3DCommandOpcode &&
|
||||
GPGPU_CSR_BASE_ADDRESS::_3D_COMMAND_SUB_OPCODE_GPGPU_CSR_BASE_ADDRESS == pCmd->TheStructure.Common._3DCommandSubOpcode
|
||||
? pCmd
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
@ -1,103 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/helpers/hw_cmds.h"
|
||||
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
typedef std::list<void *> GenCmdList;
|
||||
|
||||
template <typename Type>
|
||||
Type genCmdCast(void *cmd);
|
||||
|
||||
template <typename Type>
|
||||
static inline GenCmdList::iterator find(GenCmdList::iterator itorStart, GenCmdList::const_iterator itorEnd) {
|
||||
GenCmdList::iterator itor = itorStart;
|
||||
while (itor != itorEnd) {
|
||||
if (genCmdCast<Type>(*itor))
|
||||
break;
|
||||
++itor;
|
||||
}
|
||||
return itor;
|
||||
}
|
||||
|
||||
template <typename CommandToFind>
|
||||
static inline std::vector<GenCmdList::iterator> findAll(GenCmdList::iterator commandListStart, GenCmdList::const_iterator commandListEnd) {
|
||||
std::vector<GenCmdList::iterator> matchedCommands;
|
||||
GenCmdList::iterator currentCommand = commandListStart;
|
||||
while (currentCommand != commandListEnd) {
|
||||
if (genCmdCast<CommandToFind>(*currentCommand)) {
|
||||
matchedCommands.push_back(currentCommand);
|
||||
}
|
||||
++currentCommand;
|
||||
}
|
||||
return matchedCommands;
|
||||
}
|
||||
|
||||
template <typename FamilyType>
|
||||
static inline GenCmdList::iterator findMmio(GenCmdList::iterator itorStart, GenCmdList::const_iterator itorEnd, uint32_t regOffset) {
|
||||
GenCmdList::iterator itor = itorStart;
|
||||
while (itor != itorEnd) {
|
||||
auto cmd = genCmdCast<typename FamilyType::MI_LOAD_REGISTER_IMM *>(*itor);
|
||||
if (cmd && cmd->getRegisterOffset() == regOffset)
|
||||
break;
|
||||
++itor;
|
||||
}
|
||||
return itor;
|
||||
}
|
||||
|
||||
template <typename FamilyType>
|
||||
static inline size_t countMmio(GenCmdList::iterator itorStart, GenCmdList::const_iterator itorEnd, uint32_t regOffset) {
|
||||
size_t count = 0;
|
||||
GenCmdList::iterator itor = itorStart;
|
||||
while (itor != itorEnd) {
|
||||
auto cmd = genCmdCast<typename FamilyType::MI_LOAD_REGISTER_IMM *>(*itor);
|
||||
if (cmd && cmd->getRegisterOffset() == regOffset) {
|
||||
++count;
|
||||
}
|
||||
++itor;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
template <typename FamilyType>
|
||||
static inline typename FamilyType::MI_LOAD_REGISTER_IMM *findMmioCmd(GenCmdList::iterator itorStart, GenCmdList::const_iterator itorEnd, uint32_t regOffset) {
|
||||
auto itor = findMmio<FamilyType>(itorStart, itorEnd, regOffset);
|
||||
if (itor == itorEnd) {
|
||||
return nullptr;
|
||||
}
|
||||
return reinterpret_cast<typename FamilyType::MI_LOAD_REGISTER_IMM *>(*itor);
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
static inline GenCmdList::reverse_iterator reverse_find(GenCmdList::reverse_iterator itorStart, GenCmdList::const_reverse_iterator itorEnd) {
|
||||
GenCmdList::reverse_iterator itor = itorStart;
|
||||
while (itor != itorEnd) {
|
||||
if (genCmdCast<Type>(*itor))
|
||||
break;
|
||||
++itor;
|
||||
}
|
||||
return itor;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
struct CmdParse : public T {
|
||||
static size_t getCommandLength(void *cmd);
|
||||
static size_t getCommandLengthHwSpecific(void *cmd);
|
||||
static size_t getAdditionalCommandLength(void *cmd);
|
||||
|
||||
static bool parseCommandBuffer(GenCmdList &cmds, void *buffer, size_t length);
|
||||
|
||||
template <typename CmdType>
|
||||
static void validateCommand(GenCmdList::iterator itorBegin, GenCmdList::iterator itorEnd);
|
||||
|
||||
static const char *getCommandName(void *cmd);
|
||||
static const char *getCommandNameHwSpecific(void *cmd);
|
||||
static const char *getAdditionalCommandName(void *cmd);
|
||||
};
|
@ -9,8 +9,8 @@
|
||||
|
||||
#include "shared/source/indirect_heap/indirect_heap.h"
|
||||
#include "shared/source/memory_manager/memory_constants.h"
|
||||
#include "shared/test/unit_test/cmd_parse/gen_cmd_parse.h"
|
||||
|
||||
#include "opencl/test/unit_test/gen_common/gen_cmd_parse.h"
|
||||
#include "opencl/test/unit_test/helpers/unit_test_helper.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
Reference in New Issue
Block a user