Enhance debug flag for post blit commands

Change-Id: Ia5dccd083d84ab1b7a1e772f7fd1d5344aa3c6b1
Signed-off-by: Maciej Dziuban <maciej.dziuban@intel.com>
This commit is contained in:
Maciej Dziuban
2020-10-14 14:56:39 +02:00
committed by sys_ocldev
parent 971969ba15
commit 21988a81e1
4 changed files with 48 additions and 21 deletions

View File

@ -167,7 +167,7 @@ MaxHwThreadsPercent = 0
MinHwThreadsUnoccupied = 0
LimitBlitterMaxWidth = -1
LimitBlitterMaxHeight = -1
FlushAfterEachBlit = -1
PostBlitCommand = -1
UseCommandBufferHeaderSizeForWddmQueueSubmission = 1
OverridePreemptionSurfaceSizeInMb = -1
OverrideLeastOccupiedBank = -1

View File

@ -73,7 +73,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, PauseOnGpuMode, -1, "-1: default (before and aft
DECLARE_DEBUG_VARIABLE(int32_t, EnableMultiStorageResources, -1, "-1: default, 0: Disable, 1: Enable")
DECLARE_DEBUG_VARIABLE(int32_t, LimitBlitterMaxWidth, -1, "-1: default, >=0: Max width")
DECLARE_DEBUG_VARIABLE(int32_t, LimitBlitterMaxHeight, -1, "-1: default, >=0: Max height")
DECLARE_DEBUG_VARIABLE(int32_t, FlushAfterEachBlit, -1, "-1: default, 0: disable, 1: enable")
DECLARE_DEBUG_VARIABLE(int32_t, PostBlitCommand, -1, "-1: default, 0: MI_ARB_CHECK, 1: MI_FLUSH, 2: Nothing")
DECLARE_DEBUG_VARIABLE(int32_t, OverridePreemptionSurfaceSizeInMb, -1, "-1: default, >=0 Override preemption surface size with value")
DECLARE_DEBUG_VARIABLE(int32_t, OverrideLeastOccupiedBank, -1, "-1: default, >=0 Override least occupied bank with value")
DECLARE_DEBUG_VARIABLE(int32_t, OverrideRevision, -1, "-1: default, >=0: Revision id")

View File

