Debug logs: print tag allocation address.

Change-Id: Ia5d8cf16fa42f7b1f567e4ac79fae61bbcb6f13a
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2020-09-25 09:49:10 +02:00
committed by sys_ocldev
parent 0cc717b1b4
commit 1b0983d7db
4 changed files with 32 additions and 1 deletions

View File

@@ -768,6 +768,31 @@ TEST(CommandStreamReceiverSimpleTest, givenNewResourceFlushEnabledWhenProvidingN
EXPECT_STREQ("New resource detected of type 0\n", output.c_str()); EXPECT_STREQ("New resource detected of type 0\n", output.c_str());
} }
TEST(CommandStreamReceiverSimpleTest, givenPrintfTagAllocationAddressFlagEnabledWhenCreatingTagAllocationThenPrintItsAddress) {
DebugManagerStateRestore restore;
DebugManager.flags.PrintTagAllocationAddress.set(true);
auto osContext = std::unique_ptr<OsContext>(OsContext::create(nullptr, 0, 0, aub_stream::EngineType::ENGINE_BCS, PreemptionMode::Disabled, false, false, false));
MockExecutionEnvironment executionEnvironment;
executionEnvironment.prepareRootDeviceEnvironments(1);
executionEnvironment.initializeMemoryManager();
MockCommandStreamReceiver csr(executionEnvironment, 0);
csr.setupContext(*osContext);
testing::internal::CaptureStdout();
csr.initializeTagAllocation();
std::string output = testing::internal::GetCapturedStdout();
EXPECT_NE(0u, output.size());
char expectedStr[128];
snprintf(expectedStr, 128, "\nCreated tag allocation %p for engine %u\n", csr.getTagAddress(), csr.getOsContext().getEngineType());
EXPECT_THAT(output, testing::HasSubstr(std::string(expectedStr)));
}
TEST(CommandStreamReceiverSimpleTest, givenGpuIdleImplicitFlushCheckDisabledWhenGpuIsIdleThenReturnFalse) { TEST(CommandStreamReceiverSimpleTest, givenGpuIdleImplicitFlushCheckDisabledWhenGpuIsIdleThenReturnFalse) {
MockExecutionEnvironment executionEnvironment; MockExecutionEnvironment executionEnvironment;
executionEnvironment.prepareRootDeviceEnvironments(1); executionEnvironment.prepareRootDeviceEnvironments(1);

View File

@@ -195,4 +195,5 @@ PerformImplicitFlushEveryEnqueueCount = -1
PerformImplicitFlushForNewResource = -1 PerformImplicitFlushForNewResource = -1
PerformImplicitFlushForIdleGpu = -1 PerformImplicitFlushForIdleGpu = -1
ProvideVerboseImplicitFlush = false ProvideVerboseImplicitFlush = false
PauseOnGpuMode = -1 PauseOnGpuMode = -1
PrintTagAllocationAddress = 0

View File

@@ -432,6 +432,10 @@ bool CommandStreamReceiver::initializeTagAllocation() {
*this->tagAddress = DebugManager.flags.EnableNullHardware.get() ? -1 : initialHardwareTag; *this->tagAddress = DebugManager.flags.EnableNullHardware.get() ? -1 : initialHardwareTag;
*this->debugPauseStateAddress = DebugManager.flags.EnableNullHardware.get() ? DebugPauseState::disabled : DebugPauseState::waitingForFirstSemaphore; *this->debugPauseStateAddress = DebugManager.flags.EnableNullHardware.get() ? DebugPauseState::disabled : DebugPauseState::waitingForFirstSemaphore;
PRINT_DEBUG_STRING(DebugManager.flags.PrintTagAllocationAddress.get(), stdout,
"\nCreated tag allocation %p for engine %u\n",
this->tagAddress, static_cast<uint32_t>(osContext->getEngineType()));
if (DebugManager.flags.PauseOnEnqueue.get() != -1 || DebugManager.flags.PauseOnBlitCopy.get() != -1) { if (DebugManager.flags.PauseOnEnqueue.get() != -1 || DebugManager.flags.PauseOnBlitCopy.get() != -1) {
userPauseConfirmation = Thread::create(CommandStreamReceiver::asyncDebugBreakConfirmation, reinterpret_cast<void *>(this)); userPauseConfirmation = Thread::create(CommandStreamReceiver::asyncDebugBreakConfirmation, reinterpret_cast<void *>(this));
} }

View File

@@ -106,6 +106,7 @@ DECLARE_DEBUG_VARIABLE(bool, PrintTimestampPacketContents, false, "prints all ti
DECLARE_DEBUG_VARIABLE(bool, WddmResidencyLogger, false, "gather Wddm residency statistics to file") DECLARE_DEBUG_VARIABLE(bool, WddmResidencyLogger, false, "gather Wddm residency statistics to file")
DECLARE_DEBUG_VARIABLE(bool, PrintBOCreateDestroyResult, false, "tracks the result of creation and destruction of BOs") DECLARE_DEBUG_VARIABLE(bool, PrintBOCreateDestroyResult, false, "tracks the result of creation and destruction of BOs")
DECLARE_DEBUG_VARIABLE(bool, PrintBOBindingResult, false, "tracks the result of binding and unbinding of BOs") 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, ProvideVerboseImplicitFlush, false, "provides verbose messages about implicit flush mechanism")
/*PERFORMANCE FLAGS*/ /*PERFORMANCE FLAGS*/