Revert "Improve GPU breakpoint support"

This reverts commit a6d898a026.

Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2021-02-12 11:49:34 +01:00
committed by Compute-Runtime-Automation
parent ca84fdd64a
commit 1494205e28
2 changed files with 38 additions and 215 deletions

View File

@@ -1175,180 +1175,6 @@ HWTEST_F(CommandStreamReceiverTest, givenDebugPauseThreadWhenSettingFlagProgress
EXPECT_THAT(output, testing::HasSubstr(std::string("Debug break: Workload ended, press enter to continue")));
}
HWTEST_F(CommandStreamReceiverTest, givenDebugPauseThreadBeforeWalkerOnlyWhenSettingFlagProgressThenFunctionAsksOnceForConfirmation) {
DebugManagerStateRestore restore;
DebugManager.flags.PauseOnEnqueue.set(0);
DebugManager.flags.PauseOnGpuMode.set(0);
testing::internal::CaptureStdout();
int32_t executionStamp = 0;
auto mockCSR = new MockCsr<FamilyType>(executionStamp, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
uint32_t confirmationCounter = 0;
mockCSR->debugConfirmationFunction = [&confirmationCounter, &mockCSR]() {
EXPECT_EQ(0u, confirmationCounter);
EXPECT_TRUE(DebugPauseState::waitingForUserStartConfirmation == *mockCSR->debugPauseStateAddress);
confirmationCounter++;
};
pDevice->resetCommandStreamReceiver(mockCSR);
*mockCSR->debugPauseStateAddress = DebugPauseState::waitingForUserStartConfirmation;
while (*mockCSR->debugPauseStateAddress != DebugPauseState::hasUserStartConfirmation)
;
*mockCSR->debugPauseStateAddress = DebugPauseState::waitingForUserEndConfirmation;
EXPECT_EQ(1u, confirmationCounter);
auto output = testing::internal::GetCapturedStdout();
EXPECT_THAT(output, testing::HasSubstr(std::string("Debug break: Press enter to start workload")));
EXPECT_THAT(output, testing::Not(testing::HasSubstr(std::string("Debug break: Workload ended, press enter to continue"))));
}
HWTEST_F(CommandStreamReceiverTest, givenDebugPauseThreadAfterWalkerOnlyWhenSettingFlagProgressThenFunctionAsksOnceForConfirmation) {
DebugManagerStateRestore restore;
DebugManager.flags.PauseOnEnqueue.set(0);
DebugManager.flags.PauseOnGpuMode.set(1);
testing::internal::CaptureStdout();
int32_t executionStamp = 0;
auto mockCSR = new MockCsr<FamilyType>(executionStamp, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
uint32_t confirmationCounter = 0;
mockCSR->debugConfirmationFunction = [&confirmationCounter, &mockCSR]() {
EXPECT_EQ(0u, confirmationCounter);
EXPECT_TRUE(DebugPauseState::waitingForUserEndConfirmation == *mockCSR->debugPauseStateAddress);
confirmationCounter++;
};
pDevice->resetCommandStreamReceiver(mockCSR);
*mockCSR->debugPauseStateAddress = DebugPauseState::waitingForUserEndConfirmation;
while (*mockCSR->debugPauseStateAddress != DebugPauseState::hasUserEndConfirmation)
;
*mockCSR->debugPauseStateAddress = DebugPauseState::waitingForUserEndConfirmation;
EXPECT_EQ(1u, confirmationCounter);
auto output = testing::internal::GetCapturedStdout();
EXPECT_THAT(output, testing::Not(testing::HasSubstr(std::string("Debug break: Press enter to start workload"))));
EXPECT_THAT(output, testing::HasSubstr(std::string("Debug break: Workload ended, press enter to continue")));
}
HWTEST_F(CommandStreamReceiverTest, givenDebugPauseThreadOnEachEnqueueWhenSettingFlagProgressThenFunctionAsksMultipleTimesForConfirmation) {
DebugManagerStateRestore restore;
DebugManager.flags.PauseOnEnqueue.set(-2);
testing::internal::CaptureStdout();
int32_t executionStamp = 0;
auto mockCSR = new MockCsr<FamilyType>(executionStamp, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
uint32_t confirmationCounter = 0;
mockCSR->debugConfirmationFunction = [&confirmationCounter, &mockCSR]() {
if (confirmationCounter == 0) {
EXPECT_TRUE(DebugPauseState::waitingForUserStartConfirmation == *mockCSR->debugPauseStateAddress);
confirmationCounter++;
} else if (confirmationCounter == 1) {
EXPECT_TRUE(DebugPauseState::waitingForUserEndConfirmation == *mockCSR->debugPauseStateAddress);
confirmationCounter++;
} else if (confirmationCounter == 2) {
EXPECT_TRUE(DebugPauseState::waitingForUserStartConfirmation == *mockCSR->debugPauseStateAddress);
confirmationCounter++;
} else if (confirmationCounter == 3) {
EXPECT_TRUE(DebugPauseState::waitingForUserEndConfirmation == *mockCSR->debugPauseStateAddress);
confirmationCounter++;
DebugManager.flags.PauseOnEnqueue.set(-1);
}
};
pDevice->resetCommandStreamReceiver(mockCSR);
*mockCSR->debugPauseStateAddress = DebugPauseState::waitingForUserStartConfirmation;
while (*mockCSR->debugPauseStateAddress != DebugPauseState::hasUserStartConfirmation)
;
*mockCSR->debugPauseStateAddress = DebugPauseState::waitingForUserEndConfirmation;
while (*mockCSR->debugPauseStateAddress != DebugPauseState::hasUserEndConfirmation)
;
*mockCSR->debugPauseStateAddress = DebugPauseState::waitingForUserStartConfirmation;
while (*mockCSR->debugPauseStateAddress != DebugPauseState::hasUserStartConfirmation)
;
*mockCSR->debugPauseStateAddress = DebugPauseState::waitingForUserEndConfirmation;
while (*mockCSR->debugPauseStateAddress != DebugPauseState::hasUserEndConfirmation)
;
EXPECT_EQ(4u, confirmationCounter);
auto output = testing::internal::GetCapturedStdout();
EXPECT_THAT(output, testing::HasSubstr(std::string("Debug break: Press enter to start workload")));
EXPECT_THAT(output, testing::HasSubstr(std::string("Debug break: Workload ended, press enter to continue")));
}
HWTEST_F(CommandStreamReceiverTest, givenDebugPauseThreadOnEachBlitWhenSettingFlagProgressThenFunctionAsksMultipleTimesForConfirmation) {
DebugManagerStateRestore restore;
DebugManager.flags.PauseOnBlitCopy.set(-2);
testing::internal::CaptureStdout();
int32_t executionStamp = 0;
auto mockCSR = new MockCsr<FamilyType>(executionStamp, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
uint32_t confirmationCounter = 0;
mockCSR->debugConfirmationFunction = [&confirmationCounter, &mockCSR]() {
if (confirmationCounter == 0) {
EXPECT_TRUE(DebugPauseState::waitingForUserStartConfirmation == *mockCSR->debugPauseStateAddress);
confirmationCounter++;
} else if (confirmationCounter == 1) {
EXPECT_TRUE(DebugPauseState::waitingForUserEndConfirmation == *mockCSR->debugPauseStateAddress);
confirmationCounter++;
} else if (confirmationCounter == 2) {
EXPECT_TRUE(DebugPauseState::waitingForUserStartConfirmation == *mockCSR->debugPauseStateAddress);
confirmationCounter++;
} else if (confirmationCounter == 3) {
EXPECT_TRUE(DebugPauseState::waitingForUserEndConfirmation == *mockCSR->debugPauseStateAddress);
confirmationCounter++;
DebugManager.flags.PauseOnBlitCopy.set(-1);
}
};
pDevice->resetCommandStreamReceiver(mockCSR);
*mockCSR->debugPauseStateAddress = DebugPauseState::waitingForUserStartConfirmation;
while (*mockCSR->debugPauseStateAddress != DebugPauseState::hasUserStartConfirmation)
;
*mockCSR->debugPauseStateAddress = DebugPauseState::waitingForUserEndConfirmation;
while (*mockCSR->debugPauseStateAddress != DebugPauseState::hasUserEndConfirmation)
;
*mockCSR->debugPauseStateAddress = DebugPauseState::waitingForUserStartConfirmation;
while (*mockCSR->debugPauseStateAddress != DebugPauseState::hasUserStartConfirmation)
;
*mockCSR->debugPauseStateAddress = DebugPauseState::waitingForUserEndConfirmation;
while (*mockCSR->debugPauseStateAddress != DebugPauseState::hasUserEndConfirmation)
;
EXPECT_EQ(4u, confirmationCounter);
auto output = testing::internal::GetCapturedStdout();
EXPECT_THAT(output, testing::HasSubstr(std::string("Debug break: Press enter to start workload")));
EXPECT_THAT(output, testing::HasSubstr(std::string("Debug break: Workload ended, press enter to continue")));
}
HWTEST_F(CommandStreamReceiverTest, givenDebugPauseThreadWhenTerminatingAtFirstStageThenFunctionEndsCorrectly) {
DebugManagerStateRestore restore;
DebugManager.flags.PauseOnEnqueue.set(0);