From 656468e42bf953591c411e8568539d22c44b39cb Mon Sep 17 00:00:00 2001 From: Maciej Dziuban Date: Wed, 6 May 2020 12:54:30 +0000 Subject: [PATCH] Add debug flags for blitter Change-Id: I57e47cfa3dde10f441cd7400ad6463367450a899 --- Jenkinsfile | 2 +- .../test/unit_test/test_files/igdrcl.config | 3 + .../debug_settings/debug_variables_base.inl | 3 + shared/source/helpers/blit_commands_helper.h | 4 ++ .../helpers/blit_commands_helper_base.inl | 69 +++++++++++++++---- 5 files changed, 66 insertions(+), 15 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1d756895d6..9f9c6e5c17 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,5 +1,5 @@ #!groovy dependenciesRevision='4659ec97f5caf1aa49d25d3389dac0fe63091c19-1408' strategy='EQUAL' -allowedCD=247 +allowedCD=253 allowedF=20 diff --git a/opencl/test/unit_test/test_files/igdrcl.config b/opencl/test/unit_test/test_files/igdrcl.config index 51ce32b054..772d037283 100644 --- a/opencl/test/unit_test/test_files/igdrcl.config +++ b/opencl/test/unit_test/test_files/igdrcl.config @@ -155,3 +155,6 @@ ForcePerDssBackedBufferProgramming = 0 DisableAtomicForPostSyncs = 0 MaxHwThreadsPercent = 0 MinHwThreadsUnoccupied = 0 +LimitBlitterMaxWidth = -1 +LimitBlitterMaxHeight = -1 +FlushAfterEachBlit = -1 diff --git a/shared/source/debug_settings/debug_variables_base.inl b/shared/source/debug_settings/debug_variables_base.inl index 9812ddeaf6..c02dcf16e2 100644 --- a/shared/source/debug_settings/debug_variables_base.inl +++ b/shared/source/debug_settings/debug_variables_base.inl @@ -60,6 +60,9 @@ DECLARE_DEBUG_VARIABLE(bool, OverrideInvalidEngineWithDefault, false, "When set DECLARE_DEBUG_VARIABLE(bool, DisableAuxTranslation, false, "Disable aux translation when required by Kernel.") DECLARE_DEBUG_VARIABLE(bool, DisableTimestampPacketOptimizations, false, "Allocate new allocation per node + dont reuse old nodes") DECLARE_DEBUG_VARIABLE(bool, DisableCachingForStatefulBufferAccess, false, "Disable caching for stateful buffer access") +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") /*LOGGING FLAGS*/ DECLARE_DEBUG_VARIABLE(bool, PrintDebugSettings, false, "Dump all debug variables settings to text file. Print to stdout if value is different than default.") diff --git a/shared/source/helpers/blit_commands_helper.h b/shared/source/helpers/blit_commands_helper.h index 8e756665ea..a0994890e2 100644 --- a/shared/source/helpers/blit_commands_helper.h +++ b/shared/source/helpers/blit_commands_helper.h @@ -75,6 +75,10 @@ struct BlitProperties { template struct BlitCommandsHelper { using COLOR_DEPTH = typename GfxFamily::XY_COLOR_BLT::COLOR_DEPTH; + static uint64_t getMaxBlitWidth(); + static uint64_t getMaxBlitHeight(); + static void dispatchPostBlitCommand(LinearStream &linearStream); + static size_t estimatePostBlitCommandSize(); static size_t estimateBlitCommandsSize(Vec3 copySize, const CsrDependencies &csrDependencies, bool updateTimestampPacket); static size_t estimateBlitCommandsSize(const BlitPropertiesContainer &blitPropertiesContainer, const HardwareInfo &hwInfo); static uint64_t calculateBlitCommandDestinationBaseAddress(const BlitProperties &blitProperties, uint64_t offset, uint64_t row, uint64_t slice); diff --git a/shared/source/helpers/blit_commands_helper_base.inl b/shared/source/helpers/blit_commands_helper_base.inl index 7b71a9efb0..49bf9927b0 100644 --- a/shared/source/helpers/blit_commands_helper_base.inl +++ b/shared/source/helpers/blit_commands_helper_base.inl @@ -12,6 +12,50 @@ namespace NEO { +template +uint64_t BlitCommandsHelper::getMaxBlitWidth() { + if (DebugManager.flags.LimitBlitterMaxWidth.get() != -1) { + return static_cast(DebugManager.flags.LimitBlitterMaxWidth.get()); + } + return BlitterConstants::maxBlitWidth; +} + +template +uint64_t BlitCommandsHelper::getMaxBlitHeight() { + if (DebugManager.flags.LimitBlitterMaxHeight.get() != -1) { + return static_cast(DebugManager.flags.LimitBlitterMaxHeight.get()); + } + return BlitterConstants::maxBlitHeight; +} + +template +void BlitCommandsHelper::dispatchPostBlitCommand(LinearStream &linearStream) { + bool useFlush = false; + if (DebugManager.flags.FlushAfterEachBlit.get() != -1) { + useFlush = static_cast(DebugManager.flags.FlushAfterEachBlit.get()); + } + + if (useFlush) { + EncodeMiFlushDW::programMiFlushDw(linearStream, 0, 0, false, false); + } else { + auto miArbCheckStream = linearStream.getSpaceForCmd(); + *miArbCheckStream = GfxFamily::cmdInitArbCheck; + } +} + +template +size_t BlitCommandsHelper::estimatePostBlitCommandSize() { + bool useFlush = false; + if (DebugManager.flags.FlushAfterEachBlit.get() != -1) { + useFlush = static_cast(DebugManager.flags.FlushAfterEachBlit.get()); + } + + if (useFlush) { + return sizeof(typename GfxFamily::MI_FLUSH_DW); + } + return sizeof(typename GfxFamily::MI_ARB_CHECK); +} + template size_t BlitCommandsHelper::estimateBlitCommandsSize(Vec3 copySize, const CsrDependencies &csrDependencies, bool updateTimestampPacket) { size_t numberOfBlits = 0; @@ -22,10 +66,10 @@ size_t BlitCommandsHelper::estimateBlitCommandsSize(Vec3 copy for (uint64_t row = 0; row < copySize.y; row++) { uint64_t sizeToBlit = copySize.x; while (sizeToBlit != 0) { - if (sizeToBlit > BlitterConstants::maxBlitWidth) { + if (sizeToBlit > getMaxBlitWidth()) { // dispatch 2D blit: maxBlitWidth x (1 .. maxBlitHeight) - width = BlitterConstants::maxBlitWidth; - height = std::min((sizeToBlit / width), BlitterConstants::maxBlitHeight); + width = getMaxBlitWidth(); + height = std::min((sizeToBlit / width), getMaxBlitHeight()); } else { // dispatch 1D blt: (1 .. maxBlitWidth) x 1 @@ -38,7 +82,7 @@ size_t BlitCommandsHelper::estimateBlitCommandsSize(Vec3 copy } } - constexpr size_t cmdsSizePerBlit = (sizeof(typename GfxFamily::XY_COPY_BLT) + sizeof(typename GfxFamily::MI_ARB_CHECK)); + const size_t cmdsSizePerBlit = (sizeof(typename GfxFamily::XY_COPY_BLT) + estimatePostBlitCommandSize()); return TimestampPacketHelper::getRequiredCmdStreamSize(csrDependencies) + (cmdsSizePerBlit * numberOfBlits) + @@ -86,10 +130,10 @@ void BlitCommandsHelper::dispatchBlitCommandsForBuffer(const BlitProp uint64_t offset = 0; uint64_t sizeToBlit = blitProperties.copySize.x; while (sizeToBlit != 0) { - if (sizeToBlit > BlitterConstants::maxBlitWidth) { + if (sizeToBlit > getMaxBlitWidth()) { // dispatch 2D blit: maxBlitWidth x (1 .. maxBlitHeight) - width = BlitterConstants::maxBlitWidth; - height = std::min((sizeToBlit / width), BlitterConstants::maxBlitHeight); + width = getMaxBlitWidth(); + height = std::min((sizeToBlit / width), getMaxBlitHeight()); } else { // dispatch 1D blt: (1 .. maxBlitWidth) x 1 width = sizeToBlit; @@ -116,10 +160,7 @@ void BlitCommandsHelper::dispatchBlitCommandsForBuffer(const BlitProp *bltStream = bltCmd; } - { - auto miArbCheckStream = linearStream.getSpaceForCmd(); - *miArbCheckStream = GfxFamily::cmdInitArbCheck; - } + dispatchPostBlitCommand(linearStream); auto blitSize = width * height; sizeToBlit -= blitSize; @@ -146,12 +187,12 @@ void BlitCommandsHelper::dispatchBlitMemoryFill(NEO::GraphicsAllocati tmpCmd.setDestinationBaseAddress(ptrOffset(dstAlloc->getGpuAddress(), static_cast(offset))); uint64_t height = 0; uint64_t width = 0; - if (sizeToFill <= BlitterConstants::maxBlitWidth) { + if (sizeToFill <= getMaxBlitWidth()) { width = sizeToFill; height = 1; } else { - width = BlitterConstants::maxBlitWidth; - height = std::min((sizeToFill / width), BlitterConstants::maxBlitHeight); + width = getMaxBlitWidth(); + height = std::min((sizeToFill / width), getMaxBlitHeight()); if (height > 1) { appendTilingEnable(tmpCmd); }