2018-09-17 21:42:15 +08:00
|
|
|
/*
|
2020-02-03 23:18:21 +08:00
|
|
|
* Copyright (C) 2018-2020 Intel Corporation
|
2018-09-17 21:42:15 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-02-23 22:20:22 +08:00
|
|
|
#include "opencl/test/unit_test/helpers/execution_environment_helper.h"
|
2018-09-17 21:42:15 +08:00
|
|
|
|
2020-02-24 01:46:50 +08:00
|
|
|
#include "os_interface/device_factory.h"
|
|
|
|
#include "unit_tests/helpers/debug_manager_state_restore.h"
|
2020-02-23 05:50:57 +08:00
|
|
|
#include "opencl/source/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) {
|
2020-02-03 23:18:21 +08:00
|
|
|
ExecutionEnvironment *executionEnvironment = platform()->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
|