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

@ -168,7 +168,7 @@ void Device::initializeCaps() {
deviceInfo.vmeAvcSupportsPreemption = hwInfo.capabilityTable.ftrSupportsVmeAvcPreemption; deviceInfo.vmeAvcSupportsPreemption = hwInfo.capabilityTable.ftrSupportsVmeAvcPreemption;
deviceInfo.debuggerActive = (executionEnvironment->debugger) ? executionEnvironment->debugger->isDebuggerActive() : false; deviceInfo.debuggerActive = (getRootDeviceEnvironment().debugger.get()) ? getRootDeviceEnvironment().debugger->isDebuggerActive() : false;
if (deviceInfo.debuggerActive) { if (deviceInfo.debuggerActive) {
this->preemptionMode = PreemptionMode::Disabled; this->preemptionMode = PreemptionMode::Disabled;
} }

View File

@ -33,7 +33,7 @@ class EnqueueDebugKernelTest : public ProgramSimpleFixture,
void SetUp() override { void SetUp() override {
ProgramSimpleFixture::SetUp(); ProgramSimpleFixture::SetUp();
device = pClDevice; device = pClDevice;
pDevice->executionEnvironment->debugger.reset(new SourceLevelDebugger(nullptr)); pDevice->executionEnvironment->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->debugger.reset(new SourceLevelDebugger(nullptr));
if (pDevice->getHardwareInfo().platform.eRenderCoreFamily >= IGFX_GEN9_CORE) { if (pDevice->getHardwareInfo().platform.eRenderCoreFamily >= IGFX_GEN9_CORE) {
pDevice->deviceInfo.debuggerActive = true; pDevice->deviceInfo.debuggerActive = true;

View File

@ -153,7 +153,7 @@ TEST(ExecutionEnvironment, givenExecutionEnvironmentWhenInitializeMemoryManagerI
} }
static_assert(sizeof(ExecutionEnvironment) == sizeof(std::unique_ptr<HardwareInfo>) + static_assert(sizeof(ExecutionEnvironment) == sizeof(std::unique_ptr<HardwareInfo>) +
sizeof(std::vector<RootDeviceEnvironment>) + sizeof(std::vector<RootDeviceEnvironment>) +
(is64bit ? 24 : 16), (is64bit ? 16 : 12),
"New members detected in ExecutionEnvironment, please ensure that destruction sequence of objects is correct"); "New members detected in ExecutionEnvironment, please ensure that destruction sequence of objects is correct");
TEST(ExecutionEnvironment, givenExecutionEnvironmentWithVariousMembersWhenItIsDestroyedThenDeleteSequenceIsSpecified) { TEST(ExecutionEnvironment, givenExecutionEnvironmentWithVariousMembersWhenItIsDestroyedThenDeleteSequenceIsSpecified) {
@ -194,7 +194,7 @@ TEST(ExecutionEnvironment, givenExecutionEnvironmentWithVariousMembersWhenItIsDe
executionEnvironment->rootDeviceEnvironments[0]->aubCenter = std::make_unique<AubCenterMock>(destructorId); executionEnvironment->rootDeviceEnvironments[0]->aubCenter = std::make_unique<AubCenterMock>(destructorId);
executionEnvironment->rootDeviceEnvironments[0]->builtins = std::make_unique<BuiltinsMock>(destructorId); executionEnvironment->rootDeviceEnvironments[0]->builtins = std::make_unique<BuiltinsMock>(destructorId);
executionEnvironment->rootDeviceEnvironments[0]->compilerInterface = std::make_unique<CompilerInterfaceMock>(destructorId); executionEnvironment->rootDeviceEnvironments[0]->compilerInterface = std::make_unique<CompilerInterfaceMock>(destructorId);
executionEnvironment->debugger = std::make_unique<SourceLevelDebuggerMock>(destructorId); executionEnvironment->rootDeviceEnvironments[0]->debugger = std::make_unique<SourceLevelDebuggerMock>(destructorId);
executionEnvironment.reset(nullptr); executionEnvironment.reset(nullptr);
EXPECT_EQ(8u, destructorId); EXPECT_EQ(8u, destructorId);

View File

@ -151,7 +151,7 @@ TEST_F(PlatformTest, givenDisabledPreemptionInactiveSourceLevelDebuggerWhenIniti
executionEnvironment->rootDeviceEnvironments[0]->builtins.reset(builtIns); executionEnvironment->rootDeviceEnvironments[0]->builtins.reset(builtIns);
auto sourceLevelDebugger = new MockSourceLevelDebugger(); auto sourceLevelDebugger = new MockSourceLevelDebugger();
sourceLevelDebugger->setActive(false); sourceLevelDebugger->setActive(false);
pPlatform->peekExecutionEnvironment()->debugger.reset(sourceLevelDebugger); executionEnvironment->rootDeviceEnvironments[0]->debugger.reset(sourceLevelDebugger);
EXPECT_EQ(SipKernelType::COUNT, MockSipData::calledType); EXPECT_EQ(SipKernelType::COUNT, MockSipData::calledType);
EXPECT_FALSE(MockSipData::called); EXPECT_FALSE(MockSipData::called);
@ -168,7 +168,7 @@ TEST_F(PlatformTest, givenDisabledPreemptionActiveSourceLevelDebuggerWhenInitial
auto executionEnvironment = pPlatform->peekExecutionEnvironment(); auto executionEnvironment = pPlatform->peekExecutionEnvironment();
executionEnvironment->prepareRootDeviceEnvironments(1); executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->builtins.reset(builtIns); executionEnvironment->rootDeviceEnvironments[0]->builtins.reset(builtIns);
pPlatform->peekExecutionEnvironment()->debugger.reset(new MockActiveSourceLevelDebugger()); executionEnvironment->rootDeviceEnvironments[0]->debugger.reset(new MockActiveSourceLevelDebugger());
EXPECT_EQ(SipKernelType::COUNT, MockSipData::calledType); EXPECT_EQ(SipKernelType::COUNT, MockSipData::calledType);
EXPECT_FALSE(MockSipData::called); EXPECT_FALSE(MockSipData::called);

View File

@ -102,7 +102,7 @@ TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugAndOptDisabledWhen
MockActiveSourceLevelDebugger *sourceLevelDebugger = new MockActiveSourceLevelDebugger; MockActiveSourceLevelDebugger *sourceLevelDebugger = new MockActiveSourceLevelDebugger;
sourceLevelDebugger->isOptDisabled = true; sourceLevelDebugger->isOptDisabled = true;
pDevice->executionEnvironment->debugger.reset(sourceLevelDebugger); pDevice->executionEnvironment->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->debugger.reset(sourceLevelDebugger);
cl_int retVal = pProgram->compile(1, &device, nullptr, cl_int retVal = pProgram->compile(1, &device, nullptr,
0, nullptr, nullptr, 0, nullptr, nullptr,
@ -117,7 +117,7 @@ TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsCompi
if (pDevice->getHardwareInfo().platform.eRenderCoreFamily >= IGFX_GEN9_CORE) { if (pDevice->getHardwareInfo().platform.eRenderCoreFamily >= IGFX_GEN9_CORE) {
MockActiveSourceLevelDebugger *sourceLevelDebugger = new MockActiveSourceLevelDebugger; MockActiveSourceLevelDebugger *sourceLevelDebugger = new MockActiveSourceLevelDebugger;
sourceLevelDebugger->sourceCodeFilename = "debugFileName"; sourceLevelDebugger->sourceCodeFilename = "debugFileName";
pDevice->executionEnvironment->debugger.reset(sourceLevelDebugger); pDevice->executionEnvironment->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->debugger.reset(sourceLevelDebugger);
cl_int retVal = pProgram->compile(1, &device, nullptr, cl_int retVal = pProgram->compile(1, &device, nullptr,
0, nullptr, nullptr, 0, nullptr, nullptr,
@ -157,7 +157,7 @@ TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugAndOptDisabledWhen
MockActiveSourceLevelDebugger *sourceLevelDebugger = new MockActiveSourceLevelDebugger; MockActiveSourceLevelDebugger *sourceLevelDebugger = new MockActiveSourceLevelDebugger;
sourceLevelDebugger->isOptDisabled = true; sourceLevelDebugger->isOptDisabled = true;
pDevice->executionEnvironment->debugger.reset(sourceLevelDebugger); pDevice->executionEnvironment->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->debugger.reset(sourceLevelDebugger);
cl_int retVal = pProgram->build(1, &device, nullptr, nullptr, nullptr, false); cl_int retVal = pProgram->build(1, &device, nullptr, nullptr, nullptr, false);
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
@ -170,7 +170,7 @@ TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsBuilt
MockActiveSourceLevelDebugger *sourceLevelDebugger = new MockActiveSourceLevelDebugger; MockActiveSourceLevelDebugger *sourceLevelDebugger = new MockActiveSourceLevelDebugger;
sourceLevelDebugger->sourceCodeFilename = "debugFileName"; sourceLevelDebugger->sourceCodeFilename = "debugFileName";
pDevice->executionEnvironment->debugger.reset(sourceLevelDebugger); pDevice->executionEnvironment->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->debugger.reset(sourceLevelDebugger);
cl_int retVal = pProgram->build(1, &device, nullptr, nullptr, nullptr, false); cl_int retVal = pProgram->build(1, &device, nullptr, nullptr, nullptr, false);
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
@ -182,7 +182,7 @@ TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsLinke
if (pDevice->getHardwareInfo().platform.eRenderCoreFamily >= IGFX_GEN9_CORE) { if (pDevice->getHardwareInfo().platform.eRenderCoreFamily >= IGFX_GEN9_CORE) {
MockActiveSourceLevelDebugger *sourceLevelDebugger = new MockActiveSourceLevelDebugger; MockActiveSourceLevelDebugger *sourceLevelDebugger = new MockActiveSourceLevelDebugger;
pDevice->executionEnvironment->debugger.reset(sourceLevelDebugger); pDevice->executionEnvironment->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->debugger.reset(sourceLevelDebugger);
cl_int retVal = pProgram->compile(1, &device, nullptr, 0, nullptr, nullptr, nullptr, nullptr); cl_int retVal = pProgram->compile(1, &device, nullptr, 0, nullptr, nullptr, nullptr, nullptr);
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
@ -210,7 +210,7 @@ TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsBuilt
EXPECT_CALL(*sourceLevelDebugger, notifyKernelDebugData(::testing::_, ::testing::_, ::testing::_, ::testing::_)).Times(1); EXPECT_CALL(*sourceLevelDebugger, notifyKernelDebugData(::testing::_, ::testing::_, ::testing::_, ::testing::_)).Times(1);
sourceLevelDebugger->setActive(true); sourceLevelDebugger->setActive(true);
pDevice->executionEnvironment->debugger.reset(sourceLevelDebugger); pDevice->executionEnvironment->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->debugger.reset(sourceLevelDebugger);
cl_int retVal = pProgram->build(1, &device, nullptr, nullptr, nullptr, false); cl_int retVal = pProgram->build(1, &device, nullptr, nullptr, nullptr, false);
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
@ -229,7 +229,7 @@ TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsLinke
EXPECT_CALL(*sourceLevelDebugger, notifyKernelDebugData(::testing::_, ::testing::_, ::testing::_, ::testing::_)).Times(1); EXPECT_CALL(*sourceLevelDebugger, notifyKernelDebugData(::testing::_, ::testing::_, ::testing::_, ::testing::_)).Times(1);
sourceLevelDebugger->setActive(true); sourceLevelDebugger->setActive(true);
pDevice->executionEnvironment->debugger.reset(sourceLevelDebugger); pDevice->executionEnvironment->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->debugger.reset(sourceLevelDebugger);
cl_int retVal = pProgram->compile(1, &device, nullptr, cl_int retVal = pProgram->compile(1, &device, nullptr,
0, nullptr, nullptr, 0, nullptr, nullptr,

View File

@ -40,7 +40,8 @@ class MockDeviceWithDebuggerActive : public MockDevice {
TEST(DeviceWithSourceLevelDebugger, givenDeviceWithSourceLevelDebuggerActiveWhenDeviceIsDestructedThenSourceLevelDebuggerIsNotified) { TEST(DeviceWithSourceLevelDebugger, givenDeviceWithSourceLevelDebuggerActiveWhenDeviceIsDestructedThenSourceLevelDebuggerIsNotified) {
ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment(); ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment();
auto gmock = new ::testing::NiceMock<GMockSourceLevelDebugger>(new MockOsLibrary); auto gmock = new ::testing::NiceMock<GMockSourceLevelDebugger>(new MockOsLibrary);
executionEnvironment->debugger.reset(gmock);
executionEnvironment->rootDeviceEnvironments[0]->debugger.reset(gmock);
auto device = std::make_unique<MockClDevice>(MockDevice::create<MockDeviceWithDebuggerActive>(executionEnvironment, 0u)); auto device = std::make_unique<MockClDevice>(MockDevice::create<MockDeviceWithDebuggerActive>(executionEnvironment, 0u));
EXPECT_CALL(*gmock, notifyDeviceDestruction()).Times(1); EXPECT_CALL(*gmock, notifyDeviceDestruction()).Times(1);
@ -48,7 +49,7 @@ TEST(DeviceWithSourceLevelDebugger, givenDeviceWithSourceLevelDebuggerActiveWhen
TEST(DeviceWithSourceLevelDebugger, givenDeviceWithSourceLevelDebuggerActiveWhenDeviceIsCreatedThenPreemptionIsDisabled) { TEST(DeviceWithSourceLevelDebugger, givenDeviceWithSourceLevelDebuggerActiveWhenDeviceIsCreatedThenPreemptionIsDisabled) {
ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment(); ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment();
executionEnvironment->debugger.reset(new MockActiveSourceLevelDebugger(new MockOsLibrary)); executionEnvironment->rootDeviceEnvironments[0]->debugger.reset(new MockActiveSourceLevelDebugger(new MockOsLibrary));
auto device = std::unique_ptr<MockDevice>(MockDevice::create<MockDeviceWithDebuggerActive>(executionEnvironment, 0u)); auto device = std::unique_ptr<MockDevice>(MockDevice::create<MockDeviceWithDebuggerActive>(executionEnvironment, 0u));
EXPECT_EQ(PreemptionMode::Disabled, device->getPreemptionMode()); EXPECT_EQ(PreemptionMode::Disabled, device->getPreemptionMode());

View File

@ -53,7 +53,7 @@ TEST(SourceLevelDebugger, givenPlatformWhenItIsCreatedThenSourceLevelDebuggerIsC
MockPlatform platform(*executionEnvironment); MockPlatform platform(*executionEnvironment);
platform.initializeWithNewDevices(); platform.initializeWithNewDevices();
EXPECT_NE(nullptr, executionEnvironment->debugger); EXPECT_NE(nullptr, executionEnvironment->rootDeviceEnvironments[0]->debugger);
} }
} }
@ -527,7 +527,7 @@ TEST(SourceLevelDebugger, givenKernelDebuggerLibraryNotActiveWhenDeviceIsCreated
EXPECT_FALSE(interceptor.newDeviceCalled); EXPECT_FALSE(interceptor.newDeviceCalled);
} }
TEST(SourceLevelDebugger, givenTwoRootDevicesWhenSecondIsCreatedThenNotCreatingNewSourceLevelDebugger) { TEST(SourceLevelDebugger, givenTwoRootDevicesWhenSecondIsCreatedThenCreatingNewSourceLevelDebugger) {
DebuggerLibraryRestorer restorer; DebuggerLibraryRestorer restorer;
if (platformDevices[0]->capabilityTable.debuggerSupported) { if (platformDevices[0]->capabilityTable.debuggerSupported) {
@ -548,11 +548,11 @@ TEST(SourceLevelDebugger, givenTwoRootDevicesWhenSecondIsCreatedThenNotCreatingN
interceptor.initCalled = false; interceptor.initCalled = false;
auto device2 = std::make_unique<MockClDevice>(Device::create<MockDevice>(executionEnvironment, 1u)); auto device2 = std::make_unique<MockClDevice>(Device::create<MockDevice>(executionEnvironment, 1u));
EXPECT_NE(nullptr, executionEnvironment->memoryManager); EXPECT_NE(nullptr, executionEnvironment->memoryManager);
EXPECT_FALSE(interceptor.initCalled); EXPECT_TRUE(interceptor.initCalled);
} }
} }
TEST(SourceLevelDebugger, givenMultipleRootDevicesWhenTheyAreCreatedTheyAllReuseTheSameSourceLevelDebugger) { TEST(SourceLevelDebugger, givenMultipleRootDevicesWhenTheyAreCreatedTheyUseDedicatedSourceLevelDebugger) {
DebuggerLibraryRestorer restorer; DebuggerLibraryRestorer restorer;
if (platformDevices[0]->capabilityTable.debuggerSupported) { if (platformDevices[0]->capabilityTable.debuggerSupported) {
@ -567,6 +567,6 @@ TEST(SourceLevelDebugger, givenMultipleRootDevicesWhenTheyAreCreatedTheyAllReuse
auto device1 = std::make_unique<MockClDevice>(Device::create<MockDevice>(executionEnvironment, 0u)); auto device1 = std::make_unique<MockClDevice>(Device::create<MockDevice>(executionEnvironment, 0u));
auto sourceLevelDebugger = device1->getDebugger(); auto sourceLevelDebugger = device1->getDebugger();
auto device2 = std::make_unique<MockClDevice>(Device::create<MockDevice>(executionEnvironment, 1u)); auto device2 = std::make_unique<MockClDevice>(Device::create<MockDevice>(executionEnvironment, 1u));
EXPECT_EQ(sourceLevelDebugger, device2->getDebugger()); EXPECT_NE(sourceLevelDebugger, device2->getDebugger());
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -10,6 +10,7 @@
#include "shared/source/built_ins/built_ins.h" #include "shared/source/built_ins/built_ins.h"
#include "shared/source/compiler_interface/compiler_interface.h" #include "shared/source/compiler_interface/compiler_interface.h"
#include "shared/source/compiler_interface/default_cache_config.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/execution_environment/execution_environment.h"
#include "shared/source/gmm_helper/gmm_helper.h" #include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/gmm_helper/page_table_mngr.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)); aubCenter.reset(new AubCenter(getHardwareInfo(), localMemoryEnabled, aubFileName, csrType));
} }
} }
void RootDeviceEnvironment::initDebugger() {
debugger = Debugger::create(hwInfo.get());
}
const HardwareInfo *RootDeviceEnvironment::getHardwareInfo() const { const HardwareInfo *RootDeviceEnvironment::getHardwareInfo() const {
return hwInfo.get(); return hwInfo.get();
} }

View File

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