refactor: separate post-sync into EncodePostSync

Created EncodePostSync template struct to organize various post-sync
variables/functions from EncodeDispatchKernel

Signed-off-by: Young Jin Yoon <young.jin.yoon@intel.com>
This commit is contained in:
Young Jin Yoon
2025-03-27 14:02:20 +00:00
committed by Compute-Runtime-Automation
parent 5bcf500c13
commit 0de024dbf9
10 changed files with 184 additions and 94 deletions

View File

@@ -699,11 +699,10 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncoderTests, givenDebugFlagSetWhenProgrammi
}
HWCMDTEST_F(IGFX_GEN12LP_CORE, CommandEncoderTests, givenPreXeHpPlatformWhenSetupPostSyncMocsThenNothingHappen) {
using DefaultWalkerType = typename FamilyType::DefaultWalkerType;
DefaultWalkerType walkerCmd{};
MockExecutionEnvironment executionEnvironment{};
EXPECT_NO_THROW(EncodeDispatchKernel<FamilyType>::setupPostSyncMocs(walkerCmd, *executionEnvironment.rootDeviceEnvironments[0], false));
uint32_t mocs;
EXPECT_NO_THROW(mocs = EncodePostSync<FamilyType>::getPostSyncMocs(*executionEnvironment.rootDeviceEnvironments[0], false));
EXPECT_EQ(0u, mocs);
}
HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncoderTests, givenAtLeastXeHpPlatformWhenSetupPostSyncMocsThenCorrect) {
@@ -716,7 +715,9 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncoderTests, givenAtLeastXeHpPlatformWhenSe
{
DefaultWalkerType walkerCmd{};
EncodeDispatchKernel<FamilyType>::setupPostSyncMocs(walkerCmd, rootDeviceEnvironment, dcFlush);
uint32_t mocs = 0;
EXPECT_NO_THROW(mocs = EncodePostSync<FamilyType>::getPostSyncMocs(*executionEnvironment.rootDeviceEnvironments[0], dcFlush));
EXPECT_NO_THROW(walkerCmd.getPostSync().setMocs(mocs));
auto gmmHelper = rootDeviceEnvironment.getGmmHelper();
auto expectedMocs = dcFlush ? gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED) : gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
@@ -728,7 +729,9 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncoderTests, givenAtLeastXeHpPlatformWhenSe
auto expectedMocs = 9u;
debugManager.flags.OverridePostSyncMocs.set(expectedMocs);
DefaultWalkerType walkerCmd{};
EncodeDispatchKernel<FamilyType>::setupPostSyncMocs(walkerCmd, rootDeviceEnvironment, dcFlush);
uint32_t mocs = 0;
EXPECT_NO_THROW(mocs = EncodePostSync<FamilyType>::getPostSyncMocs(*executionEnvironment.rootDeviceEnvironments[0], false));
EXPECT_NO_THROW(walkerCmd.getPostSync().setMocs(mocs));
EXPECT_EQ(expectedMocs, walkerCmd.getPostSync().getMocs());
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2024 Intel Corporation
* Copyright (C) 2021-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -213,3 +213,19 @@ HWTEST2_F(CommandEncoderTest, givenPredicateBitSetWhenProgrammingBbStartThenSetC
EncodeBatchBufferStartOrEnd<FamilyType>::programBatchBufferStart(&cmdStream, 0, false, false, true);
EXPECT_EQ(1u, cmd.getPredicationEnable());
}
HWTEST_F(CommandEncoderTest, givenEncodePostSyncArgsWhenCallingRequiresSystemMemoryFenceThenCorrectValuesAreReturned) {
EncodePostSyncArgs args{};
for (bool hostScopeSignalEvent : {true, false}) {
for (bool kernelUsingSystemAllocation : {true, false}) {
args.isHostScopeSignalEvent = hostScopeSignalEvent;
args.isKernelUsingSystemAllocation = kernelUsingSystemAllocation;
if (hostScopeSignalEvent && kernelUsingSystemAllocation) {
EXPECT_TRUE(args.requiresSystemMemoryFence());
} else {
EXPECT_FALSE(args.requiresSystemMemoryFence());
}
}
}
}

View File

@@ -127,8 +127,8 @@ HWTEST2_F(CommandEncodeStatesTestPvcAndLater, givenDebugVariableWhenPostSyncIsPr
auto inOrderExecInfo = InOrderExecInfo::create(deviceTagAllocator.getTag(), nullptr, *pDevice, 1, false);
dispatchArgs.inOrderExecInfo = inOrderExecInfo.get();
EncodeDispatchKernel<FamilyType>::template setupPostSyncForInOrderExec<DefaultWalkerType>(walkerCmd, dispatchArgs);
auto postSyncArgs = EncodePostSync<FamilyType>::createPostSyncArgs(dispatchArgs);
EncodePostSync<FamilyType>::template setupPostSyncForInOrderExec<DefaultWalkerType>(walkerCmd, postSyncArgs);
auto &postSyncData = walkerCmd.getPostSync();
EXPECT_FALSE(postSyncData.getDataportPipelineFlush());