Skip to content

Commit 656468e

Browse files
Add debug flags for blitter
Change-Id: I57e47cfa3dde10f441cd7400ad6463367450a899
1 parent 97c5a68 commit 656468e

File tree

5 files changed

+66
-15
lines changed

5 files changed

+66
-15
lines changed

Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!groovy
22
dependenciesRevision='4659ec97f5caf1aa49d25d3389dac0fe63091c19-1408'
33
strategy='EQUAL'
4-
allowedCD=247
4+
allowedCD=253
55
allowedF=20

opencl/test/unit_test/test_files/igdrcl.config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,6 @@ ForcePerDssBackedBufferProgramming = 0
155155
DisableAtomicForPostSyncs = 0
156156
MaxHwThreadsPercent = 0
157157
MinHwThreadsUnoccupied = 0
158+
LimitBlitterMaxWidth = -1
159+
LimitBlitterMaxHeight = -1
160+
FlushAfterEachBlit = -1

shared/source/debug_settings/debug_variables_base.inl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ DECLARE_DEBUG_VARIABLE(bool, OverrideInvalidEngineWithDefault, false, "When set
6060
DECLARE_DEBUG_VARIABLE(bool, DisableAuxTranslation, false, "Disable aux translation when required by Kernel.")
6161
DECLARE_DEBUG_VARIABLE(bool, DisableTimestampPacketOptimizations, false, "Allocate new allocation per node + dont reuse old nodes")
6262
DECLARE_DEBUG_VARIABLE(bool, DisableCachingForStatefulBufferAccess, false, "Disable caching for stateful buffer access")
63+
DECLARE_DEBUG_VARIABLE(int32_t, LimitBlitterMaxWidth, -1, "-1: default, >=0: Max width")
64+
DECLARE_DEBUG_VARIABLE(int32_t, LimitBlitterMaxHeight, -1, "-1: default, >=0: Max height")
65+
DECLARE_DEBUG_VARIABLE(int32_t, FlushAfterEachBlit, -1, "-1: default, 0: disable, 1: enable")
6366

6467
/*LOGGING FLAGS*/
6568
DECLARE_DEBUG_VARIABLE(bool, PrintDebugSettings, false, "Dump all debug variables settings to text file. Print to stdout if value is different than default.")

shared/source/helpers/blit_commands_helper.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ struct BlitProperties {
7575
template <typename GfxFamily>
7676
struct BlitCommandsHelper {
7777
using COLOR_DEPTH = typename GfxFamily::XY_COLOR_BLT::COLOR_DEPTH;
78+
static uint64_t getMaxBlitWidth();
79+
static uint64_t getMaxBlitHeight();
80+
static void dispatchPostBlitCommand(LinearStream &linearStream);
81+
static size_t estimatePostBlitCommandSize();
7882
static size_t estimateBlitCommandsSize(Vec3<size_t> copySize, const CsrDependencies &csrDependencies, bool updateTimestampPacket);
7983
static size_t estimateBlitCommandsSize(const BlitPropertiesContainer &blitPropertiesContainer, const HardwareInfo &hwInfo);
8084
static uint64_t calculateBlitCommandDestinationBaseAddress(const BlitProperties &blitProperties, uint64_t offset, uint64_t row, uint64_t slice);

shared/source/helpers/blit_commands_helper_base.inl

Lines changed: 55 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,50 @@
1212

1313
namespace NEO {
1414

15+
template <typename GfxFamily>
16+
uint64_t BlitCommandsHelper<GfxFamily>::getMaxBlitWidth() {
17+
if (DebugManager.flags.LimitBlitterMaxWidth.get() != -1) {
18+
return static_cast<uint64_t>(DebugManager.flags.LimitBlitterMaxWidth.get());
19+
}
20+
return BlitterConstants::maxBlitWidth;
21+
}
22+
23+
template <typename GfxFamily>
24+
uint64_t BlitCommandsHelper<GfxFamily>::getMaxBlitHeight() {
25+
if (DebugManager.flags.LimitBlitterMaxHeight.get() != -1) {
26+
return static_cast<uint64_t>(DebugManager.flags.LimitBlitterMaxHeight.get());
27+
}
28+
return BlitterConstants::maxBlitHeight;
29+
}
30+
31+
template <typename GfxFamily>
32+
void BlitCommandsHelper<GfxFamily>::dispatchPostBlitCommand(LinearStream &linearStream) {
33+
bool useFlush = false;
34+
if (DebugManager.flags.FlushAfterEachBlit.get() != -1) {
35+
useFlush = static_cast<bool>(DebugManager.flags.FlushAfterEachBlit.get());
36+
}
37+
38+
if (useFlush) {
39+
EncodeMiFlushDW<GfxFamily>::programMiFlushDw(linearStream, 0, 0, false, false);
40+
} else {
41+
auto miArbCheckStream = linearStream.getSpaceForCmd<typename GfxFamily::MI_ARB_CHECK>();
42+
*miArbCheckStream = GfxFamily::cmdInitArbCheck;
43+
}
44+
}
45+
46+
template <typename GfxFamily>
47+
size_t BlitCommandsHelper<GfxFamily>::estimatePostBlitCommandSize() {
48+
bool useFlush = false;
49+
if (DebugManager.flags.FlushAfterEachBlit.get() != -1) {
50+
useFlush = static_cast<bool>(DebugManager.flags.FlushAfterEachBlit.get());
51+
}
52+
53+
if (useFlush) {
54+
return sizeof(typename GfxFamily::MI_FLUSH_DW);
55+
}
56+
return sizeof(typename GfxFamily::MI_ARB_CHECK);
57+
}
58+
1559
template <typename GfxFamily>
1660
size_t BlitCommandsHelper<GfxFamily>::estimateBlitCommandsSize(Vec3<size_t> copySize, const CsrDependencies &csrDependencies, bool updateTimestampPacket) {
1761
size_t numberOfBlits = 0;
@@ -22,10 +66,10 @@ size_t BlitCommandsHelper<GfxFamily>::estimateBlitCommandsSize(Vec3<size_t> copy
2266
for (uint64_t row = 0; row < copySize.y; row++) {
2367
uint64_t sizeToBlit = copySize.x;
2468
while (sizeToBlit != 0) {
25-
if (sizeToBlit > BlitterConstants::maxBlitWidth) {
69+
if (sizeToBlit > getMaxBlitWidth()) {
2670
// dispatch 2D blit: maxBlitWidth x (1 .. maxBlitHeight)
27-
width = BlitterConstants::maxBlitWidth;
28-
height = std::min((sizeToBlit / width), BlitterConstants::maxBlitHeight);
71+
width = getMaxBlitWidth();
72+
height = std::min((sizeToBlit / width), getMaxBlitHeight());
2973

3074
} else {
3175
// dispatch 1D blt: (1 .. maxBlitWidth) x 1
@@ -38,7 +82,7 @@ size_t BlitCommandsHelper<GfxFamily>::estimateBlitCommandsSize(Vec3<size_t> copy
3882
}
3983
}
4084

41-
constexpr size_t cmdsSizePerBlit = (sizeof(typename GfxFamily::XY_COPY_BLT) + sizeof(typename GfxFamily::MI_ARB_CHECK));
85+
const size_t cmdsSizePerBlit = (sizeof(typename GfxFamily::XY_COPY_BLT) + estimatePostBlitCommandSize());
4286

4387
return TimestampPacketHelper::getRequiredCmdStreamSize<GfxFamily>(csrDependencies) +
4488
(cmdsSizePerBlit * numberOfBlits) +
@@ -86,10 +130,10 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForBuffer(const BlitProp
86130
uint64_t offset = 0;
87131
uint64_t sizeToBlit = blitProperties.copySize.x;
88132
while (sizeToBlit != 0) {
89-
if (sizeToBlit > BlitterConstants::maxBlitWidth) {
133+
if (sizeToBlit > getMaxBlitWidth()) {
90134
// dispatch 2D blit: maxBlitWidth x (1 .. maxBlitHeight)
91-
width = BlitterConstants::maxBlitWidth;
92-
height = std::min((sizeToBlit / width), BlitterConstants::maxBlitHeight);
135+
width = getMaxBlitWidth();
136+
height = std::min((sizeToBlit / width), getMaxBlitHeight());
93137
} else {
94138
// dispatch 1D blt: (1 .. maxBlitWidth) x 1
95139
width = sizeToBlit;
@@ -116,10 +160,7 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForBuffer(const BlitProp
116160
*bltStream = bltCmd;
117161
}
118162

119-
{
120-
auto miArbCheckStream = linearStream.getSpaceForCmd<typename GfxFamily::MI_ARB_CHECK>();
121-
*miArbCheckStream = GfxFamily::cmdInitArbCheck;
122-
}
163+
dispatchPostBlitCommand(linearStream);
123164

124165
auto blitSize = width * height;
125166
sizeToBlit -= blitSize;
@@ -146,12 +187,12 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitMemoryFill(NEO::GraphicsAllocati
146187
tmpCmd.setDestinationBaseAddress(ptrOffset(dstAlloc->getGpuAddress(), static_cast<size_t>(offset)));
147188
uint64_t height = 0;
148189
uint64_t width = 0;
149-
if (sizeToFill <= BlitterConstants::maxBlitWidth) {
190+
if (sizeToFill <= getMaxBlitWidth()) {
150191
width = sizeToFill;
151192
height = 1;
152193
} else {
153-
width = BlitterConstants::maxBlitWidth;
154-
height = std::min((sizeToFill / width), BlitterConstants::maxBlitHeight);
194+
width = getMaxBlitWidth();
195+
height = std::min((sizeToFill / width), getMaxBlitHeight());
155196
if (height > 1) {
156197
appendTilingEnable(tmpCmd);
157198
}

0 commit comments

Comments
 (0)