@ -41,30 +41,30 @@ uint64_t BlitCommandsHelper<GfxFamily>::getMaxBlitHeight(const RootDeviceEnviron
template <typename GfxFamily>
void BlitCommandsHelper<GfxFamily>::dispatchPostBlitCommand(LinearStream &linearStream) {
bool useFlush = false;
if (DebugManager.flags.FlushAfterEachBlit.get() != -1) {
useFlush = static_cast<bool>(DebugManager.flags.FlushAfterEachBlit.get());
}
if (useFlush) {
switch (DebugManager.flags.PostBlitCommand.get()) {
case 1:
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(linearStream, 0, 0, false, false);
} else {
break;
case 2:
break;
default: {
auto miArbCheckStream = linearStream.getSpaceForCmd<typename GfxFamily::MI_ARB_CHECK>();
*miArbCheckStream = GfxFamily::cmdInitArbCheck;
break;
}
}
}
template <typename GfxFamily>
size_t BlitCommandsHelper<GfxFamily>::estimatePostBlitCommandSize() {
bool useFlush = false;
if (DebugManager.flags.FlushAfterEachBlit.get() != -1) {
useFlush = static_cast<bool>(DebugManager.flags.FlushAfterEachBlit.get());
}
if (useFlush) {
switch (DebugManager.flags.PostBlitCommand.get()) {
case 1:
return sizeof(typename GfxFamily::MI_FLUSH_DW);
}
case 2:
return 0;
default:
return sizeof(typename GfxFamily::MI_ARB_CHECK);
}
}
template <typename GfxFamily>

View File

@ -91,12 +91,20 @@ HWTEST_F(BlitTests, givenDebugVariablesWhenGettingMaxBlitSizeThenHonorUseProvide
}
HWTEST_F(BlitTests, givenDebugVariableWhenEstimatingPostBlitsCommandSizeThenReturnCorrectResult) {
const size_t arbCheckSize = sizeof(typename FamilyType::MI_ARB_CHECK);
const size_t flushSize = sizeof(typename FamilyType::MI_FLUSH_DW);
DebugManagerStateRestore restore{};
ASSERT_EQ(sizeof(typename FamilyType::MI_ARB_CHECK), BlitCommandsHelper<FamilyType>::estimatePostBlitCommandSize());
EXPECT_EQ(arbCheckSize, BlitCommandsHelper<FamilyType>::estimatePostBlitCommandSize());
DebugManager.flags.PostBlitCommand.set(0);
EXPECT_EQ(arbCheckSize, BlitCommandsHelper<FamilyType>::estimatePostBlitCommandSize());
DebugManager.flags.FlushAfterEachBlit.set(1);
EXPECT_EQ(sizeof(typename FamilyType::MI_FLUSH_DW), BlitCommandsHelper<FamilyType>::estimatePostBlitCommandSize());
DebugManager.flags.PostBlitCommand.set(1);
EXPECT_EQ(flushSize, BlitCommandsHelper<FamilyType>::estimatePostBlitCommandSize());
DebugManager.flags.PostBlitCommand.set(2);
EXPECT_EQ(0u, BlitCommandsHelper<FamilyType>::estimatePostBlitCommandSize());
}
HWTEST_F(BlitTests, givenDebugVariableWhenDispatchingPostBlitsCommandThenUseCorrectCommands) {
@ -107,20 +115,39 @@ HWTEST_F(BlitTests, givenDebugVariableWhenDispatchingPostBlitsCommandThenUseCorr
LinearStream linearStream{streamBuffer, sizeof(streamBuffer)};
GenCmdList commands{};
// -1: default
BlitCommandsHelper<FamilyType>::dispatchPostBlitCommand(linearStream);
CmdParse<FamilyType>::parseCommandBuffer(commands, linearStream.getCpuBase(), linearStream.getUsed());
auto arbCheck = find<MI_ARB_CHECK *>(commands.begin(), commands.end());
EXPECT_NE(commands.end(), arbCheck);
// 0: MI_ARB_CHECK
memset(streamBuffer, 0, sizeof(streamBuffer));
linearStream.replaceBuffer(streamBuffer, sizeof(streamBuffer));
commands.clear();
DebugManager.flags.PostBlitCommand.set(0);
BlitCommandsHelper<FamilyType>::dispatchPostBlitCommand(linearStream);
CmdParse<FamilyType>::parseCommandBuffer(commands, linearStream.getCpuBase(), linearStream.getUsed());
arbCheck = find<MI_ARB_CHECK *>(commands.begin(), commands.end());
EXPECT_NE(commands.end(), arbCheck);
DebugManager.flags.FlushAfterEachBlit.set(1);
// 1: MI_FLUSH_DW
memset(streamBuffer, 0, sizeof(streamBuffer));
linearStream.replaceBuffer(streamBuffer, sizeof(streamBuffer));
commands.clear();
DebugManager.flags.PostBlitCommand.set(1);
BlitCommandsHelper<FamilyType>::dispatchPostBlitCommand(linearStream);
CmdParse<FamilyType>::parseCommandBuffer(commands, linearStream.getCpuBase(), linearStream.getUsed());
auto miFlush = find<MI_FLUSH_DW *>(commands.begin(), commands.end());
EXPECT_NE(commands.end(), miFlush);
// 2: Nothing
memset(streamBuffer, 0, sizeof(streamBuffer));
linearStream.replaceBuffer(streamBuffer, sizeof(streamBuffer));
commands.clear();
DebugManager.flags.PostBlitCommand.set(2);
BlitCommandsHelper<FamilyType>::dispatchPostBlitCommand(linearStream);
EXPECT_EQ(0u, linearStream.getUsed());
}
HWTEST_F(BlitTests, givenMemoryWhenFillPatternWithBlitThenCommandIsProgrammed) {