Fail when handle cannot be obtain for an allocation

If a handle cannot be obtained, like PRIME_HANDLE_TO_FD, then
properly check for the error and propagate it upwards.

Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
This commit is contained in:
Jaime Arteaga
2022-11-10 02:57:51 +00:00
committed by Compute-Runtime-Automation
parent ddd5dd99ef
commit 4dfdbd612d
24 changed files with 1010 additions and 119 deletions

View File

@@ -567,13 +567,21 @@ NEO::GraphicsAllocation *DriverHandleImp::getPeerAllocation(Device *device,
UNRECOVERABLE_IF(numHandles == 0);
std::vector<NEO::osHandle> handles;
for (uint32_t i = 0; i < numHandles; i++) {
int handle = static_cast<int>(alloc->peekInternalHandle(this->getMemoryManager(), i));
handles.push_back(handle);
uint64_t handle = 0;
int ret = alloc->peekInternalHandle(this->getMemoryManager(), i, handle);
if (ret < 0) {
return nullptr;
}
handles.push_back(static_cast<NEO::osHandle>(handle));
}
auto neoDevice = device->getNEODevice()->getRootDevice();
peerPtr = this->importFdHandles(neoDevice, flags, handles, &alloc);
} else {
uint64_t handle = alloc->peekInternalHandle(this->getMemoryManager());
uint64_t handle = 0;
int ret = alloc->peekInternalHandle(this->getMemoryManager(), handle);
if (ret < 0) {
return nullptr;
}
peerPtr = this->importFdHandle(device->getNEODevice(), flags, handle, &alloc);
}