Device now adds dependencies on ExecutionEnvironment

- This allows for ExecutionEnvironment to live longer then platform after
its global destruction
- Device adds references to ExecutionEnvironment after creation
- When device is destroyed it removes the dependency causing the cleanup
- Platform upon destruction no longer destroys the device, but decrements
the internal ref count.

Change-Id: I22593ea44b2b50e3416575a9e97e3ce0a1f8b5c0
This commit is contained in:
Mrozek, Michal
2018-06-27 11:35:37 +02:00
committed by sys_ocldev
parent bc7aa63a37
commit a95cca71e4
6 changed files with 50 additions and 4 deletions

View File

@@ -30,6 +30,7 @@
#include "runtime/device/device.h"
#include "runtime/device/device_vector.h"
#include "runtime/device/driver_info.h"
#include "runtime/execution_environment/execution_environment.h"
#include "runtime/helpers/built_ins_helper.h"
#include "runtime/helpers/debug_helpers.h"
#include "runtime/helpers/options.h"
@@ -126,6 +127,9 @@ Device::~Device() {
tagAllocation = nullptr;
delete memoryManager;
memoryManager = nullptr;
if (executionEnvironment) {
executionEnvironment->decRefInternal();
}
}
bool Device::createDeviceImpl(const HardwareInfo *pHwInfo,
@@ -293,4 +297,8 @@ GFXCORE_FAMILY Device::getRenderCoreFamily() const {
bool Device::isSourceLevelDebuggerActive() const {
return deviceInfo.sourceLevelDebuggerActive;
}
void Device::connectToExecutionEnvironment(ExecutionEnvironment *executionEnvironment) {
executionEnvironment->incRefInternal();
this->executionEnvironment = executionEnvironment;
}
} // namespace OCLRT