Move setting external memory managers to mock layers.

Change-Id: I335fd35269da9093c9e744c2735215e8d561098c
This commit is contained in:
Mrozek, Michal
2018-07-20 09:01:58 +02:00
committed by sys_ocldev
parent 239ebf9eab
commit 366a12e3ce
7 changed files with 45 additions and 37 deletions

View File

@@ -132,7 +132,7 @@ bool Device::createDeviceImpl(const HardwareInfo *pHwInfo, Device &outDevice) {
return false;
}
executionEnvironment->initializeMemoryManager(outDevice.executionEnvironment->memoryManager.get(), outDevice.getEnabled64kbPages());
executionEnvironment->initializeMemoryManager(outDevice.getEnabled64kbPages());
CommandStreamReceiver *commandStreamReceiver = executionEnvironment->commandStreamReceiver.get();
if (!commandStreamReceiver->initializeTagAllocation()) {

View File

@@ -53,11 +53,7 @@ class Device : public BaseObject<_cl_device_id> {
static T *create(const HardwareInfo *pHwInfo, ExecutionEnvironment *execEnv) {
pHwInfo = getDeviceInitHwInfo(pHwInfo);
T *device = new T(*pHwInfo, execEnv);
if (false == createDeviceImpl(pHwInfo, *device)) {
delete device;
return nullptr;
}
return device;
return createDeviceInternals(pHwInfo, device);
}
Device &operator=(const Device &) = delete;
@@ -139,6 +135,15 @@ class Device : public BaseObject<_cl_device_id> {
Device() = delete;
Device(const HardwareInfo &hwInfo, ExecutionEnvironment *executionEnvironment);
template <typename T>
static T *createDeviceInternals(const HardwareInfo *pHwInfo, T *device) {
if (false == createDeviceImpl(pHwInfo, *device)) {
delete device;
return nullptr;
}
return device;
}
static bool createDeviceImpl(const HardwareInfo *pHwInfo, Device &outDevice);
static const HardwareInfo *getDeviceInitHwInfo(const HardwareInfo *pHwInfoIn);
MOCKABLE_VIRTUAL void initializeCaps();