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-12-13 16:48:57 +01:00
|
|
|
#include "core/debug_settings/debug_settings_manager.h"
|
2019-11-15 09:59:48 +01:00
|
|
|
#include "core/execution_environment/root_device_environment.h"
|
2019-11-13 10:01:19 +01:00
|
|
|
#include "core/helpers/hw_helper.h"
|
2019-12-09 15:29:30 +01:00
|
|
|
#include "core/helpers/options.h"
|
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-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-11-15 09:59:48 +01:00
|
|
|
executionEnvironment.prepareRootDeviceEnvironments(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-10-18 10:15:09 +02:00
|
|
|
if (hwInfoConfig == "default") {
|
|
|
|
|
hwInfoConfig = *defaultHardwareInfoConfigTable[hwInfoConst->platform.eProductFamily];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!setHwInfoValuesFromConfigString(hwInfoConfig, *hardwareInfo)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
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-12-24 09:59:49 +01:00
|
|
|
executionEnvironment.calculateMaxOsContextCount();
|
2019-10-23 16:17:06 +02:00
|
|
|
numDevices = numRootDevices;
|
2018-09-18 16:31:47 +02:00
|
|
|
DeviceFactory::numDevices = numDevices;
|
2019-11-15 09:59:48 +01:00
|
|
|
auto csrType = DebugManager.flags.SetCommandStreamReceiver.get();
|
|
|
|
|
if (csrType > 0) {
|
2019-11-13 13:53:27 +01:00
|
|
|
auto &hwHelper = HwHelper::get(hardwareInfo->platform.eRenderCoreFamily);
|
|
|
|
|
auto localMemoryEnabled = hwHelper.getEnableLocalMemory(*hardwareInfo);
|
2019-11-15 09:59:48 +01:00
|
|
|
for (auto rootDeviceIndex = 0u; rootDeviceIndex < numRootDevices; rootDeviceIndex++) {
|
|
|
|
|
executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->initAubCenter(localMemoryEnabled, "", static_cast<CommandStreamReceiverType>(csrType));
|
2019-11-28 13:02:11 +01:00
|
|
|
auto aubCenter = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->aubCenter.get();
|
|
|
|
|
executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->memoryOperationsInterface = std::make_unique<AubMemoryOperationsHandler>(aubCenter->getAubManager());
|
2019-11-15 09:59:48 +01:00
|
|
|
}
|
2019-08-21 10:53:07 +02:00
|
|
|
}
|
2018-09-18 16:31:47 +02:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
} // namespace NEO
|