diff --git a/opencl/test/unit_test/mem_obj/buffer_bcs_tests.cpp b/opencl/test/unit_test/mem_obj/buffer_bcs_tests.cpp index 65a938c7f8..672a523f3d 100644 --- a/opencl/test/unit_test/mem_obj/buffer_bcs_tests.cpp +++ b/opencl/test/unit_test/mem_obj/buffer_bcs_tests.cpp @@ -23,6 +23,8 @@ #include "opencl/test/unit_test/test_macros/test_checks_ocl.h" #include "test.h" +#include + using namespace NEO; struct BcsBufferTests : public ::testing::Test { @@ -239,6 +241,38 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenBcsSupportedWhenEnqueueBufferOperationIs EXPECT_EQ(14u, bcsCsr->blitBufferCalled); } +HWTEST_TEMPLATED_F(BcsBufferTests, givenDebugFlagSetWhenDispatchingBlitCommandsThenPrintDispatchDetails) { + DebugManager.flags.PrintBlitDispatchDetails.set(true); + + uint32_t maxBlitWidth = static_cast(BlitterConstants::maxBlitWidth); + uint32_t copySize = maxBlitWidth + 5; + + auto myHostPtr = std::make_unique(copySize); + uint64_t hostPtrAddr = castToUint64(myHostPtr.get()); + + auto bufferForBlt = clUniquePtr(Buffer::create(bcsMockContext.get(), CL_MEM_READ_WRITE, copySize, nullptr, retVal)); + bufferForBlt->forceDisallowCPUCopy = true; + + uint64_t bufferGpuAddr = bufferForBlt->getGraphicsAllocation(0)->getGpuAddress(); + + testing::internal::CaptureStdout(); + + commandQueue->enqueueWriteBuffer(bufferForBlt.get(), CL_TRUE, 0, copySize, myHostPtr.get(), nullptr, 0, nullptr, nullptr); + + std::string output = testing::internal::GetCapturedStdout(); + EXPECT_NE(0u, output.size()); + + char expectedStr[512] = {}; + snprintf(expectedStr, 512, "\nBlit dispatch with AuxTranslationDirection %u \ +\nBlit command. width: %u, height: %u, srcAddr: %#" SCNx64 ", dstAddr: %#" SCNx64 " \ +\nBlit command. width: %u, height: %u, srcAddr: %#" SCNx64 ", dstAddr: %#" SCNx64 " ", + static_cast(AuxTranslationDirection::None), + maxBlitWidth, 1, hostPtrAddr, bufferGpuAddr, + (copySize - maxBlitWidth), 1, ptrOffset(hostPtrAddr, maxBlitWidth), ptrOffset(bufferGpuAddr, maxBlitWidth)); + + EXPECT_THAT(output, testing::HasSubstr(std::string(expectedStr))); +} + HWTEST_TEMPLATED_F(BcsBufferTests, givenBcsSupportedWhenQueueIsBlockedThenDispatchBlitWhenUnblocked) { auto bcsCsr = static_cast *>(commandQueue->getBcsCommandStreamReceiver()); diff --git a/opencl/test/unit_test/test_files/igdrcl.config b/opencl/test/unit_test/test_files/igdrcl.config index 2ddd0fa310..d7c82920e9 100644 --- a/opencl/test/unit_test/test_files/igdrcl.config +++ b/opencl/test/unit_test/test_files/igdrcl.config @@ -200,4 +200,5 @@ PauseOnGpuMode = -1 PrintTagAllocationAddress = 0 DoNotFlushCaches = false UseBindlessMode = -1 -MediaVfeStateMaxSubSlices = -1 \ No newline at end of file +MediaVfeStateMaxSubSlices = -1 +PrintBlitDispatchDetails = 0 \ No newline at end of file diff --git a/shared/source/debug_settings/debug_variables_base.inl b/shared/source/debug_settings/debug_variables_base.inl index 4e03a68ff0..8c4e85fbcc 100644 --- a/shared/source/debug_settings/debug_variables_base.inl +++ b/shared/source/debug_settings/debug_variables_base.inl @@ -111,6 +111,7 @@ DECLARE_DEBUG_VARIABLE(bool, PrintBOCreateDestroyResult, false, "tracks the resu DECLARE_DEBUG_VARIABLE(bool, PrintBOBindingResult, false, "tracks the result of binding and unbinding of BOs") DECLARE_DEBUG_VARIABLE(bool, PrintTagAllocationAddress, false, "Print tag allocation address for each engine") DECLARE_DEBUG_VARIABLE(bool, ProvideVerboseImplicitFlush, false, "provides verbose messages about implicit flush mechanism") +DECLARE_DEBUG_VARIABLE(bool, PrintBlitDispatchDetails, false, "Print blit dispatch details") /*PERFORMANCE FLAGS*/ DECLARE_DEBUG_VARIABLE(bool, DisableZeroCopyForBuffers, false, "When active all buffer allocations will not share memory with CPU.") diff --git a/shared/source/helpers/aux_translation.h b/shared/source/helpers/aux_translation.h index 1070ef053e..cb742676e3 100644 --- a/shared/source/helpers/aux_translation.h +++ b/shared/source/helpers/aux_translation.h @@ -11,7 +11,7 @@ namespace NEO { -enum class AuxTranslationDirection { +enum class AuxTranslationDirection : uint32_t { None, AuxToNonAux, NonAuxToAux diff --git a/shared/source/helpers/blit_commands_helper_base.inl b/shared/source/helpers/blit_commands_helper_base.inl index 0c59c56f43..31a896568f 100644 --- a/shared/source/helpers/blit_commands_helper_base.inl +++ b/shared/source/helpers/blit_commands_helper_base.inl @@ -139,6 +139,9 @@ void BlitCommandsHelper::dispatchBlitCommandsForBufferPerRow(const Bl uint64_t width = 1; uint64_t height = 1; + PRINT_DEBUG_STRING(DebugManager.flags.PrintBlitDispatchDetails.get(), stdout, + "\nBlit dispatch with AuxTranslationDirection %u ", static_cast(blitProperties.auxTranslationDirection)); + for (uint64_t slice = 0; slice < blitProperties.copySize.z; slice++) { for (uint64_t row = 0; row < blitProperties.copySize.y; row++) { uint64_t offset = 0; @@ -165,6 +168,9 @@ void BlitCommandsHelper::dispatchBlitCommandsForBufferPerRow(const Bl auto dstAddr = calculateBlitCommandDestinationBaseAddress(blitProperties, offset, row, slice); auto srcAddr = calculateBlitCommandSourceBaseAddress(blitProperties, offset, row, slice); + PRINT_DEBUG_STRING(DebugManager.flags.PrintBlitDispatchDetails.get(), stdout, + "\nBlit command. width: %u, height: %u, srcAddr: %#llx, dstAddr: %#llx ", width, height, srcAddr, dstAddr); + bltCmd.setDestinationBaseAddress(dstAddr); bltCmd.setSourceBaseAddress(srcAddr);