Introduce Online, Offline, Disabled DebuggingModes

This change allows to set DebuggingMode via
ZET_ENABLE_PROGRAM_DEBUGGING env var
0: Disabled
1: Online
2: Offline

Related-To: NEO-7630
Signed-off-by: Fabian Zwolinski <fabian.zwolinski@intel.com>
This commit is contained in:
Fabian Zwolinski
2023-03-16 12:03:21 +00:00
committed by Compute-Runtime-Automation
parent 9b35ba5e50
commit 65c73a690f
25 changed files with 245 additions and 78 deletions

View File

@@ -28,7 +28,7 @@ struct L0DebuggerSharedLinuxFixture {
void setUp(HardwareInfo *hwInfo) {
auto executionEnvironment = new NEO::ExecutionEnvironment();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled);
executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(hwInfo ? hwInfo : defaultHwInfo.get());
executionEnvironment->initializeMemoryManager();
auto osInterface = new OSInterface();

View File

@@ -30,7 +30,7 @@ using namespace NEO;
TEST(Debugger, givenL0DebuggerWhenGettingL0DebuggerThenCorrectObjectIsReturned) {
auto executionEnvironment = new NEO::ExecutionEnvironment();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled);
executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online);
auto hwInfo = *NEO::defaultHwInfo.get();
executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(&hwInfo);
@@ -49,7 +49,7 @@ TEST(Debugger, givenL0DebuggerWhenGettingL0DebuggerThenCorrectObjectIsReturned)
TEST(Debugger, givenSourceLevelDebuggerWhenGettingL0DebuggerThenNullptrIsReturned) {
auto executionEnvironment = new NEO::ExecutionEnvironment();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled);
executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online);
auto hwInfo = *NEO::defaultHwInfo.get();
executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(&hwInfo);
@@ -103,7 +103,7 @@ TEST(Debugger, givenL0DebuggerOFFWhenGettingStateSaveAreaHeaderThenValidSipTypeI
TEST(Debugger, givenDebuggingEnabledInExecEnvWhenAllocatingIsaThenSingleBankIsUsed) {
auto executionEnvironment = new NEO::ExecutionEnvironment();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled);
executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online);
auto hwInfo = *NEO::defaultHwInfo.get();
hwInfo.featureTable.flags.ftrLocalMemory = true;
@@ -131,7 +131,7 @@ TEST(Debugger, givenTileAttachAndDebuggingEnabledInExecEnvWhenAllocatingIsaThenM
auto executionEnvironment = new NEO::ExecutionEnvironment();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled);
executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online);
auto hwInfo = *NEO::defaultHwInfo.get();
hwInfo.featureTable.flags.ftrLocalMemory = true;
@@ -163,7 +163,7 @@ TEST(Debugger, WhenInitializingDebuggerL0ThenCapabilitiesAreAdjustedAndDebuggerI
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
executionEnvironment->initializeMemoryManager();
executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled);
executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online);
auto neoDevice = std::unique_ptr<MockDevice>(MockDevice::create<MockDevice>(executionEnvironment, 0u));
@@ -194,7 +194,7 @@ TEST(Debugger, GivenLegacyDebuggerWhenInitializingDebuggerL0ThenAbortIsCalledAft
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
executionEnvironment->initializeMemoryManager();
executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled);
executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online);
auto neoDevice = std::unique_ptr<MockDevice>(MockDevice::create<MockDevice>(executionEnvironment, 0u));
@@ -312,6 +312,20 @@ HWTEST_F(L0DebuggerTest, givenUseBindlessDebugSipZeroWhenModuleHeapDebugAreaIsCr
EXPECT_EQ(1u, header->reserved1);
}
HWTEST_F(L0DebuggerTest, givenProgramDebuggingWhenGettingDebuggingModeThenCorrectModeIsReturned) {
DebuggingMode mode = NEO::getDebuggingMode(0);
EXPECT_TRUE(DebuggingMode::Disabled == mode);
mode = NEO::getDebuggingMode(1);
EXPECT_TRUE(DebuggingMode::Online == mode);
mode = NEO::getDebuggingMode(2);
EXPECT_TRUE(DebuggingMode::Offline == mode);
mode = NEO::getDebuggingMode(3);
EXPECT_TRUE(DebuggingMode::Disabled == mode);
}
TEST(Debugger, givenNonLegacyDebuggerWhenInitializingDeviceCapsThenUnrecoverableIsCalled) {
class MockDebugger : public NEO::Debugger {
public: