Files
compute-runtime/runtime/os_interface/device_factory.cpp
Milczarek, Slawomir e42d62c64d AUB capture in standalone mode to apply hw custom configuration
Resolves: NEO-3091

Change-Id: Ia1a17947c2911c4dff693d474e8af642f2b65003
Signed-off-by: Milczarek, Slawomir <slawomir.milczarek@intel.com>
2019-04-11 20:27:13 +02:00

50 lines
2.0 KiB
C++

/*
* Copyright (C) 2017-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "runtime/device/device.h"
#include "runtime/helpers/options.h"
#include "runtime/os_interface/debug_settings_manager.h"
#include "runtime/os_interface/hw_info_config.h"
namespace NEO {
bool DeviceFactory::getDevicesForProductFamilyOverride(HardwareInfo **pHWInfos, size_t &numDevices, ExecutionEnvironment &executionEnvironment) {
auto totalDeviceCount = 1u;
if (DebugManager.flags.CreateMultipleDevices.get()) {
totalDeviceCount = DebugManager.flags.CreateMultipleDevices.get();
}
auto productFamily = DebugManager.flags.ProductFamilyOverride.get();
auto hwInfoConst = *platformDevices;
getHwInfoForPlatformString(productFamily.c_str(), hwInfoConst);
numDevices = 0;
std::string hwInfoConfig;
DebugManager.getHardwareInfoOverride(hwInfoConfig);
auto hardwareInfo = std::make_unique<HardwareInfo>();
hardwareInfo->pPlatform = new PLATFORM(*hwInfoConst->pPlatform);
hardwareInfo->pSkuTable = new FeatureTable(*hwInfoConst->pSkuTable);
hardwareInfo->pWaTable = new WorkaroundTable(*hwInfoConst->pWaTable);
hardwareInfo->pSysInfo = new GT_SYSTEM_INFO(*hwInfoConst->pSysInfo);
hardwareInfo->capabilityTable = hwInfoConst->capabilityTable;
hardwareInfoSetup[hwInfoConst->pPlatform->eProductFamily](const_cast<GT_SYSTEM_INFO *>(hardwareInfo->pSysInfo),
const_cast<FeatureTable *>(hardwareInfo->pSkuTable),
true, hwInfoConfig);
HwInfoConfig *hwConfig = HwInfoConfig::get(hardwareInfo->pPlatform->eProductFamily);
hwConfig->configureHardwareCustom(hardwareInfo.get(), nullptr);
*pHWInfos = hardwareInfo.release();
executionEnvironment.setHwInfo(*pHWInfos);
numDevices = totalDeviceCount;
DeviceFactory::numDevices = numDevices;
DeviceFactory::hwInfo = *pHWInfos;
return true;
}
} // namespace NEO