performance: use RESOURCE_BARRIER as stalling barrier

Related-To: NEO-14943

Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
Szymon Morek
2025-05-28 10:45:44 +00:00
committed by Compute-Runtime-Automation
parent e6f3ebce5d
commit 556c0b64c6
32 changed files with 214 additions and 79 deletions

View File

@@ -40,5 +40,6 @@ if(TESTS_XE2_AND_LATER)
target_sources(neo_libult_common PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/cmd_parse_state_context_data_base_address.inl
${CMAKE_CURRENT_SOURCE_DIR}/hw_parse_xe2_hpg_and_later.inl
${CMAKE_CURRENT_SOURCE_DIR}/cmd_parse_resource_barrier.inl
)
endif()

View File

@@ -0,0 +1,22 @@
/*
* Copyright (C) 2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
using namespace NEO;
using RESOURCE_BARRIER = GenStruct::RESOURCE_BARRIER;
template <>
RESOURCE_BARRIER *genCmdCast<RESOURCE_BARRIER *>(void *buffer) {
auto pCmd = reinterpret_cast<RESOURCE_BARRIER *>(buffer);
return (0x3 == pCmd->TheStructure.Common.DwordLength &&
0x3 == pCmd->TheStructure.Common.Opcode &&
0x5 == pCmd->TheStructure.Common.CommandType)
? pCmd
: nullptr;
}

View File

@@ -63,6 +63,9 @@ struct HardwareParse : NEO::NonCopyableAndNonMovableClass {
return true;
}
template <typename FamilyType>
bool isStallingBarrier(GenCmdList::iterator &iter);
template <typename FamilyType>
void findHardwareCommands();

View File

@@ -155,4 +155,22 @@ const typename FamilyType::RENDER_SURFACE_STATE *HardwareParse::getSurfaceState(
}
}
template <typename FamilyType>
bool HardwareParse::isStallingBarrier(GenCmdList::iterator &iter) {
PIPE_CONTROL *pipeControlCmd = genCmdCast<PIPE_CONTROL *>(*iter);
if (pipeControlCmd == nullptr) {
return false;
}
EXPECT_EQ(pipeControlCmd->getCommandStreamerStallEnable(), true);
EXPECT_EQ(pipeControlCmd->getDcFlushEnable(), false);
EXPECT_EQ(pipeControlCmd->getRenderTargetCacheFlushEnable(), false);
EXPECT_EQ(pipeControlCmd->getInstructionCacheInvalidateEnable(), false);
EXPECT_EQ(pipeControlCmd->getTextureCacheInvalidationEnable(), false);
EXPECT_EQ(pipeControlCmd->getPipeControlFlushEnable(), false);
EXPECT_EQ(pipeControlCmd->getVfCacheInvalidationEnable(), false);
EXPECT_EQ(pipeControlCmd->getConstantCacheInvalidationEnable(), false);
EXPECT_EQ(pipeControlCmd->getStateCacheInvalidationEnable(), false);
return true;
}
} // namespace NEO

View File

@@ -23,4 +23,13 @@ bool HardwareParse::requiresPipelineSelectBeforeMediaState<GenGfxFamily>() {
return false;
}
template <>
bool HardwareParse::isStallingBarrier<GenGfxFamily>(GenCmdList::iterator &iter) {
GenGfxFamily::RESOURCE_BARRIER *resourceBarrierCmd = genCmdCast<GenGfxFamily::RESOURCE_BARRIER *>(*iter);
EXPECT_EQ(resourceBarrierCmd->getBarrierType(), RESOURCE_BARRIER::BARRIER_TYPE::BARRIER_TYPE_IMMEDIATE);
EXPECT_EQ(resourceBarrierCmd->getWaitStage(), RESOURCE_BARRIER::WAIT_STAGE::WAIT_STAGE_TOP);
EXPECT_EQ(resourceBarrierCmd->getSignalStage(), RESOURCE_BARRIER::SIGNAL_STAGE::SIGNAL_STAGE_GPGPU);
return resourceBarrierCmd != nullptr;
}
} // namespace NEO

View File

@@ -132,4 +132,6 @@ template void HardwareParse::findHardwareCommands<Gen12LpFamily>();
template void HardwareParse::findHardwareCommands<Gen12LpFamily>(IndirectHeap *);
template const void *HardwareParse::getStatelessArgumentPointer<Gen12LpFamily>(const KernelInfo &kernelInfo, uint32_t indexArg, IndirectHeap &ioh, uint32_t rootDeviceIndex);
template const typename Gen12LpFamily::RENDER_SURFACE_STATE *HardwareParse::getSurfaceState<Gen12LpFamily>(IndirectHeap *ssh, uint32_t index);
template bool HardwareParse::isStallingBarrier<Gen12LpFamily>(GenCmdList::iterator &iter);
} // namespace NEO

View File

@@ -11,6 +11,7 @@ using GenGfxFamily = NEO::Xe2HpgCoreFamily;
#include "shared/test/common/cmd_parse/cmd_parse_mem_fence.inl"
#include "shared/test/common/cmd_parse/cmd_parse_mem_set.inl"
#include "shared/test/common/cmd_parse/cmd_parse_resource_barrier.inl"
#include "shared/test/common/cmd_parse/cmd_parse_state_context_data_base_address.inl"
#include "shared/test/common/cmd_parse/cmd_parse_state_prefetch.inl"
#include "shared/test/common/cmd_parse/cmd_parse_system_mem_fence_address.inl"
@@ -22,6 +23,7 @@ using STATE_SYSTEM_MEM_FENCE_ADDRESS = GenStruct::STATE_SYSTEM_MEM_FENCE_ADDRESS
using STATE_PREFETCH = GenStruct::STATE_PREFETCH;
using MEM_SET = GenStruct::MEM_SET;
using STATE_CONTEXT_DATA_BASE_ADDRESS = GenStruct::STATE_CONTEXT_DATA_BASE_ADDRESS;
using RESOURCE_BARRIER = GenStruct::RESOURCE_BARRIER;
template <>
size_t CmdParse<GenGfxFamily>::getAdditionalCommandLength(void *cmd) {
@@ -50,6 +52,11 @@ size_t CmdParse<GenGfxFamily>::getAdditionalCommandLength(void *cmd) {
return sizeof(STATE_CONTEXT_DATA_BASE_ADDRESS) / sizeof(uint32_t);
}
}
{
if (genCmdCast<RESOURCE_BARRIER *>(cmd)) {
return sizeof(RESOURCE_BARRIER) / sizeof(uint32_t);
}
}
return 0;
}

View File

@@ -12,6 +12,7 @@ using GenGfxFamily = NEO::Xe3CoreFamily;
#include "shared/test/common/cmd_parse/cmd_parse_mem_fence.inl"
#include "shared/test/common/cmd_parse/cmd_parse_mem_set.inl"
#include "shared/test/common/cmd_parse/cmd_parse_resource_barrier.inl"
#include "shared/test/common/cmd_parse/cmd_parse_state_context_data_base_address.inl"
#include "shared/test/common/cmd_parse/cmd_parse_state_prefetch.inl"
#include "shared/test/common/cmd_parse/cmd_parse_system_mem_fence_address.inl"
@@ -23,6 +24,7 @@ using STATE_SYSTEM_MEM_FENCE_ADDRESS = GenStruct::STATE_SYSTEM_MEM_FENCE_ADDRESS
using STATE_PREFETCH = GenStruct::STATE_PREFETCH;
using MEM_SET = GenStruct::MEM_SET;
using STATE_CONTEXT_DATA_BASE_ADDRESS = GenStruct::STATE_CONTEXT_DATA_BASE_ADDRESS;
using RESOURCE_BARRIER = GenStruct::RESOURCE_BARRIER;
template <>
size_t CmdParse<GenGfxFamily>::getAdditionalCommandLength(void *cmd) {
@@ -51,6 +53,11 @@ size_t CmdParse<GenGfxFamily>::getAdditionalCommandLength(void *cmd) {
return sizeof(STATE_CONTEXT_DATA_BASE_ADDRESS) / sizeof(uint32_t);
}
}
{
if (genCmdCast<RESOURCE_BARRIER *>(cmd)) {
return sizeof(RESOURCE_BARRIER) / sizeof(uint32_t);
}
}
return 0;
}

View File

@@ -71,3 +71,4 @@ const char *CmdParse<GenGfxFamily>::getAdditionalCommandName(void *cmd) {
#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);
template bool NEO::HardwareParse::isStallingBarrier<GenGfxFamily>(GenCmdList::iterator &iter);

View File

@@ -57,3 +57,4 @@ const char *CmdParse<GenGfxFamily>::getAdditionalCommandName(void *cmd) {
#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);
template bool NEO::HardwareParse::isStallingBarrier<GenGfxFamily>(GenCmdList::iterator &iter);