Switch to 3D pipeline to program selected commands - part 2

Resolves: NEO-4447

Change-Id: I1dd6a9694cdf3be19aadec1cd139c466baecbcd7
Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2020-03-25 10:04:42 +01:00
committed by sys_ocldev
parent 5d756b7b15
commit d1bc7199de
8 changed files with 115 additions and 6 deletions

View File

@@ -260,8 +260,13 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandEncodeStatesTest, givenCleanHeapsAndSlmNotCha
GenCmdList commands;
CmdParse<FamilyType>::parseCommandBuffer(commands, ptrOffset(cmdContainer->getCommandStream()->getCpuBase(), 0), cmdContainer->getCommandStream()->getUsed());
auto itorPC = find<PIPE_CONTROL *>(commands.begin(), commands.end());
ASSERT_EQ(itorPC, commands.end());
if (HardwareCommandsHelper<TGLLPFamily>::isPipeControlPriorToPipelineSelectWArequired(pDevice->getHardwareInfo())) {
auto itorPC = findAll<PIPE_CONTROL *>(commands.begin(), commands.end());
EXPECT_EQ(2u, itorPC.size());
} else {
auto itorPC = find<PIPE_CONTROL *>(commands.begin(), commands.end());
ASSERT_EQ(itorPC, commands.end());
}
}
HWCMDTEST_F(IGFX_GEN8_CORE, CommandEncodeStatesTest, givenDirtyHeapsAndSlmNotChangedWhenDispatchKernelThenHeapsAreCleanAndFlushAdded) {

View File

@@ -107,7 +107,6 @@ HWTEST_F(CommandEncodeStatesTest, givenCreatedSurfaceStateBufferWhenGpuCoherency
HWTEST_F(CommandEncodeStatesTest, givenCommandContainerWithDirtyHeapsWhenSetStateBaseAddressCalledThenStateBaseAddressAreNotSet) {
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
cmdContainer->dirtyHeaps = 0;
auto baseAddres = cmdContainer->getCommandStream()->getCpuBase();
cmdContainer->setHeapDirty(NEO::HeapType::DYNAMIC_STATE);
cmdContainer->setHeapDirty(NEO::HeapType::INDIRECT_OBJECT);
@@ -119,7 +118,11 @@ HWTEST_F(CommandEncodeStatesTest, givenCommandContainerWithDirtyHeapsWhenSetStat
auto ioh = cmdContainer->getIndirectHeap(NEO::HeapType::INDIRECT_OBJECT);
auto ssh = cmdContainer->getIndirectHeap(NEO::HeapType::SURFACE_STATE);
auto pCmd = static_cast<STATE_BASE_ADDRESS *>(baseAddres);
GenCmdList commands;
CmdParse<FamilyType>::parseCommandBuffer(commands, ptrOffset(cmdContainer->getCommandStream()->getCpuBase(), 0), cmdContainer->getCommandStream()->getUsed());
auto itorCmd = find<STATE_BASE_ADDRESS *>(commands.begin(), commands.end());
auto pCmd = genCmdCast<STATE_BASE_ADDRESS *>(*itorCmd);
EXPECT_EQ(dsh->getHeapGpuBase(), pCmd->getDynamicStateBaseAddress());
EXPECT_EQ(ioh->getHeapGpuBase(), pCmd->getIndirectObjectBaseAddress());

View File

@@ -7,6 +7,8 @@
#include "shared/source/command_container/cmdcontainer.h"
#include "shared/source/command_container/command_encoder.h"
#include "shared/source/helpers/preamble.h"
#include "shared/source/os_interface/os_context.h"
#include "shared/test/unit_test/cmd_parse/gen_cmd_parse.h"
#include "opencl/test/unit_test/fixtures/device_fixture.h"
@@ -62,3 +64,53 @@ GEN12LPTEST_F(CommandEncoderTest, givenCommandContainerWhenEncodeL3StateThenSetC
EXPECT_EQ(cmd->getRegisterOffset(), 0xB134u);
EXPECT_EQ(cmd->getDataDword(), 0xD0000020u);
}
struct MockOsContext : public OsContext {
using OsContext::engineType;
};
GEN12LPTEST_F(CommandEncoderTest, givenVariousEngineTypesWhenEncodeSBAThenAdditionalPipelineSelectWAIsAppliedOnlyToRcs) {
using PIPELINE_SELECT = typename FamilyType::PIPELINE_SELECT;
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
CommandContainer cmdContainer;
bool ret = cmdContainer.initialize(pDevice);
ASSERT_TRUE(ret);
{
EncodeStateBaseAddress<FamilyType>::encode(cmdContainer);
GenCmdList commands;
CmdParse<FamilyType>::parseCommandBuffer(commands, ptrOffset(cmdContainer.getCommandStream()->getCpuBase(), 0), cmdContainer.getCommandStream()->getUsed());
auto itorLRI = find<PIPELINE_SELECT *>(commands.begin(), commands.end());
EXPECT_NE(itorLRI, commands.end());
}
cmdContainer.reset();
{
static_cast<MockOsContext *>(pDevice->getDefaultEngine().osContext)->engineType = aub_stream::ENGINE_CCS;
EncodeStateBaseAddress<FamilyType>::encode(cmdContainer);
GenCmdList commands;
CmdParse<FamilyType>::parseCommandBuffer(commands, ptrOffset(cmdContainer.getCommandStream()->getCpuBase(), 0), cmdContainer.getCommandStream()->getUsed());
auto itorLRI = find<PIPELINE_SELECT *>(commands.begin(), commands.end());
EXPECT_EQ(itorLRI, commands.end());
}
}
GEN12LPTEST_F(CommandEncoderTest, givenVariousEngineTypesWhenEstimateCommandBufferSizeThenRcsHasAdditionalPipelineSelectWASize) {
using PIPELINE_SELECT = typename FamilyType::PIPELINE_SELECT;
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
auto sizeWA = EncodeDispatchKernel<FamilyType>::estimateEncodeDispatchKernelCmdsSize(pDevice);
static_cast<MockOsContext *>(pDevice->getDefaultEngine().osContext)->engineType = aub_stream::ENGINE_CCS;
auto size = EncodeDispatchKernel<FamilyType>::estimateEncodeDispatchKernelCmdsSize(pDevice);
auto expectedDiff = 2 * PreambleHelper<FamilyType>::getCmdSizeForPipelineSelect(pDevice->getHardwareInfo());
auto diff = sizeWA - size;
EXPECT_EQ(expectedDiff, diff);
}