Add new debug variable to pause on blit copy

Change-Id: I150eea40fa77b80387eda33fd6afd1582b517b5c
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2020-06-17 14:58:28 +02:00
committed by sys_ocldev
parent 7ef2e4304c
commit 39828fb71d
11 changed files with 114 additions and 54 deletions

View File

@ -853,11 +853,13 @@ using BlitEnqueueWithDebugCapabilityTests = BlitEnqueueTests<0>;
HWTEST_TEMPLATED_F(BlitEnqueueWithDebugCapabilityTests, givenDebugFlagSetWhenDispatchingBlitEnqueueThenAddPausingCommands) {
using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT;
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
using MI_FLUSH_DW = typename FamilyType::MI_FLUSH_DW;
DebugManager.flags.PauseOnEnqueue.set(1);
DebugManager.flags.PauseOnBlitCopy.set(1);
auto debugPauseStateAddress = gpgpuCsr->getDebugPauseStateGPUAddress();
auto ultBcsCsr = static_cast<UltCommandStreamReceiver<FamilyType> *>(bcsCsr);
auto debugPauseStateAddress = ultBcsCsr->getDebugPauseStateGPUAddress();
auto buffer = createBuffer(1, false);
buffer->forceDisallowCPUCopy = true;
@ -867,12 +869,12 @@ HWTEST_TEMPLATED_F(BlitEnqueueWithDebugCapabilityTests, givenDebugFlagSetWhenDis
commandQueue->enqueueWriteBuffer(buffer.get(), true, 0, 1, &hostPtr, nullptr, 0, nullptr, nullptr);
HardwareParse hwParser;
hwParser.parseCommands<FamilyType>(*commandQueue);
hwParser.parseCommands<FamilyType>(ultBcsCsr->commandStream);
auto &cmdList = hwParser.cmdList;
auto semaphore = find<MI_SEMAPHORE_WAIT *>(cmdList.begin(), cmdList.end());
bool semaphoreBeforeWalkerFound = false;
bool semaphoreAfterWalkerFound = false;
bool semaphoreBeforeCopyFound = false;
bool semaphoreAfterCopyFound = false;
while (semaphore != cmdList.end()) {
auto semaphoreCmd = genCmdCast<MI_SEMAPHORE_WAIT *>(*semaphore);
if (static_cast<uint32_t>(DebugPauseState::hasUserStartConfirmation) == semaphoreCmd->getSemaphoreDataDword()) {
@ -880,53 +882,59 @@ HWTEST_TEMPLATED_F(BlitEnqueueWithDebugCapabilityTests, givenDebugFlagSetWhenDis
EXPECT_EQ(MI_SEMAPHORE_WAIT::COMPARE_OPERATION::COMPARE_OPERATION_SAD_EQUAL_SDD, semaphoreCmd->getCompareOperation());
EXPECT_EQ(MI_SEMAPHORE_WAIT::WAIT_MODE::WAIT_MODE_POLLING_MODE, semaphoreCmd->getWaitMode());
semaphoreBeforeWalkerFound = true;
semaphoreBeforeCopyFound = true;
}
if (static_cast<uint32_t>(DebugPauseState::hasUserEndConfirmation) == semaphoreCmd->getSemaphoreDataDword()) {
EXPECT_TRUE(semaphoreBeforeWalkerFound);
EXPECT_TRUE(semaphoreBeforeCopyFound);
EXPECT_EQ(debugPauseStateAddress, semaphoreCmd->getSemaphoreGraphicsAddress());
EXPECT_EQ(MI_SEMAPHORE_WAIT::COMPARE_OPERATION::COMPARE_OPERATION_SAD_EQUAL_SDD, semaphoreCmd->getCompareOperation());
EXPECT_EQ(MI_SEMAPHORE_WAIT::WAIT_MODE::WAIT_MODE_POLLING_MODE, semaphoreCmd->getWaitMode());
semaphoreAfterWalkerFound = true;
semaphoreAfterCopyFound = true;
break;
}
semaphore = find<MI_SEMAPHORE_WAIT *>(++semaphore, cmdList.end());
}
EXPECT_TRUE(semaphoreAfterWalkerFound);
EXPECT_TRUE(semaphoreAfterCopyFound);
auto pipeControl = find<PIPE_CONTROL *>(cmdList.begin(), cmdList.end());
bool pipeControlBeforeWalkerFound = false;
bool pipeControlAfterWalkerFound = false;
while (pipeControl != cmdList.end()) {
auto pipeControlCmd = genCmdCast<PIPE_CONTROL *>(*pipeControl);
if (static_cast<uint32_t>(DebugPauseState::waitingForUserStartConfirmation) == pipeControlCmd->getImmediateData()) {
EXPECT_TRUE(pipeControlCmd->getCommandStreamerStallEnable());
EXPECT_TRUE(pipeControlCmd->getDcFlushEnable());
EXPECT_EQ(static_cast<uint32_t>(debugPauseStateAddress & 0x0000FFFFFFFFULL), pipeControlCmd->getAddress());
EXPECT_EQ(static_cast<uint32_t>(debugPauseStateAddress >> 32), pipeControlCmd->getAddressHigh());
EXPECT_EQ(PIPE_CONTROL::POST_SYNC_OPERATION::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA, pipeControlCmd->getPostSyncOperation());
auto miFlush = find<MI_FLUSH_DW *>(cmdList.begin(), cmdList.end());
bool miFlushBeforeCopyFound = false;
bool miFlushAfterCopyFound = false;
while (miFlush != cmdList.end()) {
auto miFlushCmd = genCmdCast<MI_FLUSH_DW *>(*miFlush);
if (static_cast<uint32_t>(DebugPauseState::waitingForUserStartConfirmation) == miFlushCmd->getImmediateData() &&
debugPauseStateAddress == miFlushCmd->getDestinationAddress()) {
pipeControlBeforeWalkerFound = true;
EXPECT_EQ(MI_FLUSH_DW::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA_QWORD, miFlushCmd->getPostSyncOperation());
miFlushBeforeCopyFound = true;
}
if (static_cast<uint32_t>(DebugPauseState::waitingForUserEndConfirmation) == pipeControlCmd->getImmediateData()) {
EXPECT_TRUE(pipeControlBeforeWalkerFound);
EXPECT_TRUE(pipeControlCmd->getCommandStreamerStallEnable());
EXPECT_TRUE(pipeControlCmd->getDcFlushEnable());
EXPECT_EQ(static_cast<uint32_t>(debugPauseStateAddress & 0x0000FFFFFFFFULL), pipeControlCmd->getAddress());
EXPECT_EQ(static_cast<uint32_t>(debugPauseStateAddress >> 32), pipeControlCmd->getAddressHigh());
EXPECT_EQ(PIPE_CONTROL::POST_SYNC_OPERATION::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA, pipeControlCmd->getPostSyncOperation());
if (static_cast<uint32_t>(DebugPauseState::waitingForUserEndConfirmation) == miFlushCmd->getImmediateData() &&
debugPauseStateAddress == miFlushCmd->getDestinationAddress()) {
EXPECT_TRUE(miFlushBeforeCopyFound);
pipeControlAfterWalkerFound = true;
EXPECT_EQ(MI_FLUSH_DW::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA_QWORD, miFlushCmd->getPostSyncOperation());
miFlushAfterCopyFound = true;
break;
}
pipeControl = find<PIPE_CONTROL *>(++pipeControl, cmdList.end());
miFlush = find<MI_FLUSH_DW *>(++miFlush, cmdList.end());
}
EXPECT_TRUE(pipeControlAfterWalkerFound);
EXPECT_TRUE(miFlushAfterCopyFound);
}
HWTEST_TEMPLATED_F(BlitEnqueueWithDebugCapabilityTests, givenDebugFlagSetWhenCreatingCsrThenCreateDebugThread) {
DebugManager.flags.PauseOnBlitCopy.set(1);
auto localDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto ultCsr = static_cast<UltCommandStreamReceiver<FamilyType> *>(localDevice->getDefaultEngine().commandStreamReceiver);
EXPECT_NE(nullptr, ultCsr->userPauseConfirmation.get());
}