mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
Clean up context vector of devices
Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
325db6a99c
commit
1670081df7
@@ -59,20 +59,22 @@ ze_result_t DriverHandleImp::createContext(const ze_context_desc_t *desc,
|
||||
|
||||
if (numDevices == 0) {
|
||||
for (auto device : this->devices) {
|
||||
context->addDeviceAndSubDevices(device);
|
||||
auto neoDevice = device->getNEODevice();
|
||||
context->getDevices().insert(std::make_pair(neoDevice->getRootDeviceIndex(), device->toHandle()));
|
||||
context->rootDeviceIndices.push_back(neoDevice->getRootDeviceIndex());
|
||||
context->deviceBitfields.insert({neoDevice->getRootDeviceIndex(),
|
||||
neoDevice->getDeviceBitfield()});
|
||||
}
|
||||
} else {
|
||||
for (uint32_t i = 0; i < numDevices; i++) {
|
||||
context->addDeviceAndSubDevices(Device::fromHandle(phDevices[i]));
|
||||
auto neoDevice = Device::fromHandle(phDevices[i])->getNEODevice();
|
||||
context->getDevices().insert(std::make_pair(neoDevice->getRootDeviceIndex(), phDevices[i]));
|
||||
context->rootDeviceIndices.push_back(neoDevice->getRootDeviceIndex());
|
||||
context->deviceBitfields.insert({neoDevice->getRootDeviceIndex(),
|
||||
neoDevice->getDeviceBitfield()});
|
||||
}
|
||||
}
|
||||
|
||||
for (auto devicePair : context->getDevices()) {
|
||||
auto neoDevice = devicePair.second->getNEODevice();
|
||||
context->rootDeviceIndices.push_back(neoDevice->getRootDeviceIndex());
|
||||
context->deviceBitfields.insert({neoDevice->getRootDeviceIndex(),
|
||||
neoDevice->getDeviceBitfield()});
|
||||
}
|
||||
context->rootDeviceIndices.remove_duplicates();
|
||||
|
||||
return ZE_RESULT_SUCCESS;
|
||||
|
||||
Reference in New Issue
Block a user