feature: Disable LevelZero debugging when experimental OpenCL enabled

- both drivers: OpenCL and LevelZero cannot be debugged within single
process

Related-To: NEO-7025

Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe 2023-01-13 15:00:50 +00:00 committed by Compute-Runtime-Automation
parent 9b13f13e51
commit 7850d06c09
3 changed files with 30 additions and 4 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2022 Intel Corporation
* Copyright (C) 2020-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -48,7 +48,9 @@ void DriverImp::initialize(ze_result_t *result) {
UNRECOVERABLE_IF(nullptr == executionEnvironment);
if (envVariables.programDebugging) {
executionEnvironment->setDebuggingEnabled();
if (!NEO::DebugManager.flags.ExperimentalEnableL0DebuggerForOpenCL.get()) {
executionEnvironment->setDebuggingEnabled();
}
}
executionEnvironment->incRefInternal();

View File

@ -391,6 +391,30 @@ TEST(DriverImpTest, givenEnabledProgramDebuggingWhenCreatingExecutionEnvironment
L0::GlobalDriver = nullptr;
}
TEST(DriverImpTest, givenEnabledProgramDebuggingAndEnabledExperimentalOpenCLWhenCreatingExecutionEnvironmentThenDebuggingEnabledIsFalse) {
DebugManagerStateRestore restorer;
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get();
hwInfo.capabilityTable.levelZeroSupported = true;
NEO::DebugManager.flags.ExperimentalEnableL0DebuggerForOpenCL.set(true);
VariableBackup<uint32_t> mockGetenvCalledBackup(&IoFunctions::mockGetenvCalled, 0);
std::unordered_map<std::string, std::string> mockableEnvs = {{"ZET_ENABLE_PROGRAM_DEBUGGING", "1"}};
VariableBackup<std::unordered_map<std::string, std::string> *> mockableEnvValuesBackup(&IoFunctions::mockableEnvValues, &mockableEnvs);
VariableBackup<decltype(L0::GlobalDriverHandle)> mockableDriverHandle(&L0::GlobalDriverHandle);
VariableBackup<decltype(L0::GlobalDriver)> 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();

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
* Copyright (C) 2018-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -454,7 +454,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, ExperimentalCopyThroughLock, -1, "Experimentally
DECLARE_DEBUG_VARIABLE(int32_t, ExperimentalForceCopyThroughLock, -1, "Force copy through lock pointer on zeAppendMemoryCopy for all cases -1: default 0: disable 1: enable ")
DECLARE_DEBUG_VARIABLE(int32_t, ExperimentalSmallBufferPoolAllocator, -1, "Experimentally enable pool allocator for clCreateBuffer under 4KB.")
DECLARE_DEBUG_VARIABLE(bool, ExperimentalEnableSourceLevelDebugger, false, "Experimentally enable source level debugger.")
DECLARE_DEBUG_VARIABLE(bool, ExperimentalEnableL0DebuggerForOpenCL, false, "Experimentally enable debugging OCL with L0 Debug API.")
DECLARE_DEBUG_VARIABLE(bool, ExperimentalEnableL0DebuggerForOpenCL, false, "Experimentally enable debugging OCL with L0 Debug API. When enabled - Level Zero debugging is disabled.")
DECLARE_DEBUG_VARIABLE(bool, ExperimentalEnableTileAttach, true, "Experimentally enable attaching to tiles (subdevices).")
/*DRIVER TOGGLES*/