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