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"
|
|
|
|
|
|
|
|
namespace OCLRT {
|
|
|
|
|
|
|
|
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;
|
2018-10-04 18:44:49 +08:00
|
|
|
std::string hwInfoConfig;
|
|
|
|
DebugManager.getHardwareInfoOverride(hwInfoConfig);
|
2019-03-19 22:09:33 +08:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
*pHWInfos = hardwareInfo.release();
|
2019-01-23 18:59:54 +08:00
|
|
|
executionEnvironment.setHwInfo(*pHWInfos);
|
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
|
|
|
DeviceFactory::hwInfo = *pHWInfos;
|
|
|
|
|
2018-09-18 22:31:47 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace OCLRT
|