mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 01:04:57 +08:00
Revert "Improve GPU breakpoint support"
This reverts commit a6d898a026.
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
ca84fdd64a
commit
1494205e28
@@ -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);
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include "shared/source/helpers/cache_policy.h"
|
||||
#include "shared/source/helpers/flush_stamp.h"
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/source/helpers/pause_on_gpu_properties.h"
|
||||
#include "shared/source/helpers/string.h"
|
||||
#include "shared/source/helpers/timestamp_packet.h"
|
||||
#include "shared/source/memory_manager/internal_allocation_storage.h"
|
||||
@@ -409,50 +408,48 @@ void CommandStreamReceiver::setExperimentalCmdBuffer(std::unique_ptr<Experimenta
|
||||
void *CommandStreamReceiver::asyncDebugBreakConfirmation(void *arg) {
|
||||
auto self = reinterpret_cast<CommandStreamReceiver *>(arg);
|
||||
|
||||
auto debugPauseStateValue = DebugPauseState::waitingForUserStartConfirmation;
|
||||
|
||||
do {
|
||||
auto debugPauseStateValue = DebugPauseState::waitingForUserStartConfirmation;
|
||||
if (DebugManager.flags.PauseOnGpuMode.get() != PauseOnGpuProperties::PauseMode::AfterWorkload) {
|
||||
do {
|
||||
{
|
||||
std::unique_lock<SpinLock> lock{self->debugPauseStateLock};
|
||||
debugPauseStateValue = *self->debugPauseStateAddress;
|
||||
}
|
||||
|
||||
if (debugPauseStateValue == DebugPauseState::terminate) {
|
||||
return nullptr;
|
||||
}
|
||||
std::this_thread::yield();
|
||||
} while (debugPauseStateValue != DebugPauseState::waitingForUserStartConfirmation);
|
||||
std::cout << "Debug break: Press enter to start workload" << std::endl;
|
||||
self->debugConfirmationFunction();
|
||||
debugPauseStateValue = DebugPauseState::hasUserStartConfirmation;
|
||||
{
|
||||
std::unique_lock<SpinLock> lock{self->debugPauseStateLock};
|
||||
*self->debugPauseStateAddress = debugPauseStateValue;
|
||||
}
|
||||
{
|
||||
std::unique_lock<SpinLock> lock{self->debugPauseStateLock};
|
||||
debugPauseStateValue = *self->debugPauseStateAddress;
|
||||
}
|
||||
|
||||
if (DebugManager.flags.PauseOnGpuMode.get() != PauseOnGpuProperties::PauseMode::BeforeWorkload) {
|
||||
do {
|
||||
{
|
||||
std::unique_lock<SpinLock> lock{self->debugPauseStateLock};
|
||||
debugPauseStateValue = *self->debugPauseStateAddress;
|
||||
}
|
||||
if (debugPauseStateValue == DebugPauseState::terminate) {
|
||||
return nullptr;
|
||||
}
|
||||
std::this_thread::yield();
|
||||
} while (debugPauseStateValue != DebugPauseState::waitingForUserEndConfirmation);
|
||||
|
||||
std::cout << "Debug break: Workload ended, press enter to continue" << std::endl;
|
||||
self->debugConfirmationFunction();
|
||||
|
||||
{
|
||||
std::unique_lock<SpinLock> lock{self->debugPauseStateLock};
|
||||
*self->debugPauseStateAddress = DebugPauseState::hasUserEndConfirmation;
|
||||
}
|
||||
if (debugPauseStateValue == DebugPauseState::terminate) {
|
||||
return nullptr;
|
||||
}
|
||||
} while (DebugManager.flags.PauseOnEnqueue.get() == PauseOnGpuProperties::DebugFlagValues::OnEachEnqueue || DebugManager.flags.PauseOnBlitCopy.get() == PauseOnGpuProperties::DebugFlagValues::OnEachEnqueue);
|
||||
std::this_thread::yield();
|
||||
} while (debugPauseStateValue != DebugPauseState::waitingForUserStartConfirmation);
|
||||
|
||||
std::cout << "Debug break: Press enter to start workload" << std::endl;
|
||||
self->debugConfirmationFunction();
|
||||
|
||||
debugPauseStateValue = DebugPauseState::hasUserStartConfirmation;
|
||||
{
|
||||
std::unique_lock<SpinLock> lock{self->debugPauseStateLock};
|
||||
*self->debugPauseStateAddress = debugPauseStateValue;
|
||||
}
|
||||
|
||||
do {
|
||||
{
|
||||
std::unique_lock<SpinLock> lock{self->debugPauseStateLock};
|
||||
debugPauseStateValue = *self->debugPauseStateAddress;
|
||||
}
|
||||
if (debugPauseStateValue == DebugPauseState::terminate) {
|
||||
return nullptr;
|
||||
}
|
||||
std::this_thread::yield();
|
||||
} while (debugPauseStateValue != DebugPauseState::waitingForUserEndConfirmation);
|
||||
|
||||
std::cout << "Debug break: Workload ended, press enter to continue" << std::endl;
|
||||
self->debugConfirmationFunction();
|
||||
|
||||
{
|
||||
std::unique_lock<SpinLock> lock{self->debugPauseStateLock};
|
||||
*self->debugPauseStateAddress = DebugPauseState::hasUserEndConfirmation;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user