2018-09-17 21:42:15 +08:00
|
|
|
/*
|
2023-11-30 16:32:25 +08:00
|
|
|
* Copyright (C) 2018-2023 Intel Corporation
|
2018-09-17 21:42:15 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2021-12-23 21:48:36 +08:00
|
|
|
#include "opencl/test/unit_test/helpers/cl_execution_environment_helper.h"
|
2018-09-17 21:42:15 +08:00
|
|
|
|
2021-12-23 21:48:36 +08:00
|
|
|
#include "shared/source/execution_environment/execution_environment.h"
|
2020-03-04 15:51:02 +08:00
|
|
|
#include "shared/source/execution_environment/root_device_environment.h"
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/os_interface/device_factory.h"
|
2021-01-21 20:10:13 +08:00
|
|
|
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
2020-02-24 17:22:30 +08:00
|
|
|
|
2020-03-17 21:25:44 +08:00
|
|
|
#include "opencl/test/unit_test/mocks/mock_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
|
|
|
|
2021-12-23 21:48:36 +08:00
|
|
|
ExecutionEnvironment *getClExecutionEnvironmentImpl(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;
|
2023-11-30 16:32:25 +08:00
|
|
|
debugManager.flags.CreateMultipleRootDevices.set(rootDeviceEnvironments);
|
2018-09-17 21:42:15 +08:00
|
|
|
hwInfo = nullptr;
|
2020-03-23 16:13:25 +08:00
|
|
|
DeviceFactory::prepareDeviceEnvironments(*executionEnvironment);
|
2020-03-04 15:51:02 +08:00
|
|
|
hwInfo = executionEnvironment->rootDeviceEnvironments[0]->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
|