2018-09-18 22:31:47 +08:00
|
|
|
/*
|
2019-01-23 18:59:54 +08:00
|
|
|
* Copyright (C) 2017-2019 Intel Corporation
|
2018-09-18 22:31:47 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2018-09-18 22:31:47 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "runtime/device/device.h"
|
|
|
|
#include "runtime/helpers/options.h"
|
|
|
|
#include "runtime/os_interface/debug_settings_manager.h"
|
2019-04-09 19:37:17 +08:00
|
|
|
#include "runtime/os_interface/hw_info_config.h"
|
2018-09-18 22:31:47 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2018-09-18 22:31:47 +08:00
|
|
|
|
2019-05-06 18:33:44 +08:00
|
|
|
bool DeviceFactory::getDevicesForProductFamilyOverride(size_t &numDevices, ExecutionEnvironment &executionEnvironment) {
|
2018-09-18 22:31:47 +08:00
|
|
|
auto totalDeviceCount = 1u;
|
|
|
|
if (DebugManager.flags.CreateMultipleDevices.get()) {
|
|
|
|
totalDeviceCount = DebugManager.flags.CreateMultipleDevices.get();
|
|
|
|
}
|
|
|
|
auto productFamily = DebugManager.flags.ProductFamilyOverride.get();
|
|
|
|
auto hwInfoConst = *platformDevices;
|
2019-07-18 17:58:30 +08:00
|
|
|
getHwInfoForPlatformString(productFamily, hwInfoConst);
|
2018-09-18 22:31:47 +08:00
|
|
|
numDevices = 0;
|
2018-10-04 18:44:49 +08:00
|
|
|
std::string hwInfoConfig;
|
|
|
|
DebugManager.getHardwareInfoOverride(hwInfoConfig);
|
2019-03-19 22:09:33 +08:00
|
|
|
|
2019-05-06 18:33:44 +08:00
|
|
|
auto hardwareInfo = executionEnvironment.getMutableHardwareInfo();
|
|
|
|
*hardwareInfo = *hwInfoConst;
|
2019-03-19 22:09:33 +08:00
|
|
|
|
2019-05-08 22:00:24 +08:00
|
|
|
hardwareInfoSetup[hwInfoConst->platform.eProductFamily](hardwareInfo, true, hwInfoConfig);
|
2019-04-09 19:37:17 +08:00
|
|
|
|
2019-05-08 22:00:24 +08:00
|
|
|
HwInfoConfig *hwConfig = HwInfoConfig::get(hardwareInfo->platform.eProductFamily);
|
2019-05-06 18:33:44 +08:00
|
|
|
hwConfig->configureHardwareCustom(hardwareInfo, nullptr);
|
2019-03-28 22:34:26 +08:00
|
|
|
|
2019-03-19 22:09:33 +08:00
|
|
|
numDevices = totalDeviceCount;
|
2018-09-18 22:31:47 +08:00
|
|
|
DeviceFactory::numDevices = numDevices;
|
2019-03-19 22:09:33 +08:00
|
|
|
|
2018-09-18 22:31:47 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|