Ensure that every device has execution environment.

Change-Id: I77a203fb5ffd2c6a9309091f5e048f71c58c4c04
This commit is contained in:
Mrozek, Michal
2018-07-10 17:14:20 +02:00
committed by sys_ocldev
parent 92266e4ad1
commit 4fb02f2e99
6 changed files with 23 additions and 26 deletions

View File

@@ -55,8 +55,7 @@ class Device : public BaseObject<_cl_device_id> {
template <typename T>
static T *create(const HardwareInfo *pHwInfo, ExecutionEnvironment *execEnv) {
pHwInfo = getDeviceInitHwInfo(pHwInfo);
T *device = new T(*pHwInfo);
device->connectToExecutionEnvironment(execEnv);
T *device = new T(*pHwInfo, execEnv);
if (false == createDeviceImpl(pHwInfo, *device)) {
delete device;
return nullptr;
@@ -138,11 +137,10 @@ class Device : public BaseObject<_cl_device_id> {
bool getEnabled64kbPages();
bool isSourceLevelDebuggerActive() const;
SourceLevelDebugger *getSourceLevelDebugger() { return sourceLevelDebugger.get(); }
void connectToExecutionEnvironment(ExecutionEnvironment *executionEnvironment);
protected:
Device() = delete;
Device(const HardwareInfo &hwInfo);
Device(const HardwareInfo &hwInfo, ExecutionEnvironment *executionEnvironment);
static bool createDeviceImpl(const HardwareInfo *pHwInfo, Device &outDevice);
static const HardwareInfo *getDeviceInitHwInfo(const HardwareInfo *pHwInfoIn);