Add debug variable to print XY_BLOCK_COPY_BLT command details

Signed-off-by: Rafal Maziejuk <rafal.maziejuk@intel.com>
This commit is contained in:
Rafal Maziejuk
2022-03-29 11:34:56 +00:00
committed by Compute-Runtime-Automation
parent e035199de4
commit c7d8915dd4
11 changed files with 159 additions and 25 deletions

View File

@ -408,3 +408,4 @@ EnableRingSwitchTagUpdateWa = -1
DirectSubmissionReadBackCommandBuffer = -1
DirectSubmissionReadBackRingBuffer = -1
ReadBackCommandBufferAllocation = -1
PrintImageBlitBlockCopyCmdDetails = 0

View File

@ -70,7 +70,7 @@ DECLARE_DEBUG_VARIABLE(bool, EnableResourceTags, false, "Enable resource tagging
DECLARE_DEBUG_VARIABLE(bool, DoNotFreeResources, false, "true: driver stops freeing resources")
DECLARE_DEBUG_VARIABLE(bool, AllowMixingRegularAndCooperativeKernels, false, "true: driver allows mixing regular and cooperative kernels in a single command list and in a single execute")
DECLARE_DEBUG_VARIABLE(bool, AllowPatchingVfeStateInCommandLists, false, "true: MEDIA_VFE_STATE may be programmed in a command list")
DECLARE_DEBUG_VARIABLE(bool, PrintMemoryRegionSizes, false, "print memory bank type, instance and it's size")
DECLARE_DEBUG_VARIABLE(bool, PrintMemoryRegionSizes, false, "print memory bank type, instance and its size")
DECLARE_DEBUG_VARIABLE(bool, UpdateCrossThreadDataSize, false, "Turn on cross thread data size calculation for PATCH TOKEN binary")
DECLARE_DEBUG_VARIABLE(bool, UseNewQueryTopoIoctl, true, "Use DRM_I915_QUERY_COMPUTE_SLICES")
DECLARE_DEBUG_VARIABLE(bool, DisableGpuHangDetection, false, "Disable GPU hang detection")
@ -235,6 +235,7 @@ DECLARE_DEBUG_VARIABLE(bool, PrintBlitDispatchDetails, false, "Print blit dispat
DECLARE_DEBUG_VARIABLE(bool, PrintIoctlTimes, false, "Print ioctl times")
DECLARE_DEBUG_VARIABLE(bool, PrintIoctlEntries, false, "Print ioctl being called")
DECLARE_DEBUG_VARIABLE(bool, PrintUmdSharedMigration, false, "Print log message when shared allocation is being migrated by UMD")
DECLARE_DEBUG_VARIABLE(bool, PrintImageBlitBlockCopyCmdDetails, false, "Prints XY_BLOCK_COPY_BLT command details")
/*PERFORMANCE FLAGS*/
DECLARE_DEBUG_VARIABLE(bool, DisableZeroCopyForBuffers, false, "When active all buffer allocations will not share memory with CPU.")

View File

@ -3648,19 +3648,19 @@ struct XY_BLOCK_COPY_BLT {
return (TheStructure.Common.DestinationBaseAddress);
}
inline void setDestinationXoffset(const uint32_t value) {
inline void setDestinationXOffset(const uint32_t value) {
TheStructure.Common.DestinationXoffset = value;
}
inline uint32_t getDestinationXoffset() const {
inline uint32_t getDestinationXOffset() const {
return (TheStructure.Common.DestinationXoffset);
}
inline void setDestinationYoffset(const uint32_t value) {
inline void setDestinationYOffset(const uint32_t value) {
TheStructure.Common.DestinationYoffset = value;
}
inline uint32_t getDestinationYoffset() const {
inline uint32_t getDestinationYOffset() const {
return (TheStructure.Common.DestinationYoffset);
}
@ -3744,19 +3744,19 @@ struct XY_BLOCK_COPY_BLT {
return (TheStructure.Common.SourceBaseAddress);
}
inline void setSourceXoffset(const uint32_t value) {
inline void setSourceXOffset(const uint32_t value) {
TheStructure.Common.SourceXoffset = value;
}
inline uint32_t getSourceXoffset() const {
inline uint32_t getSourceXOffset() const {
return (TheStructure.Common.SourceXoffset);
}
inline void setSourceYoffset(const uint32_t value) {
inline void setSourceYOffset(const uint32_t value) {
TheStructure.Common.SourceYoffset = value;
}
inline uint32_t getSourceYoffset() const {
inline uint32_t getSourceYOffset() const {
return (TheStructure.Common.SourceYoffset);
}

View File

@ -3925,19 +3925,19 @@ struct XY_BLOCK_COPY_BLT {
return (TheStructure.Common.DestinationBaseAddress);
}
inline void setDestinationXoffset(const uint32_t value) {
inline void setDestinationXOffset(const uint32_t value) {
TheStructure.Common.DestinationXoffset = value;
}
inline uint32_t getDestinationXoffset() const {
inline uint32_t getDestinationXOffset() const {
return (TheStructure.Common.DestinationXoffset);
}
inline void setDestinationYoffset(const uint32_t value) {
inline void setDestinationYOffset(const uint32_t value) {
TheStructure.Common.DestinationYoffset = value;
}
inline uint32_t getDestinationYoffset() const {
inline uint32_t getDestinationYOffset() const {
return (TheStructure.Common.DestinationYoffset);
}
@ -4021,19 +4021,19 @@ struct XY_BLOCK_COPY_BLT {
return (TheStructure.Common.SourceBaseAddress);
}
inline void setSourceXoffset(const uint32_t value) {
inline void setSourceXOffset(const uint32_t value) {
TheStructure.Common.SourceXoffset = value;
}
inline uint32_t getSourceXoffset() const {
inline uint32_t getSourceXOffset() const {
return (TheStructure.Common.SourceXoffset);
}
inline void setSourceYoffset(const uint32_t value) {
inline void setSourceYOffset(const uint32_t value) {
TheStructure.Common.SourceYoffset = value;
}
inline uint32_t getSourceYoffset() const {
inline uint32_t getSourceYOffset() const {
return (TheStructure.Common.SourceYoffset);
}

View File

@ -3682,19 +3682,19 @@ struct XY_BLOCK_COPY_BLT {
return (TheStructure.Common.DestinationBaseAddress);
}
inline void setDestinationXoffset(const uint32_t value) {
inline void setDestinationXOffset(const uint32_t value) {
TheStructure.Common.DestinationXoffset = value;
}
inline uint32_t getDestinationXoffset() const {
inline uint32_t getDestinationXOffset() const {
return (TheStructure.Common.DestinationXoffset);
}
inline void setDestinationYoffset(const uint32_t value) {
inline void setDestinationYOffset(const uint32_t value) {
TheStructure.Common.DestinationYoffset = value;
}
inline uint32_t getDestinationYoffset() const {
inline uint32_t getDestinationYOffset() const {
return (TheStructure.Common.DestinationYoffset);
}
@ -3778,19 +3778,19 @@ struct XY_BLOCK_COPY_BLT {
return (TheStructure.Common.SourceBaseAddress);
}
inline void setSourceXoffset(const uint32_t value) {
inline void setSourceXOffset(const uint32_t value) {
TheStructure.Common.SourceXoffset = value;
}
inline uint32_t getSourceXoffset() const {
inline uint32_t getSourceXOffset() const {
return (TheStructure.Common.SourceXoffset);
}
inline void setSourceYoffset(const uint32_t value) {
inline void setSourceYOffset(const uint32_t value) {
TheStructure.Common.SourceYoffset = value;
}
inline uint32_t getSourceYoffset() const {
inline uint32_t getSourceYOffset() const {
return (TheStructure.Common.SourceYoffset);
}

View File

@ -168,6 +168,7 @@ struct BlitCommandsHelper {
static bool miArbCheckWaRequired();
static bool preBlitCommandWARequired();
static void appendClearColor(const BlitProperties &blitProperties, typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd);
static void printImageBlitBlockCopyCommand(const typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd);
static void encodeProfilingStartMmios(LinearStream &cmdStream, const TagNodeBase &timestampPacketNode);
static void encodeProfilingEndMmios(LinearStream &cmdStream, const TagNodeBase &timestampPacketNode);

View File

@ -296,6 +296,11 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitCommandsForImageRegion(const Bli
dispatchPreBlitCommand(linearStream, hwInfo);
for (uint32_t i = 0; i < blitProperties.copySize.z; i++) {
appendSliceOffsets(blitProperties, bltCmd, i, rootDeviceEnvironment, srcSlicePitch, dstSlicePitch);
if (DebugManager.flags.PrintImageBlitBlockCopyCmdDetails.get()) {
printImageBlitBlockCopyCommand(bltCmd);
}
auto cmd = linearStream.getSpaceForCmd<typename GfxFamily::XY_BLOCK_COPY_BLT>();
*cmd = bltCmd;
dispatchPostBlitCommand(linearStream, hwInfo);

View File

@ -95,4 +95,7 @@ template <typename GfxFamily>
void BlitCommandsHelper<GfxFamily>::appendClearColor(const BlitProperties &blitProperties, typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd) {
}
template <typename GfxFamily>
void BlitCommandsHelper<GfxFamily>::printImageBlitBlockCopyCommand(const typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd) {}
} // namespace NEO

View File

@ -12,6 +12,8 @@
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/helpers/blit_commands_helper_base.inl"
#include <cinttypes>
namespace NEO {
template <typename GfxFamily>
@ -384,4 +386,45 @@ template <typename GfxFamily>
void BlitCommandsHelper<GfxFamily>::appendClearColor(const BlitProperties &blitProperties, typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd) {
}
template <typename GfxFamily>
void BlitCommandsHelper<GfxFamily>::printImageBlitBlockCopyCommand(const typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd) {
printf("ColorDepth: %u\n", blitCmd.getColorDepth());
printf("SourcePitch: %u\n", blitCmd.getSourcePitch());
printf("SourceTiling: %u\n", blitCmd.getSourceTiling());
printf("SourceX1Coordinate_Left: %u\n", blitCmd.getSourceX1CoordinateLeft());
printf("SourceY1Coordinate_Top: %u\n", blitCmd.getSourceY1CoordinateTop());
printf("SourceBaseAddress: %" PRIx64 "\n", blitCmd.getSourceBaseAddress());
printf("SourceXOffset: %u\n", blitCmd.getSourceXOffset());
printf("SourceYOffset: %u\n", blitCmd.getSourceYOffset());
printf("SourceTargetMemory: %u\n", blitCmd.getSourceTargetMemory());
printf("SourceCompressionFormat: %u\n", blitCmd.getSourceCompressionFormat());
printf("SourceSurfaceHeight: %u\n", blitCmd.getSourceSurfaceHeight());
printf("SourceSurfaceWidth: %u\n", blitCmd.getSourceSurfaceWidth());
printf("SourceSurfaceType: %u\n", blitCmd.getSourceSurfaceType());
printf("SourceSurfaceQpitch: %u\n", blitCmd.getSourceSurfaceQpitch());
printf("SourceSurfaceDepth: %u\n", blitCmd.getSourceSurfaceDepth());
printf("SourceHorizontalAlign: %u\n", blitCmd.getSourceHorizontalAlign());
printf("SourceVerticalAlign: %u\n", blitCmd.getSourceVerticalAlign());
printf("SourceArrayIndex: %u\n", blitCmd.getSourceArrayIndex());
printf("DestinationPitch: %u\n", blitCmd.getDestinationPitch());
printf("DestinationTiling: %u\n", blitCmd.getDestinationTiling());
printf("DestinationX1Coordinate_Left: %u\n", blitCmd.getDestinationX1CoordinateLeft());
printf("DestinationY1Coordinate_Top: %u\n", blitCmd.getDestinationY1CoordinateTop());
printf("DestinationX2Coordinate_Right: %u\n", blitCmd.getDestinationX2CoordinateRight());
printf("DestinationY2Coordinate_Bottom: %u\n", blitCmd.getDestinationY2CoordinateBottom());
printf("DestinationBaseAddress: %" PRIx64 "\n", blitCmd.getDestinationBaseAddress());
printf("DestinationXOffset: %u\n", blitCmd.getDestinationXOffset());
printf("DestinationYOffset: %u\n", blitCmd.getDestinationYOffset());
printf("DestinationTargetMemory: %u\n", blitCmd.getDestinationTargetMemory());
printf("DestinationCompressionFormat: %u\n", blitCmd.getDestinationCompressionFormat());
printf("DestinationSurfaceHeight: %u\n", blitCmd.getDestinationSurfaceHeight());
printf("DestinationSurfaceWidth: %u\n", blitCmd.getDestinationSurfaceWidth());
printf("DestinationSurfaceType: %u\n", blitCmd.getDestinationSurfaceType());
printf("DestinationSurfaceQpitch: %u\n", blitCmd.getDestinationSurfaceQpitch());
printf("DestinationSurfaceDepth: %u\n", blitCmd.getDestinationSurfaceDepth());
printf("DestinationHorizontalAlign: %u\n", blitCmd.getDestinationHorizontalAlign());
printf("DestinationVerticalAlign: %u\n", blitCmd.getDestinationVerticalAlign());
printf("DestinationArrayIndex: %u\n", blitCmd.getDestinationArrayIndex());
}
} // namespace NEO

View File

@ -466,6 +466,7 @@ INSTANTIATE_TEST_CASE_P(size_t,
4,
8,
16));
HWTEST2_F(BlitTests, givenMemoryAndImageWhenDispatchCopyImageCallThenCommandAddedToStream, BlitPlatforms) {
using XY_BLOCK_COPY_BLT = typename FamilyType::XY_BLOCK_COPY_BLT;
MockGraphicsAllocation srcAlloc;
@ -501,6 +502,18 @@ HWTEST2_F(BlitTests, givenMemoryAndImageWhenDispatchCopyImageCallThenCommandAdde
EXPECT_NE(cmdList.end(), itor);
}
HWTEST2_F(BlitTests, whenPrintImageBlitBlockCopyCommandIsCalledThenCmdDetailsAreNotPrintedToStdOutput, BlitPlatforms) {
using XY_BLOCK_COPY_BLT = typename FamilyType::XY_BLOCK_COPY_BLT;
auto bltCmd = FamilyType::cmdInitXyBlockCopyBlt;
testing::internal::CaptureStdout();
NEO::BlitCommandsHelper<FamilyType>::printImageBlitBlockCopyCommand(bltCmd);
std::string output = testing::internal::GetCapturedStdout();
std::string expectedOutput("");
EXPECT_EQ(expectedOutput, output);
}
HWTEST2_F(BlitTests, givenGen9AndGetBlitAllocationPropertiesThenCorrectValuesAreReturned, IsGen9) {
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;

View File

@ -980,3 +980,70 @@ HWTEST2_F(BlitTests, givenDisabledGlobalCacheInvalidationWhenProgrammingGlobalSe
HWTEST2_F(BlitTests, givenBcsCommandsHelperWhenMiArbCheckWaRequiredThenReturnTrue, IsXeHPOrAbove) {
EXPECT_TRUE(BlitCommandsHelper<FamilyType>::miArbCheckWaRequired());
}
HWTEST2_F(BlitTests, givenDebugVariableWhenDispatchBlitCommandsForImageRegionIsCalledThenCmdDetailsArePrintedToStdOutput, IsXeHPOrAbove) {
DebugManagerStateRestore restore;
DebugManager.flags.PrintImageBlitBlockCopyCmdDetails.set(true);
uint32_t streamBuffer[100]{};
LinearStream stream(streamBuffer, sizeof(streamBuffer));
MockGraphicsAllocation srcAlloc;
MockGraphicsAllocation dstAlloc;
MockGraphicsAllocation clearColorAllocation;
Vec3<size_t> dstOffsets = {0, 0, 0};
Vec3<size_t> srcOffsets = {0, 0, 0};
Vec3<size_t> copySize = {0x1, 0x1, 0x1};
size_t srcRowPitch = 1;
size_t srcSlicePitch = 1;
size_t dstRowPitch = 1;
size_t dstSlicePitch = 1;
auto blitProperties = NEO::BlitProperties::constructPropertiesForCopy(&dstAlloc, &srcAlloc,
dstOffsets, srcOffsets, copySize, srcRowPitch, srcSlicePitch,
dstRowPitch, dstSlicePitch, &clearColorAllocation);
blitProperties.srcSize = {1, 1, 1};
blitProperties.dstSize = {1, 1, 1};
testing::internal::CaptureStdout();
BlitCommandsHelper<FamilyType>::dispatchBlitCommandsForImageRegion(blitProperties, stream, *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]);
std::string output = testing::internal::GetCapturedStdout();
std::stringstream expectedOutput;
expectedOutput << "ColorDepth: 0\n"
<< "SourcePitch: 1\n"
<< "SourceTiling: 0\n"
<< "SourceX1Coordinate_Left: 0\n"
<< "SourceY1Coordinate_Top: 0\n"
<< "SourceBaseAddress: 0\n"
<< "SourceXOffset: 0\n"
<< "SourceYOffset: 0\n"
<< "SourceTargetMemory: 0\n"
<< "SourceCompressionFormat: 0\n"
<< "SourceSurfaceHeight: 1\n"
<< "SourceSurfaceWidth: 1\n"
<< "SourceSurfaceType: 0\n"
<< "SourceSurfaceQpitch: 0\n"
<< "SourceSurfaceDepth: 1\n"
<< "SourceHorizontalAlign: 0\n"
<< "SourceVerticalAlign: 0\n"
<< "SourceArrayIndex: 1\n"
<< "DestinationPitch: 1\n"
<< "DestinationTiling: 0\n"
<< "DestinationX1Coordinate_Left: 0\n"
<< "DestinationY1Coordinate_Top: 0\n"
<< "DestinationX2Coordinate_Right: 1\n"
<< "DestinationY2Coordinate_Bottom: 1\n"
<< "DestinationBaseAddress: 0\n"
<< "DestinationXOffset: 0\n"
<< "DestinationYOffset: 0\n"
<< "DestinationTargetMemory: 0\n"
<< "DestinationCompressionFormat: 0\n"
<< "DestinationSurfaceHeight: 1\n"
<< "DestinationSurfaceWidth: 1\n"
<< "DestinationSurfaceType: 0\n"
<< "DestinationSurfaceQpitch: 0\n"
<< "DestinationSurfaceDepth: 1\n"
<< "DestinationHorizontalAlign: 0\n"
<< "DestinationVerticalAlign: 0\n"
<< "DestinationArrayIndex: 1\n";
EXPECT_EQ(expectedOutput.str(), output);
}