From 65c73a690fe616288d6d68e839a397087334932c Mon Sep 17 00:00:00 2001 From: Fabian Zwolinski Date: Thu, 16 Mar 2023 12:03:21 +0000 Subject: [PATCH] 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 --- level_zero/core/source/driver/driver.cpp | 7 +- .../test/aub_tests/fixtures/aub_fixture.cpp | 4 +- .../debugger/active_debugger_fixture.h | 2 +- .../sources/debugger/l0_debugger_fixture.h | 4 +- .../debugger/linux/test_l0_debugger_linux.cpp | 22 ++--- .../sources/debugger/test_l0_debugger_1.cpp | 4 +- .../debugger/test_module_with_debug.cpp | 2 +- .../debugger/test_source_level_debugger.cpp | 4 +- .../windows/test_l0_debugger_windows.cpp | 12 +-- .../sources/device/test_l0_device.cpp | 2 +- .../unit_tests/sources/driver/test_driver.cpp | 96 ++++++++++++++++++- opencl/source/api/api.cpp | 7 +- .../api/cl_get_platform_ids_tests.inl | 55 ++++++++++- .../debugger/ocl_with_l0_debugger_tests.cpp | 2 +- .../test/unit_test/linux/main_linux_dll.cpp | 4 +- .../unit_test/platform/platform_tests.cpp | 2 +- shared/source/debugger/debugger.h | 18 +++- .../debugger/linux/test_l0_debugger_linux.cpp | 2 +- .../unit_test/debugger/test_l0_debugger.cpp | 26 +++-- .../linux/drm_buffer_object_tests.cpp | 10 +- .../linux/drm_debug_prelim_tests.cpp | 8 +- .../linux/drm_query_prelim_tests.cpp | 4 +- .../os_interface/linux/drm_tests.cpp | 16 ++-- .../linux/drm_with_prelim_tests.cpp | 2 +- .../os_interface/windows/wddm_tests.cpp | 8 +- 25 files changed, 245 insertions(+), 78 deletions(-) diff --git a/level_zero/core/source/driver/driver.cpp b/level_zero/core/source/driver/driver.cpp index 5fbdf74dbe..4a953528e3 100644 --- a/level_zero/core/source/driver/driver.cpp +++ b/level_zero/core/source/driver/driver.cpp @@ -49,10 +49,9 @@ void DriverImp::initialize(ze_result_t *result) { auto executionEnvironment = new NEO::ExecutionEnvironment(); UNRECOVERABLE_IF(nullptr == executionEnvironment); - if (envVariables.programDebugging) { - if (!NEO::DebugManager.flags.ExperimentalEnableL0DebuggerForOpenCL.get()) { - executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled); - } + if (!NEO::DebugManager.flags.ExperimentalEnableL0DebuggerForOpenCL.get()) { + const auto dbgMode = NEO::getDebuggingMode(envVariables.programDebugging); + executionEnvironment->setDebuggingMode(dbgMode); } if (envVariables.fp64Emulation) { diff --git a/level_zero/core/test/aub_tests/fixtures/aub_fixture.cpp b/level_zero/core/test/aub_tests/fixtures/aub_fixture.cpp index 3165443a7a..d723e63d44 100644 --- a/level_zero/core/test/aub_tests/fixtures/aub_fixture.cpp +++ b/level_zero/core/test/aub_tests/fixtures/aub_fixture.cpp @@ -48,7 +48,7 @@ void AUBFixtureL0::setUp(const NEO::HardwareInfo *hardwareInfo, bool debuggingEn executionEnvironment->rootDeviceEnvironments[0]->initGmm(); if (debuggingEnabled) { - executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled); + executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online); } neoDevice = NEO::MockDevice::createWithExecutionEnvironment(&hwInfo, executionEnvironment, 0u); @@ -74,7 +74,7 @@ void AUBFixtureL0::setUp(const NEO::HardwareInfo *hardwareInfo, bool debuggingEn devices.push_back(std::unique_ptr(neoDevice)); driverHandle = std::make_unique>(); - driverHandle->enableProgramDebugging = debuggingEnabled ? NEO::DebuggingMode::Enabled : NEO::DebuggingMode::Disabled; + driverHandle->enableProgramDebugging = debuggingEnabled ? NEO::DebuggingMode::Online : NEO::DebuggingMode::Disabled; driverHandle->initialize(std::move(devices)); diff --git a/level_zero/core/test/unit_tests/sources/debugger/active_debugger_fixture.h b/level_zero/core/test/unit_tests/sources/debugger/active_debugger_fixture.h index c787ef5a3b..cf5824a2e9 100644 --- a/level_zero/core/test/unit_tests/sources/debugger/active_debugger_fixture.h +++ b/level_zero/core/test/unit_tests/sources/debugger/active_debugger_fixture.h @@ -49,7 +49,7 @@ struct ActiveDebuggerFixture { debugger = new MockActiveSourceLevelDebugger(new MockOsLibrary); executionEnvironment->rootDeviceEnvironments[0]->debugger.reset(debugger); executionEnvironment->initializeMemoryManager(); - executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled); + executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online); device = NEO::MockDevice::create(executionEnvironment, 0u); device->setDebuggerActive(true); diff --git a/level_zero/core/test/unit_tests/sources/debugger/l0_debugger_fixture.h b/level_zero/core/test/unit_tests/sources/debugger/l0_debugger_fixture.h index 12fa4ef5a1..be6c0f6f96 100644 --- a/level_zero/core/test/unit_tests/sources/debugger/l0_debugger_fixture.h +++ b/level_zero/core/test/unit_tests/sources/debugger/l0_debugger_fixture.h @@ -30,7 +30,7 @@ struct L0DebuggerFixture { executionEnvironment->rootDeviceEnvironments[0]->builtins.reset(mockBuiltIns); memoryOperationsHandler = new NEO::MockMemoryOperations(); executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface.reset(memoryOperationsHandler); - executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled); + executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online); executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(&hwInfo); hwInfo = *executionEnvironment->rootDeviceEnvironments[0]->getMutableHardwareInfo(); @@ -50,7 +50,7 @@ struct L0DebuggerFixture { NEO::DeviceVector devices; devices.push_back(std::unique_ptr(neoDevice)); driverHandle = std::make_unique>(); - driverHandle->enableProgramDebugging = NEO::DebuggingMode::Enabled; + driverHandle->enableProgramDebugging = NEO::DebuggingMode::Online; driverHandle->initialize(std::move(devices)); device = driverHandle->devices[0]; diff --git a/level_zero/core/test/unit_tests/sources/debugger/linux/test_l0_debugger_linux.cpp b/level_zero/core/test/unit_tests/sources/debugger/linux/test_l0_debugger_linux.cpp index 87a7e453ee..45e0a40fcc 100644 --- a/level_zero/core/test/unit_tests/sources/debugger/linux/test_l0_debugger_linux.cpp +++ b/level_zero/core/test/unit_tests/sources/debugger/linux/test_l0_debugger_linux.cpp @@ -36,7 +36,7 @@ struct L0DebuggerLinuxFixture { auto executionEnvironment = new NEO::ExecutionEnvironment(); auto mockBuiltIns = new NEO::MockBuiltins(); executionEnvironment->prepareRootDeviceEnvironments(1); - executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled); + executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online); executionEnvironment->rootDeviceEnvironments[0]->builtins.reset(mockBuiltIns); executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(hwInfo ? hwInfo : defaultHwInfo.get()); executionEnvironment->initializeMemoryManager(); @@ -50,7 +50,7 @@ struct L0DebuggerLinuxFixture { NEO::DeviceVector devices; devices.push_back(std::unique_ptr(neoDevice)); driverHandle = std::make_unique>(); - driverHandle->enableProgramDebugging = NEO::DebuggingMode::Enabled; + driverHandle->enableProgramDebugging = NEO::DebuggingMode::Online; driverHandle->initialize(std::move(devices)); device = driverHandle->devices[0]; @@ -122,7 +122,7 @@ TEST_F(L0DebuggerLinuxTest, givenLinuxOSWhenL0DebuggerIsCreatedAddressModeIsNotS TEST(L0DebuggerLinux, givenVmBindAndPerContextVmEnabledInDrmWhenInitializingDebuggingInOsThenRegisterResourceClassesIsCalled) { auto executionEnvironment = std::make_unique(); - executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled); + executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online); executionEnvironment->initializeMemoryManager(); auto osInterface = new OSInterface(); auto drmMock = new DrmMockResources(*executionEnvironment->rootDeviceEnvironments[0]); @@ -141,7 +141,7 @@ TEST(L0DebuggerLinux, givenVmBindAndPerContextVmEnabledInDrmWhenInitializingDebu TEST(L0DebuggerLinux, givenVmBindNotAvailableInDrmWhenInitializingDebuggingInOsThenRegisterResourceClassesIsNotCalled) { auto executionEnvironment = std::make_unique(); - executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled); + executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online); executionEnvironment->initializeMemoryManager(); auto osInterface = new OSInterface(); auto drmMock = new DrmMockResources(*executionEnvironment->rootDeviceEnvironments[0]); @@ -160,7 +160,7 @@ TEST(L0DebuggerLinux, givenVmBindNotAvailableInDrmWhenInitializingDebuggingInOsT TEST(L0DebuggerLinux, givenPerContextVmNotEnabledWhenInitializingDebuggingInOsThenRegisterResourceClassesIsNotCalled) { auto executionEnvironment = std::make_unique(); - executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled); + executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online); executionEnvironment->initializeMemoryManager(); auto osInterface = new OSInterface(); auto drmMock = new DrmMockResources(*executionEnvironment->rootDeviceEnvironments[0]); @@ -311,7 +311,7 @@ HWTEST_F(L0DebuggerLinuxTest, givenDebuggingEnabledWhenCommandQueuesAreCreatedAn HWTEST_F(L0DebuggerLinuxTest, givenDebuggingEnabledAndDebugAttachAvailableWhenInitializingDriverThenSuccessIsReturned) { auto executionEnvironment = new NEO::ExecutionEnvironment(); executionEnvironment->prepareRootDeviceEnvironments(1); - executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled); + executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online); executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(defaultHwInfo.get()); executionEnvironment->initializeMemoryManager(); auto osInterface = new OSInterface(); @@ -324,7 +324,7 @@ HWTEST_F(L0DebuggerLinuxTest, givenDebuggingEnabledAndDebugAttachAvailableWhenIn NEO::DeviceVector devices; devices.push_back(std::unique_ptr(neoDevice)); auto driverHandle = std::make_unique>(); - driverHandle->enableProgramDebugging = NEO::DebuggingMode::Enabled; + driverHandle->enableProgramDebugging = NEO::DebuggingMode::Online; drmMock->allowDebugAttach = true; @@ -335,7 +335,7 @@ HWTEST_F(L0DebuggerLinuxTest, givenDebuggingEnabledAndDebugAttachAvailableWhenIn HWTEST_F(L0DebuggerLinuxTest, givenDebuggingEnabledAndDebugAttachNotAvailableWhenInitializingDriverThenErrorIsReturned) { auto executionEnvironment = new NEO::ExecutionEnvironment(); executionEnvironment->prepareRootDeviceEnvironments(1); - executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled); + executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online); executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(defaultHwInfo.get()); executionEnvironment->initializeMemoryManager(); auto osInterface = new OSInterface(); @@ -348,7 +348,7 @@ HWTEST_F(L0DebuggerLinuxTest, givenDebuggingEnabledAndDebugAttachNotAvailableWhe NEO::DeviceVector devices; devices.push_back(std::unique_ptr(neoDevice)); auto driverHandle = std::make_unique>(); - driverHandle->enableProgramDebugging = NEO::DebuggingMode::Enabled; + driverHandle->enableProgramDebugging = NEO::DebuggingMode::Online; drmMock->allowDebugAttach = false; @@ -461,7 +461,7 @@ HWTEST_F(L0DebuggerLinuxMultitileTest, givenSubDeviceFilteredByAffinityMaskWhenC executionEnvironment->prepareRootDeviceEnvironments(1); executionEnvironment->parseAffinityMask(); - executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled); + executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online); executionEnvironment->rootDeviceEnvironments[0]->builtins.reset(mockBuiltIns); executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(&hwInfo); executionEnvironment->initializeMemoryManager(); @@ -475,7 +475,7 @@ HWTEST_F(L0DebuggerLinuxMultitileTest, givenSubDeviceFilteredByAffinityMaskWhenC NEO::DeviceVector devices; devices.push_back(std::unique_ptr(neoDevice)); auto driverHandle = std::make_unique>(); - driverHandle->enableProgramDebugging = NEO::DebuggingMode::Enabled; + driverHandle->enableProgramDebugging = NEO::DebuggingMode::Online; driverHandle->initialize(std::move(devices)); auto device = driverHandle->devices[0]; diff --git a/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_1.cpp b/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_1.cpp index 828d045b51..77993b32fe 100644 --- a/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_1.cpp +++ b/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_1.cpp @@ -74,12 +74,12 @@ TEST_F(L0DebuggerTest, givenL0DebuggerWhenGettingStateSaveAreaHeaderThenValidSip } TEST_F(L0DebuggerTest, givenProgramDebuggingEnabledWhenDebuggerIsCreatedThenFusedEusAreDisabled) { - EXPECT_TRUE(driverHandle->enableProgramDebugging == NEO::DebuggingMode::Enabled); + EXPECT_TRUE(driverHandle->enableProgramDebugging == NEO::DebuggingMode::Online); EXPECT_FALSE(neoDevice->getHardwareInfo().capabilityTable.fusedEuEnabled); } TEST_F(L0DebuggerTest, givenProgramDebuggingEnabledWhenDebuggerIsCreatedThenCompressionIsDisabled) { - EXPECT_TRUE(driverHandle->enableProgramDebugging == NEO::DebuggingMode::Enabled); + EXPECT_TRUE(driverHandle->enableProgramDebugging == NEO::DebuggingMode::Online); EXPECT_FALSE(neoDevice->getHardwareInfo().capabilityTable.ftrRenderCompressedBuffers); EXPECT_FALSE(neoDevice->getHardwareInfo().capabilityTable.ftrRenderCompressedImages); } diff --git a/level_zero/core/test/unit_tests/sources/debugger/test_module_with_debug.cpp b/level_zero/core/test/unit_tests/sources/debugger/test_module_with_debug.cpp index 12930fb601..901e728112 100644 --- a/level_zero/core/test/unit_tests/sources/debugger/test_module_with_debug.cpp +++ b/level_zero/core/test/unit_tests/sources/debugger/test_module_with_debug.cpp @@ -437,7 +437,7 @@ HWTEST_F(ModuleWithDebuggerL0MultiTileTest, GivenSubDeviceWhenCreatingModuleThen auto cip = new NEO::MockCompilerInterfaceCaptureBuildOptions(); neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[device->getRootDeviceIndex()]->compilerInterface.reset(cip); - neoDevice->getExecutionEnvironment()->setDebuggingMode(NEO::DebuggingMode::Enabled); + neoDevice->getExecutionEnvironment()->setDebuggingMode(NEO::DebuggingMode::Online); neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[device->getRootDeviceIndex()]->initDebuggerL0(neoDevice); auto memoryOperationsHandler = new NEO::MockMemoryOperations(); neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[device->getRootDeviceIndex()]->memoryOperationsInterface.reset(memoryOperationsHandler); diff --git a/level_zero/core/test/unit_tests/sources/debugger/test_source_level_debugger.cpp b/level_zero/core/test/unit_tests/sources/debugger/test_source_level_debugger.cpp index f6c93a01a6..6ff7dd1bd3 100644 --- a/level_zero/core/test/unit_tests/sources/debugger/test_source_level_debugger.cpp +++ b/level_zero/core/test/unit_tests/sources/debugger/test_source_level_debugger.cpp @@ -295,14 +295,14 @@ TEST(Debugger, GivenLegacyDebuggerAndProgramDebuggingEnabledWhenInitializingDriv executionEnvironment->rootDeviceEnvironments[0]->initGmm(); executionEnvironment->initializeMemoryManager(); - executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled); + executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online); auto neoDevice = NEO::MockDevice::create(executionEnvironment, 0u); NEO::DeviceVector devices; devices.push_back(std::unique_ptr(neoDevice)); auto driverHandle = std::make_unique>(); - driverHandle->enableProgramDebugging = NEO::DebuggingMode::Enabled; + driverHandle->enableProgramDebugging = NEO::DebuggingMode::Online; EXPECT_THROW(driverHandle->initialize(std::move(devices)), std::exception); std::string output = testing::internal::GetCapturedStderr(); diff --git a/level_zero/core/test/unit_tests/sources/debugger/windows/test_l0_debugger_windows.cpp b/level_zero/core/test/unit_tests/sources/debugger/windows/test_l0_debugger_windows.cpp index 18487e94e3..3a7e909308 100644 --- a/level_zero/core/test/unit_tests/sources/debugger/windows/test_l0_debugger_windows.cpp +++ b/level_zero/core/test/unit_tests/sources/debugger/windows/test_l0_debugger_windows.cpp @@ -35,7 +35,7 @@ struct L0DebuggerWindowsFixture { void setUp() { executionEnvironment = new NEO::ExecutionEnvironment; executionEnvironment->prepareRootDeviceEnvironments(1); - executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled); + executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online); rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[0].get(); auto osEnvironment = new OsEnvironmentWin(); gdi = new MockGdi(); @@ -56,7 +56,7 @@ struct L0DebuggerWindowsFixture { NEO::DeviceVector devices; devices.push_back(std::unique_ptr(neoDevice)); driverHandle = std::make_unique>(); - driverHandle->enableProgramDebugging = NEO::DebuggingMode::Enabled; + driverHandle->enableProgramDebugging = NEO::DebuggingMode::Online; driverHandle->initialize(std::move(devices)); device = driverHandle->devices[0]; @@ -198,7 +198,7 @@ TEST_F(L0DebuggerWindowsTest, givenDebuggerL0NotifyModuleDestroyCalledAndModuleD TEST_F(L0DebuggerWindowsTest, givenProgramDebuggingEnabledAndDebugAttachAvailableWhenInitializingDriverThenSuccessIsReturned) { 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); @@ -218,7 +218,7 @@ TEST_F(L0DebuggerWindowsTest, givenProgramDebuggingEnabledAndDebugAttachAvailabl devices.push_back(std::unique_ptr(neoDevice)); auto driverHandle = std::make_unique>(); - driverHandle->enableProgramDebugging = NEO::DebuggingMode::Enabled; + driverHandle->enableProgramDebugging = NEO::DebuggingMode::Online; wddm->debugAttachAvailable = true; ze_result_t result = driverHandle->initialize(std::move(devices)); @@ -228,7 +228,7 @@ TEST_F(L0DebuggerWindowsTest, givenProgramDebuggingEnabledAndDebugAttachAvailabl TEST_F(L0DebuggerWindowsTest, givenProgramDebuggingEnabledAndDebugAttachNotAvailableWhenInitializingDriverThenErrorIsReturned) { 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); @@ -248,7 +248,7 @@ TEST_F(L0DebuggerWindowsTest, givenProgramDebuggingEnabledAndDebugAttachNotAvail devices.push_back(std::unique_ptr(neoDevice)); auto driverHandle = std::make_unique>(); - driverHandle->enableProgramDebugging = NEO::DebuggingMode::Enabled; + driverHandle->enableProgramDebugging = NEO::DebuggingMode::Online; wddm->debugAttachAvailable = false; ze_result_t result = driverHandle->initialize(std::move(devices)); diff --git a/level_zero/core/test/unit_tests/sources/device/test_l0_device.cpp b/level_zero/core/test/unit_tests/sources/device/test_l0_device.cpp index 2d8c4409c3..c8365b5d90 100644 --- a/level_zero/core/test/unit_tests/sources/device/test_l0_device.cpp +++ b/level_zero/core/test/unit_tests/sources/device/test_l0_device.cpp @@ -211,7 +211,7 @@ TEST(L0DeviceTest, givenDebuggerEnabledButIGCNotReturnsSSAHThenSSAHIsNotCopied) NEO::DeviceVector devices; devices.push_back(std::unique_ptr(neoDevice)); auto driverHandle = std::make_unique>(); - driverHandle->enableProgramDebugging = NEO::DebuggingMode::Enabled; + driverHandle->enableProgramDebugging = NEO::DebuggingMode::Online; driverHandle->initialize(std::move(devices)); auto sipType = SipKernel::getSipKernelType(*neoDevice); diff --git a/level_zero/core/test/unit_tests/sources/driver/test_driver.cpp b/level_zero/core/test/unit_tests/sources/driver/test_driver.cpp index 6207ea3616..5a61a553b7 100644 --- a/level_zero/core/test/unit_tests/sources/driver/test_driver.cpp +++ b/level_zero/core/test/unit_tests/sources/driver/test_driver.cpp @@ -419,6 +419,28 @@ TEST(DriverImpTest, givenEnabledProgramDebuggingWhenCreatingExecutionEnvironment L0::GlobalDriver = nullptr; } +TEST(DriverImpTest, givenEnableProgramDebuggingWithValue2WhenCreatingExecutionEnvironmentThenDebuggingEnabledIsTrue) { + + NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get(); + hwInfo.capabilityTable.levelZeroSupported = true; + + VariableBackup mockGetenvCalledBackup(&IoFunctions::mockGetenvCalled, 0); + std::unordered_map mockableEnvs = {{"ZET_ENABLE_PROGRAM_DEBUGGING", "2"}}; + VariableBackup *> mockableEnvValuesBackup(&IoFunctions::mockableEnvValues, &mockableEnvs); + + ze_result_t result = ZE_RESULT_ERROR_UNINITIALIZED; + DriverImp driverImp; + driverImp.initialize(&result); + + ASSERT_NE(nullptr, L0::GlobalDriver); + ASSERT_NE(0u, L0::GlobalDriver->numDevices); + EXPECT_TRUE(L0::GlobalDriver->devices[0]->getNEODevice()->getExecutionEnvironment()->isDebuggingEnabled()); + + delete L0::GlobalDriver; + L0::GlobalDriverHandle = nullptr; + L0::GlobalDriver = nullptr; +} + TEST(DriverImpTest, givenEnabledFP64EmulationWhenCreatingExecutionEnvironmentThenFP64EmulationIsEnabled) { NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get(); @@ -465,6 +487,30 @@ TEST(DriverImpTest, givenEnabledProgramDebuggingAndEnabledExperimentalOpenCLWhen delete L0::GlobalDriver; } +TEST(DriverImpTest, givenEnableProgramDebuggingWithValue2AndEnabledExperimentalOpenCLWhenCreatingExecutionEnvironmentThenDebuggingEnabledIsFalse) { + DebugManagerStateRestore restorer; + NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get(); + hwInfo.capabilityTable.levelZeroSupported = true; + + NEO::DebugManager.flags.ExperimentalEnableL0DebuggerForOpenCL.set(true); + + VariableBackup mockGetenvCalledBackup(&IoFunctions::mockGetenvCalled, 0); + std::unordered_map mockableEnvs = {{"ZET_ENABLE_PROGRAM_DEBUGGING", "2"}}; + VariableBackup *> mockableEnvValuesBackup(&IoFunctions::mockableEnvValues, &mockableEnvs); + VariableBackup mockableDriverHandle(&L0::GlobalDriverHandle); + VariableBackup mockableDriver(&L0::GlobalDriver); + + ze_result_t result = ZE_RESULT_ERROR_UNINITIALIZED; + DriverImp driverImp; + driverImp.initialize(&result); + + ASSERT_NE(nullptr, L0::GlobalDriver); + ASSERT_NE(0u, L0::GlobalDriver->numDevices); + EXPECT_FALSE(L0::GlobalDriver->devices[0]->getNEODevice()->getExecutionEnvironment()->isDebuggingEnabled()); + + delete L0::GlobalDriver; +} + TEST(DriverImpTest, givenNoProgramDebuggingEnvVarWhenCreatingExecutionEnvironmentThenDebuggingEnabledIsFalse) { NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get(); @@ -483,7 +529,7 @@ TEST(DriverImpTest, givenNoProgramDebuggingEnvVarWhenCreatingExecutionEnvironmen L0::GlobalDriver = nullptr; } -TEST(DriverTest, givenProgramDebuggingEnvVarNonZeroWhenCreatingDriverThenEnableProgramDebuggingIsSetTrue) { +TEST(DriverTest, givenProgramDebuggingEnvVarValue1WhenCreatingDriverThenEnableProgramDebuggingIsSetToTrue) { ze_result_t returnValue; NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get(); @@ -494,12 +540,34 @@ TEST(DriverTest, givenProgramDebuggingEnvVarNonZeroWhenCreatingDriverThenEnableP devices.push_back(std::unique_ptr(neoDevice)); L0EnvVariables envVariables = {}; - envVariables.programDebugging = true; + envVariables.programDebugging = 1; auto driverHandle = whiteboxCast(DriverHandle::create(std::move(devices), envVariables, &returnValue)); EXPECT_NE(nullptr, driverHandle); - EXPECT_TRUE(driverHandle->enableProgramDebugging == NEO::DebuggingMode::Enabled); + EXPECT_TRUE(driverHandle->enableProgramDebugging == NEO::DebuggingMode::Online); + + delete driverHandle; + L0::GlobalDriver = nullptr; +} + +TEST(DriverTest, givenProgramDebuggingEnvVarValue2WhenCreatingDriverThenEnableProgramDebuggingIsSetToTrue) { + + ze_result_t returnValue; + NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get(); + hwInfo.capabilityTable.levelZeroSupported = true; + + NEO::MockDevice *neoDevice = NEO::MockDevice::createWithNewExecutionEnvironment(&hwInfo); + NEO::DeviceVector devices; + devices.push_back(std::unique_ptr(neoDevice)); + + L0EnvVariables envVariables = {}; + envVariables.programDebugging = 2; + + auto driverHandle = whiteboxCast(DriverHandle::create(std::move(devices), envVariables, &returnValue)); + EXPECT_NE(nullptr, driverHandle); + + EXPECT_TRUE(driverHandle->enableProgramDebugging == NEO::DebuggingMode::Offline); delete driverHandle; L0::GlobalDriver = nullptr; @@ -527,6 +595,28 @@ TEST(DriverTest, givenInvalidCompilerEnvironmentThenDependencyUnavailableErrorIs ASSERT_EQ(nullptr, L0::GlobalDriver); } +TEST(DriverTest, givenInvalidCompilerEnvironmentAndEnableProgramDebuggingWithValue2ThenDependencyUnavailableErrorIsReturned) { + NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get(); + hwInfo.capabilityTable.levelZeroSupported = true; + VariableBackup mockGetenvCalledBackup(&IoFunctions::mockGetenvCalled, 0); + std::unordered_map mockableEnvs = {{"ZET_ENABLE_PROGRAM_DEBUGGING", "2"}}; + VariableBackup *> mockableEnvValuesBackup(&IoFunctions::mockableEnvValues, &mockableEnvs); + + ze_result_t result = ZE_RESULT_ERROR_UNINITIALIZED; + DriverImp driverImp; + auto oldFclDllName = Os::frontEndDllName; + auto oldIgcDllName = Os::igcDllName; + Os::frontEndDllName = "_invalidFCL"; + Os::igcDllName = "_invalidIGC"; + driverImp.initialize(&result); + EXPECT_EQ(result, ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE); + + Os::igcDllName = oldIgcDllName; + Os::frontEndDllName = oldFclDllName; + + ASSERT_EQ(nullptr, L0::GlobalDriver); +} + struct DriverTestMultipleFamilySupport : public ::testing::Test { void SetUp() override { diff --git a/opencl/source/api/api.cpp b/opencl/source/api/api.cpp index 486528d881..a02fc2eb8a 100644 --- a/opencl/source/api/api.cpp +++ b/opencl/source/api/api.cpp @@ -89,10 +89,9 @@ cl_int CL_API_CALL clGetPlatformIDs(cl_uint numEntries, NEO::EnvironmentVariableReader envReader; if (NEO::DebugManager.flags.ExperimentalEnableL0DebuggerForOpenCL.get()) { - auto programDebugging = envReader.getSetting("ZET_ENABLE_PROGRAM_DEBUGGING", 0); - if (programDebugging != 0) { - executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled); - } + const auto programDebugging = envReader.getSetting("ZET_ENABLE_PROGRAM_DEBUGGING", 0); + const auto dbgMode = NEO::getDebuggingMode(programDebugging); + executionEnvironment->setDebuggingMode(dbgMode); } if (envReader.getSetting("NEO_FP64_EMULATION", false)) { executionEnvironment->setFP64EmulationEnabled(); diff --git a/opencl/test/unit_test/api/cl_get_platform_ids_tests.inl b/opencl/test/unit_test/api/cl_get_platform_ids_tests.inl index 3b5fa40ac9..b0e9f61863 100644 --- a/opencl/test/unit_test/api/cl_get_platform_ids_tests.inl +++ b/opencl/test/unit_test/api/cl_get_platform_ids_tests.inl @@ -155,7 +155,32 @@ TEST(clGetPlatformIDsTest, givenEnabledExperimentalSupportAndEnabledProgramDebug EXPECT_EQ(CL_SUCCESS, retVal); - ASSERT_NE(nullptr, platformsImpl); + auto executionEnvironment = platform()->peekExecutionEnvironment(); + EXPECT_TRUE(executionEnvironment->isDebuggingEnabled()); + + platformsImpl->clear(); +} + +TEST(clGetPlatformIDsTest, givenEnabledExperimentalSupportAndEnableProgramDebuggingWithValue2WhenGettingPlatformIdsThenDebuggingEnabledIsSetInExecutionEnvironment) { + DebugManagerStateRestore stateRestore; + NEO::DebugManager.flags.ExperimentalEnableL0DebuggerForOpenCL.set(1); + NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get(); + hwInfo.capabilityTable.levelZeroSupported = true; + + VariableBackup mockGetenvCalledBackup(&IoFunctions::mockGetenvCalled, 0); + std::unordered_map mockableEnvs = {{"ZET_ENABLE_PROGRAM_DEBUGGING", "2"}}; + VariableBackup *> mockableEnvValuesBackup(&IoFunctions::mockableEnvValues, &mockableEnvs); + + cl_int retVal = CL_SUCCESS; + cl_platform_id platformRet = nullptr; + cl_uint numPlatforms = 0; + + platformsImpl->clear(); + + retVal = clGetPlatformIDs(1, &platformRet, &numPlatforms); + + EXPECT_EQ(CL_SUCCESS, retVal); + auto executionEnvironment = platform()->peekExecutionEnvironment(); EXPECT_TRUE(executionEnvironment->isDebuggingEnabled()); @@ -182,7 +207,32 @@ TEST(clGetPlatformIDsTest, givenNoExperimentalSupportAndEnabledProgramDebuggingW EXPECT_EQ(CL_SUCCESS, retVal); - ASSERT_NE(nullptr, platformsImpl); + auto executionEnvironment = platform()->peekExecutionEnvironment(); + EXPECT_FALSE(executionEnvironment->isDebuggingEnabled()); + + platformsImpl->clear(); +} + +TEST(clGetPlatformIDsTest, givenNoExperimentalSupportAndEnableProgramDebuggingWithValue2WhenGettingPlatformIdsThenDebuggingEnabledIsNotSetInExecutionEnvironment) { + DebugManagerStateRestore stateRestore; + NEO::DebugManager.flags.ExperimentalEnableL0DebuggerForOpenCL.set(0); + NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get(); + hwInfo.capabilityTable.levelZeroSupported = true; + + VariableBackup mockGetenvCalledBackup(&IoFunctions::mockGetenvCalled, 0); + std::unordered_map mockableEnvs = {{"ZET_ENABLE_PROGRAM_DEBUGGING", "2"}}; + VariableBackup *> mockableEnvValuesBackup(&IoFunctions::mockableEnvValues, &mockableEnvs); + + cl_int retVal = CL_SUCCESS; + cl_platform_id platformRet = nullptr; + cl_uint numPlatforms = 0; + + platformsImpl->clear(); + + retVal = clGetPlatformIDs(1, &platformRet, &numPlatforms); + + EXPECT_EQ(CL_SUCCESS, retVal); + auto executionEnvironment = platform()->peekExecutionEnvironment(); EXPECT_FALSE(executionEnvironment->isDebuggingEnabled()); @@ -209,7 +259,6 @@ TEST(clGetPlatformIDsTest, givenEnabledExperimentalSupportAndZeroProgramDebuggin EXPECT_EQ(CL_SUCCESS, retVal); - ASSERT_NE(nullptr, platformsImpl); auto executionEnvironment = platform()->peekExecutionEnvironment(); EXPECT_FALSE(executionEnvironment->isDebuggingEnabled()); diff --git a/opencl/test/unit_test/debugger/ocl_with_l0_debugger_tests.cpp b/opencl/test/unit_test/debugger/ocl_with_l0_debugger_tests.cpp index 813fbd5d54..4899e86458 100644 --- a/opencl/test/unit_test/debugger/ocl_with_l0_debugger_tests.cpp +++ b/opencl/test/unit_test/debugger/ocl_with_l0_debugger_tests.cpp @@ -30,7 +30,7 @@ struct DebuggerClFixture void setUp() { hardwareInfo = *NEO::defaultHwInfo.get(); auto executionEnvironment = MockClDevice::prepareExecutionEnvironment(&hardwareInfo, rootDeviceIndex); - executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled); + executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online); device = MockDevice::createWithExecutionEnvironment(&hardwareInfo, executionEnvironment, rootDeviceIndex); ASSERT_NE(nullptr, device); clExecutionEnvironment = static_cast(device->getExecutionEnvironment()); diff --git a/opencl/test/unit_test/linux/main_linux_dll.cpp b/opencl/test/unit_test/linux/main_linux_dll.cpp index 209f5cdcc2..e5f57a1f30 100644 --- a/opencl/test/unit_test/linux/main_linux_dll.cpp +++ b/opencl/test/unit_test/linux/main_linux_dll.cpp @@ -723,7 +723,7 @@ TEST_F(DrmTests, givenDebuggingEnabledWhenDrmIsCreatedThenPerContextVMIsTrueGetV DebugManager.flags.CreateMultipleSubDevices.set(2); DebugManager.flags.UseVmBind.set(1); - rootDeviceEnvironment->executionEnvironment.setDebuggingMode(NEO::DebuggingMode::Enabled); + rootDeviceEnvironment->executionEnvironment.setDebuggingMode(NEO::DebuggingMode::Online); auto drm = DrmWrap::createDrm(*rootDeviceEnvironment); ASSERT_NE(drm, nullptr); @@ -748,7 +748,7 @@ TEST_F(DrmTests, givenEnabledDebuggingAndVmBindNotAvailableWhenDrmIsCreatedThenP DebugManager.flags.UseVmBind.set(0); DebugManager.flags.PrintDebugMessages.set(true); - rootDeviceEnvironment->executionEnvironment.setDebuggingMode(NEO::DebuggingMode::Enabled); + rootDeviceEnvironment->executionEnvironment.setDebuggingMode(NEO::DebuggingMode::Online); auto drm = DrmWrap::createDrm(*rootDeviceEnvironment); EXPECT_NE(drm, nullptr); diff --git a/opencl/test/unit_test/platform/platform_tests.cpp b/opencl/test/unit_test/platform/platform_tests.cpp index a9ad36ca9f..8bbddb1726 100644 --- a/opencl/test/unit_test/platform/platform_tests.cpp +++ b/opencl/test/unit_test/platform/platform_tests.cpp @@ -443,7 +443,7 @@ TEST(PlatformInitTest, givenSingleDeviceWithNonZeroRootDeviceIndexInPassedDevice TEST(PlatformInitTest, GivenDebuggingEnabledWhenPlatformIsInitializedThenL0DebuggerIsCreated) { std::vector> devices; auto executionEnvironment = new MockExecutionEnvironment(defaultHwInfo.get(), false, 1); - executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled); + executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online); devices.push_back(std::make_unique(executionEnvironment, 0)); auto status = platform()->initialize(std::move(devices)); EXPECT_TRUE(status); diff --git a/shared/source/debugger/debugger.h b/shared/source/debugger/debugger.h index c0d065a4d5..4b2578e761 100644 --- a/shared/source/debugger/debugger.h +++ b/shared/source/debugger/debugger.h @@ -46,8 +46,24 @@ class Debugger { enum class DebuggingMode : uint32_t { Disabled, - Enabled + Online, + Offline }; +inline DebuggingMode getDebuggingMode(uint32_t programDebugging) { + switch (programDebugging) { + case 1: { + return DebuggingMode::Online; + } + case 2: { + return DebuggingMode::Offline; + } + case 0: + default: { + return DebuggingMode::Disabled; + } + } +} + static_assert(std::is_standard_layout::value); } // namespace NEO \ No newline at end of file diff --git a/shared/test/unit_test/debugger/linux/test_l0_debugger_linux.cpp b/shared/test/unit_test/debugger/linux/test_l0_debugger_linux.cpp index d8c7f9ca1d..08d4d990bb 100644 --- a/shared/test/unit_test/debugger/linux/test_l0_debugger_linux.cpp +++ b/shared/test/unit_test/debugger/linux/test_l0_debugger_linux.cpp @@ -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(); diff --git a/shared/test/unit_test/debugger/test_l0_debugger.cpp b/shared/test/unit_test/debugger/test_l0_debugger.cpp index 6400d120e5..8f9e35f629 100644 --- a/shared/test/unit_test/debugger/test_l0_debugger.cpp +++ b/shared/test/unit_test/debugger/test_l0_debugger.cpp @@ -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::create(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::create(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: diff --git a/shared/test/unit_test/os_interface/linux/drm_buffer_object_tests.cpp b/shared/test/unit_test/os_interface/linux/drm_buffer_object_tests.cpp index e532aacb77..706dffc4d9 100644 --- a/shared/test/unit_test/os_interface/linux/drm_buffer_object_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/drm_buffer_object_tests.cpp @@ -367,7 +367,7 @@ TEST_F(DrmBufferObjectTest, givenDeleterWhenBufferObjectIsCreatedAndDeletedThenC TEST(DrmBufferObject, givenPerContextVmRequiredWhenBoCreatedThenBindInfoIsInitializedToOsContextCount) { auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); - device->getRootDeviceEnvironment().executionEnvironment.setDebuggingMode(NEO::DebuggingMode::Enabled); + device->getRootDeviceEnvironment().executionEnvironment.setDebuggingMode(NEO::DebuggingMode::Online); device->getExecutionEnvironment()->calculateMaxOsContextCount(); DrmMock drm(*(device->getExecutionEnvironment()->rootDeviceEnvironments[0].get())); EXPECT_TRUE(drm.isPerContextVMRequired()); @@ -385,7 +385,7 @@ TEST(DrmBufferObject, givenPerContextVmRequiredWhenBoCreatedThenBindInfoIsInitia TEST(DrmBufferObject, givenDrmIoctlReturnsErrorNotSupportedThenBufferObjectReturnsError) { auto executionEnvironment = new ExecutionEnvironment; - executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled); + executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online); executionEnvironment->prepareRootDeviceEnvironments(1); executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(defaultHwInfo.get()); executionEnvironment->rootDeviceEnvironments[0]->initGmm(); @@ -412,7 +412,7 @@ TEST(DrmBufferObject, givenDrmIoctlReturnsErrorNotSupportedThenBufferObjectRetur TEST(DrmBufferObject, givenPerContextVmRequiredWhenBoBoundAndUnboundThenCorrectBindInfoIsUpdated) { auto executionEnvironment = new ExecutionEnvironment; - executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled); + executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online); executionEnvironment->prepareRootDeviceEnvironments(1); executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(defaultHwInfo.get()); executionEnvironment->rootDeviceEnvironments[0]->initGmm(); @@ -455,7 +455,7 @@ TEST(DrmBufferObject, givenPrintBOBindingResultWhenBOBindAndUnbindSucceedsThenPr DebugManager.flags.PrintBOBindingResult.set(true); auto executionEnvironment = new ExecutionEnvironment; - executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled); + executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online); executionEnvironment->prepareRootDeviceEnvironments(1); executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(defaultHwInfo.get()); executionEnvironment->rootDeviceEnvironments[0]->initGmm(); @@ -508,7 +508,7 @@ TEST(DrmBufferObject, givenPrintBOBindingResultWhenBOBindAndUnbindFailsThenPrint DebugManager.flags.PrintBOBindingResult.set(true); auto executionEnvironment = new ExecutionEnvironment; - executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled); + executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online); executionEnvironment->prepareRootDeviceEnvironments(1); executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(defaultHwInfo.get()); executionEnvironment->rootDeviceEnvironments[0]->initGmm(); diff --git a/shared/test/unit_test/os_interface/linux/drm_debug_prelim_tests.cpp b/shared/test/unit_test/os_interface/linux/drm_debug_prelim_tests.cpp index f6112ea97b..2b00ac6e52 100644 --- a/shared/test/unit_test/os_interface/linux/drm_debug_prelim_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/drm_debug_prelim_tests.cpp @@ -194,7 +194,7 @@ TEST_F(DrmDebugPrelimTest, GivenDrmWhenRegisteringElfResourceWithoutDataThenRegi TEST(DrmPrelimTest, givenContextDebugAvailableWhenCheckedForSupportThenTrueIsReturned) { auto executionEnvironment = std::make_unique(); - executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled); + executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online); executionEnvironment->prepareRootDeviceEnvironments(1); executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(defaultHwInfo.get()); executionEnvironment->rootDeviceEnvironments[0]->initGmm(); @@ -218,7 +218,7 @@ TEST(DrmPrelimTest, givenContextDebugAvailableWhenCheckedForSupportThenTrueIsRet TEST(DrmPrelimTest, givenContextDebugNotAvailableWhenCheckedForSupportThenTrueIsReturned) { auto executionEnvironment = std::make_unique(); - executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled); + executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online); executionEnvironment->prepareRootDeviceEnvironments(1); executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(defaultHwInfo.get()); executionEnvironment->rootDeviceEnvironments[0]->initGmm(); @@ -314,7 +314,7 @@ HWTEST_F(DrmDebugPrelimTest, givenAddedBindExtHandlesInBoWhenUnbindingThenExtens TEST(DrmPrelimTest, givenProgramDebuggingAndContextDebugAvailableAndCCSEnginesWhenCreatingContextThenDebugFlagSipParamIsSet) { auto executionEnvironment = std::make_unique(); - executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled); + executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online); executionEnvironment->prepareRootDeviceEnvironments(1); executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(defaultHwInfo.get()); executionEnvironment->rootDeviceEnvironments[0]->initGmm(); @@ -336,7 +336,7 @@ TEST(DrmPrelimTest, givenProgramDebuggingAndContextDebugAvailableAndCCSEnginesWh TEST(DrmPrelimTest, givenProgramDebuggingAndContextDebugAvailableAndCCSEnginesWhenCreatingContextThenContextRunaloneIsSetOnlyIfCCSEnginesArePresent) { auto executionEnvironment = std::make_unique(); - executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled); + executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online); executionEnvironment->prepareRootDeviceEnvironments(1); executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(defaultHwInfo.get()); executionEnvironment->rootDeviceEnvironments[0]->initGmm(); diff --git a/shared/test/unit_test/os_interface/linux/drm_query_prelim_tests.cpp b/shared/test/unit_test/os_interface/linux/drm_query_prelim_tests.cpp index 049ee66986..a799d8c3ee 100644 --- a/shared/test/unit_test/os_interface/linux/drm_query_prelim_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/drm_query_prelim_tests.cpp @@ -312,7 +312,7 @@ TEST(DrmBufferObjectTestPrelim, givenDebuggingEnabledWithoutDisableScratchPagesF auto executionEnvironment = std::make_unique(); DrmQueryMock drm{*executionEnvironment->rootDeviceEnvironments[0]}; - executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled); + executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online); uint32_t vmId = 0; drm.createDrmVirtualMemory(vmId); @@ -327,7 +327,7 @@ TEST(DrmBufferObjectTestPrelim, givenDisableScratchPagesAndDebuggingEnabledWhenC auto executionEnvironment = std::make_unique(); DrmQueryMock drm{*executionEnvironment->rootDeviceEnvironments[0]}; - executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled); + executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online); uint32_t vmId = 0; drm.createDrmVirtualMemory(vmId); diff --git a/shared/test/unit_test/os_interface/linux/drm_tests.cpp b/shared/test/unit_test/os_interface/linux/drm_tests.cpp index f61990c77b..d377fc2eb2 100644 --- a/shared/test/unit_test/os_interface/linux/drm_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/drm_tests.cpp @@ -669,7 +669,7 @@ TEST(DrmTest, givenDrmWhenCreatingOsContextThenCreateDrmContextWithVmId) { TEST(DrmTest, givenDrmWithPerContextVMRequiredWhenCreatingOsContextsThenImplicitVmIdPerContextIsUsed) { MockExecutionEnvironment executionEnvironment{}; auto &rootEnv = *executionEnvironment.rootDeviceEnvironments[0]; - rootEnv.executionEnvironment.setDebuggingMode(NEO::DebuggingMode::Enabled); + rootEnv.executionEnvironment.setDebuggingMode(NEO::DebuggingMode::Online); DrmMock drmMock(rootEnv); EXPECT_TRUE(drmMock.requirePerContextVM); @@ -684,7 +684,7 @@ TEST(DrmTest, givenDrmWithPerContextVMRequiredWhenCreatingOsContextsThenImplicit TEST(DrmTest, givenPerContextVMRequiredWhenCreatingOsContextsThenImplicitVmIdPerContextIsQueriedAndStored) { MockExecutionEnvironment executionEnvironment{}; auto &rootEnv = *executionEnvironment.rootDeviceEnvironments[0]; - rootEnv.executionEnvironment.setDebuggingMode(NEO::DebuggingMode::Enabled); + rootEnv.executionEnvironment.setDebuggingMode(NEO::DebuggingMode::Online); DrmMock drmMock(rootEnv); EXPECT_TRUE(drmMock.requirePerContextVM); @@ -704,7 +704,7 @@ TEST(DrmTest, givenPerContextVMRequiredWhenCreatingOsContextsThenImplicitVmIdPer TEST(DrmTest, givenPerContextVMRequiredWhenCreatingOsContextForSubDeviceThenImplicitVmIdPerContextIsQueriedAndStoredAtSubDeviceIndex) { MockExecutionEnvironment executionEnvironment{}; auto &rootEnv = *executionEnvironment.rootDeviceEnvironments[0]; - rootEnv.executionEnvironment.setDebuggingMode(NEO::DebuggingMode::Enabled); + rootEnv.executionEnvironment.setDebuggingMode(NEO::DebuggingMode::Online); DrmMock drmMock(rootEnv); EXPECT_TRUE(drmMock.requirePerContextVM); @@ -728,7 +728,7 @@ TEST(DrmTest, givenPerContextVMRequiredWhenCreatingOsContextForSubDeviceThenImpl TEST(DrmTest, givenPerContextVMRequiredWhenCreatingOsContextsForRootDeviceThenImplicitVmIdsPerContextAreQueriedAndStoredAtSubDeviceIndices) { MockExecutionEnvironment executionEnvironment{}; auto &rootEnv = *executionEnvironment.rootDeviceEnvironments[0]; - rootEnv.executionEnvironment.setDebuggingMode(NEO::DebuggingMode::Enabled); + rootEnv.executionEnvironment.setDebuggingMode(NEO::DebuggingMode::Online); DrmMock drmMock(rootEnv); EXPECT_TRUE(drmMock.requirePerContextVM); @@ -769,7 +769,7 @@ TEST(DrmTest, givenNoPerContextVmsDrmWhenCreatingOsContextsThenVmIdIsNotQueriedA TEST(DrmTest, givenProgramDebuggingAndContextDebugAvailableWhenCreatingContextThenSetContextDebugFlagIsCalled) { auto executionEnvironment = std::make_unique(); - executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled); + executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online); executionEnvironment->prepareRootDeviceEnvironments(1); executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(defaultHwInfo.get()); executionEnvironment->rootDeviceEnvironments[0]->initGmm(); @@ -789,7 +789,7 @@ TEST(DrmTest, givenProgramDebuggingAndContextDebugAvailableWhenCreatingContextTh TEST(DrmTest, givenProgramDebuggingAndContextDebugAvailableWhenCreatingContextForInternalEngineThenSetContextDebugFlagIsNotCalled) { auto executionEnvironment = std::make_unique(); - executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled); + executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online); executionEnvironment->prepareRootDeviceEnvironments(1); executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(defaultHwInfo.get()); executionEnvironment->rootDeviceEnvironments[0]->initGmm(); @@ -825,7 +825,7 @@ TEST(DrmTest, givenNotEnabledDebuggingOrContextDebugUnsupportedWhenCreatingConte EXPECT_FALSE(drmMock.capturedCooperativeContextRequest); - executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled); + executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online); drmMock.contextDebugSupported = false; drmMock.callBaseCreateDrmContext = false; drmMock.capturedCooperativeContextRequest = true; @@ -881,7 +881,7 @@ TEST(DrmTest, givenPrintIoctlDebugFlagNotSetWhenGettingTimestampFrequencyThenCap TEST(DrmTest, givenProgramDebuggingWhenCreatingContextThenUnrecoverableContextIsSet) { auto executionEnvironment = std::make_unique(); - executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled); + executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online); executionEnvironment->prepareRootDeviceEnvironments(1); executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(defaultHwInfo.get()); executionEnvironment->rootDeviceEnvironments[0]->initGmm(); diff --git a/shared/test/unit_test/os_interface/linux/drm_with_prelim_tests.cpp b/shared/test/unit_test/os_interface/linux/drm_with_prelim_tests.cpp index 6a144d7205..18b7f45410 100644 --- a/shared/test/unit_test/os_interface/linux/drm_with_prelim_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/drm_with_prelim_tests.cpp @@ -496,7 +496,7 @@ TEST_F(IoctlHelperPrelimFixture, whenCreateDrmContextIsCalledThenIoctlIsCalledOn } TEST_F(IoctlHelperPrelimFixture, givenProgramDebuggingAndContextDebugSupportedWhenCreatingContextThenCooperativeFlagIsPassedToCreateDrmContextOnlyIfCCSEnginesArePresent) { - executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled); + executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online); drm->contextDebugSupported = true; drm->callBaseCreateDrmContext = false; diff --git a/shared/test/unit_test/os_interface/windows/wddm_tests.cpp b/shared/test/unit_test/os_interface/windows/wddm_tests.cpp index 84505adfdb..41de633934 100644 --- a/shared/test/unit_test/os_interface/windows/wddm_tests.cpp +++ b/shared/test/unit_test/os_interface/windows/wddm_tests.cpp @@ -88,7 +88,7 @@ TEST_F(WddmTests, whenftrEuDebugIsFalseThenDebuggingEnabledReturnsFalse) { } TEST_F(WddmTests, whenProgramDebugIsEnabledAndCreatingContextWithInternalEngineThenDebuggableContextReturnsFalse) { - executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Enabled); + executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online); wddm->init(); OsContextWin osContext(*wddm, 0, 5u, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::EngineType::ENGINE_RCS, EngineUsage::Internal})); osContext.ensureContextInitialized(); @@ -181,7 +181,7 @@ TEST_F(WddmTests, GivengtSystemInfoSliceInfoHasEnabledSlicesAtHigherIndicesThenE &hwInfo->gtSystemInfo, hwInfo->capabilityTable.gpuAddressSpace)); - wddm->rootDeviceEnvironment.executionEnvironment.setDebuggingMode(NEO::DebuggingMode::Enabled); + wddm->rootDeviceEnvironment.executionEnvironment.setDebuggingMode(NEO::DebuggingMode::Online); EXPECT_TRUE(wddm->init()); const auto &topologyMap = wddm->getTopologyMap(); EXPECT_EQ(topologyMap.size(), 1u); @@ -206,7 +206,7 @@ TEST_F(WddmTests, GivenProperTopologyDataAndDebugFlagsEnabledWhenInitializingWdd &hwInfo->gtSystemInfo, hwInfo->capabilityTable.gpuAddressSpace)); - wddm->rootDeviceEnvironment.executionEnvironment.setDebuggingMode(NEO::DebuggingMode::Enabled); + wddm->rootDeviceEnvironment.executionEnvironment.setDebuggingMode(NEO::DebuggingMode::Online); EXPECT_TRUE(wddm->init()); const auto &topologyMap = wddm->getTopologyMap(); EXPECT_EQ(topologyMap.size(), 1u); @@ -227,7 +227,7 @@ TEST_F(WddmTests, GivenNoSubsliceEnabledAndDebugFlagsEnabledWhenInitializingWddm &hwInfo->gtSystemInfo, hwInfo->capabilityTable.gpuAddressSpace)); - wddm->rootDeviceEnvironment.executionEnvironment.setDebuggingMode(NEO::DebuggingMode::Enabled); + wddm->rootDeviceEnvironment.executionEnvironment.setDebuggingMode(NEO::DebuggingMode::Online); EXPECT_FALSE(wddm->init()); const auto &topologyMap = wddm->getTopologyMap(); EXPECT_TRUE(topologyMap.empty());