Create DebuggerL0 only when debugging is supported

Related-To: NEO-5239

Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2020-11-23 14:31:20 +00:00
committed by Compute-Runtime-Automation
parent 8fdc35bb4b
commit 8aacad1854
19 changed files with 173 additions and 37 deletions

View File

@@ -81,7 +81,7 @@ class DebuggerL0 : public NEO::Debugger, NEO::NonCopyableOrMovableClass {
sba.SurfaceStateBaseAddress != 0 ||
sba.BindlessSurfaceStateBaseAddress != 0;
}
static void initDebuggingInOs(NEO::OSInterface *osInterface);
static bool initDebuggingInOs(NEO::OSInterface *osInterface);
void initialize();

View File

@@ -13,10 +13,14 @@
#include "level_zero/core/source/debugger/debugger_l0.h"
namespace L0 {
void DebuggerL0::initDebuggingInOs(NEO::OSInterface *osInterface) {
bool DebuggerL0::initDebuggingInOs(NEO::OSInterface *osInterface) {
if (osInterface != nullptr) {
auto drm = osInterface->get()->getDrm();
drm->registerResourceClasses();
if (drm->isVmBindAvailable() && drm->isPerContextVMRequired()) {
drm->registerResourceClasses();
return true;
}
}
return false;
}
} // namespace L0

View File

@@ -8,6 +8,7 @@
#include "level_zero/core/source/debugger/debugger_l0.h"
namespace L0 {
void DebuggerL0::initDebuggingInOs(NEO::OSInterface *osInterface) {
bool DebuggerL0::initDebuggingInOs(NEO::OSInterface *osInterface) {
return false;
}
} // namespace L0

View File

@@ -13,9 +13,12 @@
namespace L0 {
std::unique_ptr<NEO::Debugger> DebuggerL0::create(NEO::Device *device) {
initDebuggingInOs(device->getRootDeviceEnvironment().osInterface.get());
auto debugger = debuggerL0Factory[device->getHardwareInfo().platform.eRenderCoreFamily](device);
return std::unique_ptr<DebuggerL0>(debugger);
auto success = initDebuggingInOs(device->getRootDeviceEnvironment().osInterface.get());
if (success) {
auto debugger = debuggerL0Factory[device->getHardwareInfo().platform.eRenderCoreFamily](device);
return std::unique_ptr<DebuggerL0>(debugger);
}
return std::unique_ptr<DebuggerL0>(nullptr);
}
} // namespace L0

View File

@@ -46,7 +46,7 @@ void DriverImp::initialize(ze_result_t *result) {
UNRECOVERABLE_IF(nullptr == executionEnvironment);
if (envVariables.programDebugging) {
executionEnvironment->setPerContextMemorySpace();
executionEnvironment->setDebuggingEnabled();
}
executionEnvironment->incRefInternal();