2018-09-18 16:31:47 +02:00
|
|
|
/*
|
2019-01-23 11:59:54 +01:00
|
|
|
* Copyright (C) 2017-2019 Intel Corporation
|
2018-09-18 16:31:47 +02:00
|
|
|
*
|
2018-09-18 09:11:08 +02:00
|
|
|
* SPDX-License-Identifier: MIT
|
2018-09-18 16:31:47 +02:00
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2019-08-21 10:53:07 +02:00
|
|
|
#include "core/os_interface/aub_memory_operations_handler.h"
|
|
|
|
|
#include "runtime/aub/aub_center.h"
|
2018-09-18 16:31:47 +02:00
|
|
|
#include "runtime/device/device.h"
|
2019-11-13 13:53:27 +01:00
|
|
|
#include "runtime/helpers/hw_helper.h"
|
2018-09-18 16:31:47 +02:00
|
|
|
#include "runtime/helpers/options.h"
|
|
|
|
|
#include "runtime/os_interface/debug_settings_manager.h"
|
2019-04-09 13:37:17 +02:00
|
|
|
#include "runtime/os_interface/hw_info_config.h"
|
2018-09-18 16:31:47 +02:00
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
namespace NEO {
|
2018-09-18 16:31:47 +02:00
|
|
|
|
2019-05-06 12:33:44 +02:00
|
|
|
bool DeviceFactory::getDevicesForProductFamilyOverride(size_t &numDevices, ExecutionEnvironment &executionEnvironment) {
|
2019-10-23 16:17:06 +02:00
|
|
|
auto numRootDevices = 1u;
|
2019-10-17 16:00:12 +02:00
|
|
|
if (DebugManager.flags.CreateMultipleRootDevices.get()) {
|
2019-10-23 16:17:06 +02:00
|
|
|
numRootDevices = DebugManager.flags.CreateMultipleRootDevices.get();
|
2018-09-18 16:31:47 +02:00
|
|
|
}
|
2019-10-23 16:17:06 +02:00
|
|
|
executionEnvironment.rootDeviceEnvironments.resize(numRootDevices);
|
2019-10-22 11:44:06 +02:00
|
|
|
|
2018-09-18 16:31:47 +02:00
|
|
|
auto productFamily = DebugManager.flags.ProductFamilyOverride.get();
|
|
|
|
|
auto hwInfoConst = *platformDevices;
|
2019-07-18 11:58:30 +02:00
|
|
|
getHwInfoForPlatformString(productFamily, hwInfoConst);
|
2018-09-18 16:31:47 +02:00
|
|
|
numDevices = 0;
|
2018-10-04 12:44:49 +02:00
|
|
|
std::string hwInfoConfig;
|
|
|
|
|
DebugManager.getHardwareInfoOverride(hwInfoConfig);
|
2019-03-19 15:09:33 +01:00
|
|
|
|
2019-05-06 12:33:44 +02:00
|
|
|
auto hardwareInfo = executionEnvironment.getMutableHardwareInfo();
|
|
|
|
|
*hardwareInfo = *hwInfoConst;
|
2019-03-19 15:09:33 +01:00
|
|
|
|
2019-05-08 16:00:24 +02:00
|
|
|
hardwareInfoSetup[hwInfoConst->platform.eProductFamily](hardwareInfo, true, hwInfoConfig);
|
2019-04-09 13:37:17 +02:00
|
|
|
|
2019-05-08 16:00:24 +02:00
|
|
|
HwInfoConfig *hwConfig = HwInfoConfig::get(hardwareInfo->platform.eProductFamily);
|
2019-05-06 12:33:44 +02:00
|
|
|
hwConfig->configureHardwareCustom(hardwareInfo, nullptr);
|
2019-03-28 15:34:26 +01:00
|
|
|
|
2019-10-23 16:17:06 +02:00
|
|
|
numDevices = numRootDevices;
|
2018-09-18 16:31:47 +02:00
|
|
|
DeviceFactory::numDevices = numDevices;
|
2019-08-21 10:53:07 +02:00
|
|
|
auto csr = DebugManager.flags.SetCommandStreamReceiver.get();
|
|
|
|
|
if (csr > 0) {
|
2019-11-13 13:53:27 +01:00
|
|
|
auto &hwHelper = HwHelper::get(hardwareInfo->platform.eRenderCoreFamily);
|
|
|
|
|
auto localMemoryEnabled = hwHelper.getEnableLocalMemory(*hardwareInfo);
|
|
|
|
|
executionEnvironment.initAubCenter(localMemoryEnabled, "", static_cast<CommandStreamReceiverType>(csr));
|
2019-10-24 13:34:25 +02:00
|
|
|
auto aubCenter = executionEnvironment.rootDeviceEnvironments[0].aubCenter.get();
|
2019-08-21 10:53:07 +02:00
|
|
|
executionEnvironment.memoryOperationsInterface = std::make_unique<AubMemoryOperationsHandler>(aubCenter->getAubManager());
|
|
|
|
|
}
|
2018-09-18 16:31:47 +02:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
} // namespace NEO
|