Move debugger to root device environment

Resolves: NEO-3857

Change-Id: I216ef0cfc4ed7e1ab67261378905c6c0ec40a17f
Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2020-03-11 08:56:55 +01:00
committed by sys_ocldev
parent 7ded3e9906
commit 9cc4d6fba1
13 changed files with 36 additions and 42 deletions

View File

@@ -51,7 +51,7 @@ bool Device::createDeviceImpl() {
preemptionMode = PreemptionHelper::getDefaultPreemptionMode(hwInfo);
if (!getDebugger()) {
this->executionEnvironment->initDebugger();
this->executionEnvironment->rootDeviceEnvironments[getRootDeviceIndex()]->initDebugger();
}
auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
hwHelper.setupHardwareCapabilities(&this->hardwareCapabilities, hwInfo);

View File

@@ -51,7 +51,7 @@ class Device : public ReferenceTrackedObject<Device> {
PerformanceCounters *getPerformanceCounters() { return performanceCounters.get(); }
PreemptionMode getPreemptionMode() const { return preemptionMode; }
MOCKABLE_VIRTUAL bool isDebuggerActive() const;
Debugger *getDebugger() { return executionEnvironment->debugger.get(); }
Debugger *getDebugger() { return getRootDeviceEnvironment().debugger.get(); }
ExecutionEnvironment *getExecutionEnvironment() const { return executionEnvironment; }
const RootDeviceEnvironment &getRootDeviceEnvironment() const { return *executionEnvironment->rootDeviceEnvironments[getRootDeviceIndex()]; }
const HardwareCapabilities &getHardwareCapabilities() const { return hardwareCapabilities; }

View File

@@ -7,12 +7,7 @@
#include "shared/source/execution_environment/execution_environment.h"
#include "shared/source/built_ins/built_ins.h"
#include "shared/source/compiler_interface/compiler_interface.h"
#include "shared/source/compiler_interface/default_cache_config.h"
#include "shared/source/debugger/debugger.h"
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/helpers/hw_helper.h"
#include "opencl/source/memory_manager/os_agnostic_memory_manager.h"
@@ -21,10 +16,6 @@ namespace NEO {
ExecutionEnvironment::ExecutionEnvironment() = default;
ExecutionEnvironment::~ExecutionEnvironment() {
debugger.reset();
for (auto &rootDeviceEnvironment : rootDeviceEnvironments) {
rootDeviceEnvironment->builtins.reset();
}
if (memoryManager) {
memoryManager->commonCleanup();
}
@@ -56,10 +47,6 @@ void ExecutionEnvironment::initializeMemoryManager() {
DEBUG_BREAK_IF(!this->memoryManager);
}
void ExecutionEnvironment::initDebugger() {
debugger = Debugger::create(rootDeviceEnvironments[0]->getMutableHardwareInfo());
}
void ExecutionEnvironment::calculateMaxOsContextCount() {
for (const auto &rootDeviceEnvironment : this->rootDeviceEnvironments) {
auto hwInfo = rootDeviceEnvironment->getHardwareInfo();

View File

@@ -12,7 +12,6 @@
namespace NEO {
class MemoryManager;
class Debugger;
struct RootDeviceEnvironment;
class ExecutionEnvironment : public ReferenceTrackedObject<ExecutionEnvironment> {
@@ -22,12 +21,10 @@ class ExecutionEnvironment : public ReferenceTrackedObject<ExecutionEnvironment>
~ExecutionEnvironment() override;
void initializeMemoryManager();
void initDebugger();
void calculateMaxOsContextCount();
void prepareRootDeviceEnvironments(uint32_t numRootDevices);
std::unique_ptr<MemoryManager> memoryManager;
std::vector<std::unique_ptr<RootDeviceEnvironment>> rootDeviceEnvironments;
std::unique_ptr<Debugger> debugger;
};
} // namespace NEO

View File

@@ -10,6 +10,7 @@
#include "shared/source/built_ins/built_ins.h"
#include "shared/source/compiler_interface/compiler_interface.h"
#include "shared/source/compiler_interface/default_cache_config.h"
#include "shared/source/debugger/debugger.h"
#include "shared/source/execution_environment/execution_environment.h"
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/gmm_helper/page_table_mngr.h"
@@ -32,6 +33,11 @@ void RootDeviceEnvironment::initAubCenter(bool localMemoryEnabled, const std::st
aubCenter.reset(new AubCenter(getHardwareInfo(), localMemoryEnabled, aubFileName, csrType));
}
}
void RootDeviceEnvironment::initDebugger() {
debugger = Debugger::create(hwInfo.get());
}
const HardwareInfo *RootDeviceEnvironment::getHardwareInfo() const {
return hwInfo.get();
}

View File

@@ -15,17 +15,18 @@
namespace NEO {
class AubCenter;
class BuiltIns;
class CompilerInterface;
class AubCenter;
class Debugger;
class ExecutionEnvironment;
class GmmClientContext;
class GmmHelper;
class ExecutionEnvironment;
class GmmPageTableMngr;
class HwDeviceId;
class MemoryOperationsHandler;
class OSInterface;
struct HardwareInfo;
class HwDeviceId;
struct RootDeviceEnvironment {
protected:
@@ -44,6 +45,7 @@ struct RootDeviceEnvironment {
MOCKABLE_VIRTUAL void initAubCenter(bool localMemoryEnabled, const std::string &aubFileName, CommandStreamReceiverType csrType);
bool initOsInterface(std::unique_ptr<HwDeviceId> &&hwDeviceId);
void initGmm();
void initDebugger();
GmmHelper *getGmmHelper() const;
GmmClientContext *getGmmClientContext() const;
MOCKABLE_VIRTUAL CompilerInterface *getCompilerInterface();
@@ -55,8 +57,9 @@ struct RootDeviceEnvironment {
std::unique_ptr<MemoryOperationsHandler> memoryOperationsInterface;
std::unique_ptr<AubCenter> aubCenter;
std::unique_ptr<BuiltIns> builtins;
std::unique_ptr<CompilerInterface> compilerInterface;
std::unique_ptr<BuiltIns> builtins;
std::unique_ptr<Debugger> debugger;
ExecutionEnvironment &executionEnvironment;
private: