Return vector of HwDeviceIds from OSInterface::discoverDevices

Resolves: NEO-4310
Related-To: NEO-4208
Change-Id: Ib4ce27a18a860214b76505f6e122666c86207783
Signed-off-by: Jablonski, Mateusz <mateusz.jablonski@intel.com>
This commit is contained in:
Jablonski, Mateusz
2020-02-17 16:14:22 +01:00
committed by sys_ocldev
parent 428b123bdd
commit 624b418756
10 changed files with 101 additions and 71 deletions

View File

@@ -89,24 +89,13 @@ bool DeviceFactory::isHwModeSelected() {
bool DeviceFactory::getDevices(size_t &totalNumRootDevices, ExecutionEnvironment &executionEnvironment) {
using HwDeviceIds = std::vector<std::unique_ptr<HwDeviceId>>;
HwDeviceIds hwDeviceIds;
size_t numRootDevices = 1u;
if (DebugManager.flags.CreateMultipleRootDevices.get()) {
numRootDevices = DebugManager.flags.CreateMultipleRootDevices.get();
}
for (size_t i = 0; i < numRootDevices; i++) {
auto hwDeviceId = OSInterface::discoverDevices();
if (hwDeviceId) {
hwDeviceIds.push_back(std::move(hwDeviceId));
}
}
if (hwDeviceIds.empty()) {
HwDeviceIds hwDeviceIds = OSInterface::discoverDevices();
totalNumRootDevices = hwDeviceIds.size();
if (totalNumRootDevices == 0) {
return false;
}
totalNumRootDevices = numRootDevices;
executionEnvironment.prepareRootDeviceEnvironments(static_cast<uint32_t>(numRootDevices));
executionEnvironment.prepareRootDeviceEnvironments(static_cast<uint32_t>(totalNumRootDevices));
uint32_t rootDeviceIndex = 0u;