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 MinHwThreadsUnoccupied = 0
LimitBlitterMaxWidth = -1 LimitBlitterMaxWidth = -1
LimitBlitterMaxHeight = -1 LimitBlitterMaxHeight = -1
FlushAfterEachBlit = -1 PostBlitCommand = -1
UseCommandBufferHeaderSizeForWddmQueueSubmission = 1 UseCommandBufferHeaderSizeForWddmQueueSubmission = 1
OverridePreemptionSurfaceSizeInMb = -1 OverridePreemptionSurfaceSizeInMb = -1
OverrideLeastOccupiedBank = -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, 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, LimitBlitterMaxWidth, -1, "-1: default, >=0: Max width")
DECLARE_DEBUG_VARIABLE(int32_t, LimitBlitterMaxHeight, -1, "-1: default, >=0: Max height") 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, 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, OverrideLeastOccupiedBank, -1, "-1: default, >=0 Override least occupied bank with value")
DECLARE_DEBUG_VARIABLE(int32_t, OverrideRevision, -1, "-1: default, >=0: Revision id") 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> template <typename GfxFamily>
void BlitCommandsHelper<GfxFamily>::dispatchPostBlitCommand(LinearStream &linearStream) { void BlitCommandsHelper<GfxFamily>::dispatchPostBlitCommand(LinearStream &linearStream) {
bool useFlush = false; switch (DebugManager.flags.PostBlitCommand.get()) {
if (DebugManager.flags.FlushAfterEachBlit.get() != -1) { case 1:
useFlush = static_cast<bool>(DebugManager.flags.FlushAfterEachBlit.get());
}
if (useFlush) {
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(linearStream, 0, 0, false, false); EncodeMiFlushDW<GfxFamily>::programMiFlushDw(linearStream, 0, 0, false, false);
} else { break;
case 2:
break;
default: {
auto miArbCheckStream = linearStream.getSpaceForCmd<typename GfxFamily::MI_ARB_CHECK>(); auto miArbCheckStream = linearStream.getSpaceForCmd<typename GfxFamily::MI_ARB_CHECK>();
*miArbCheckStream = GfxFamily::cmdInitArbCheck; *miArbCheckStream = GfxFamily::cmdInitArbCheck;
break;
}
} }
} }
template <typename GfxFamily> template <typename GfxFamily>
size_t BlitCommandsHelper<GfxFamily>::estimatePostBlitCommandSize() { size_t BlitCommandsHelper<GfxFamily>::estimatePostBlitCommandSize() {
bool useFlush = false; switch (DebugManager.flags.PostBlitCommand.get()) {
if (DebugManager.flags.FlushAfterEachBlit.get() != -1) { case 1:
useFlush = static_cast<bool>(DebugManager.flags.FlushAfterEachBlit.get());
}
if (useFlush) {
return sizeof(typename GfxFamily::MI_FLUSH_DW); return sizeof(typename GfxFamily::MI_FLUSH_DW);
case 2:
return 0;
default:
return sizeof(typename GfxFamily::MI_ARB_CHECK);
} }
return sizeof(typename GfxFamily::MI_ARB_CHECK);
} }
template <typename GfxFamily> template <typename GfxFamily>

View File

@ -91,12 +91,20 @@ HWTEST_F(BlitTests, givenDebugVariablesWhenGettingMaxBlitSizeThenHonorUseProvide
} }
HWTEST_F(BlitTests, givenDebugVariableWhenEstimatingPostBlitsCommandSizeThenReturnCorrectResult) { 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{}; 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); DebugManager.flags.PostBlitCommand.set(1);
EXPECT_EQ(sizeof(typename FamilyType::MI_FLUSH_DW), BlitCommandsHelper<FamilyType>::estimatePostBlitCommandSize()); EXPECT_EQ(flushSize, BlitCommandsHelper<FamilyType>::estimatePostBlitCommandSize());
DebugManager.flags.PostBlitCommand.set(2);
EXPECT_EQ(0u, BlitCommandsHelper<FamilyType>::estimatePostBlitCommandSize());
} }
HWTEST_F(BlitTests, givenDebugVariableWhenDispatchingPostBlitsCommandThenUseCorrectCommands) { HWTEST_F(BlitTests, givenDebugVariableWhenDispatchingPostBlitsCommandThenUseCorrectCommands) {
@ -107,20 +115,39 @@ HWTEST_F(BlitTests, givenDebugVariableWhenDispatchingPostBlitsCommandThenUseCorr
LinearStream linearStream{streamBuffer, sizeof(streamBuffer)}; LinearStream linearStream{streamBuffer, sizeof(streamBuffer)};
GenCmdList commands{}; GenCmdList commands{};
// -1: default
BlitCommandsHelper<FamilyType>::dispatchPostBlitCommand(linearStream); BlitCommandsHelper<FamilyType>::dispatchPostBlitCommand(linearStream);
CmdParse<FamilyType>::parseCommandBuffer(commands, linearStream.getCpuBase(), linearStream.getUsed()); CmdParse<FamilyType>::parseCommandBuffer(commands, linearStream.getCpuBase(), linearStream.getUsed());
auto arbCheck = find<MI_ARB_CHECK *>(commands.begin(), commands.end()); auto arbCheck = find<MI_ARB_CHECK *>(commands.begin(), commands.end());
EXPECT_NE(commands.end(), arbCheck); EXPECT_NE(commands.end(), arbCheck);
// 0: MI_ARB_CHECK
memset(streamBuffer, 0, sizeof(streamBuffer)); memset(streamBuffer, 0, sizeof(streamBuffer));
linearStream.replaceBuffer(streamBuffer, sizeof(streamBuffer)); linearStream.replaceBuffer(streamBuffer, sizeof(streamBuffer));
commands.clear(); 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); BlitCommandsHelper<FamilyType>::dispatchPostBlitCommand(linearStream);
CmdParse<FamilyType>::parseCommandBuffer(commands, linearStream.getCpuBase(), linearStream.getUsed()); CmdParse<FamilyType>::parseCommandBuffer(commands, linearStream.getCpuBase(), linearStream.getUsed());
auto miFlush = find<MI_FLUSH_DW *>(commands.begin(), commands.end()); auto miFlush = find<MI_FLUSH_DW *>(commands.begin(), commands.end());
EXPECT_NE(commands.end(), miFlush); 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) { HWTEST_F(BlitTests, givenMemoryWhenFillPatternWithBlitThenCommandIsProgrammed) {
@ -449,4 +476,4 @@ HWTEST2_F(BlitTests, givenAllocDimsLowerThanMaxSizesWhenCheckingIfOneCommandCanB
Vec3<size_t> copySize = {BlitterConstants::maxBlitWidth - 1, BlitterConstants::maxBlitHeight - 1, 1}; Vec3<size_t> copySize = {BlitterConstants::maxBlitWidth - 1, BlitterConstants::maxBlitHeight - 1, 1};
bool useOneCommand = NEO::BlitCommandsHelper<FamilyType>::useOneBlitCopyCommand(copySize, bytesPerPixel); bool useOneCommand = NEO::BlitCommandsHelper<FamilyType>::useOneBlitCopyCommand(copySize, bytesPerPixel);
EXPECT_TRUE(useOneCommand); EXPECT_TRUE(useOneCommand);
} }