2018-09-17 21:42:15 +08:00
|
|
|
/*
|
2019-02-27 18:39:32 +08:00
|
|
|
* Copyright (C) 2018-2019 Intel Corporation
|
2018-09-17 21:42:15 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "unit_tests/helpers/execution_environment_helper.h"
|
|
|
|
|
2019-11-28 20:02:11 +08:00
|
|
|
#include "core/unit_tests/helpers/debug_manager_state_restore.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
#include "runtime/os_interface/device_factory.h"
|
2019-01-23 18:59:54 +08:00
|
|
|
#include "runtime/platform/platform.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2018-09-17 21:42:15 +08:00
|
|
|
|
2019-11-07 01:14:30 +08:00
|
|
|
ExecutionEnvironment *getExecutionEnvironmentImpl(HardwareInfo *&hwInfo, uint32_t rootDeviceEnvironments) {
|
2019-01-23 18:59:54 +08:00
|
|
|
ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment();
|
2019-11-07 01:14:30 +08:00
|
|
|
executionEnvironment->prepareRootDeviceEnvironments(rootDeviceEnvironments);
|
2019-11-28 20:02:11 +08:00
|
|
|
DebugManagerStateRestore restorer;
|
|
|
|
DebugManager.flags.CreateMultipleRootDevices.set(rootDeviceEnvironments);
|
2018-09-17 21:42:15 +08:00
|
|
|
size_t numDevicesReturned = 0;
|
|
|
|
hwInfo = nullptr;
|
2019-05-06 18:33:44 +08:00
|
|
|
DeviceFactory::getDevices(numDevicesReturned, *executionEnvironment);
|
|
|
|
hwInfo = executionEnvironment->getMutableHardwareInfo();
|
2019-03-15 17:22:35 +08:00
|
|
|
executionEnvironment->initializeMemoryManager();
|
2019-03-08 19:18:02 +08:00
|
|
|
|
2018-09-17 21:42:15 +08:00
|
|
|
return executionEnvironment;
|
|
|
|
}
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|