[IE][VPU]: Check memory capacity after finding the corresponding device (#4314)

This issue relates to multi-device mode.
While we are trying to allocate a graph on one of the devices we should check memory capacity only for the corresponding device, not for the last opened as far devices may have different memory capacity or the latest opened device may have still not sent its attributes (including memory capacity)
This commit is contained in:
Maksim Doronin 2021-02-12 18:00:15 +03:00 committed by GitHub
parent 7454aa2d1a
commit fff10ea93a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1986,11 +1986,6 @@ ncStatus_t ncGraphAllocate(struct ncDeviceHandle_t * deviceHandle,
struct _graphPrivate_t *g = graphHandle->private_data;
struct _devicePrivate_t *d = devices;
if (graphBufferLength > d->dev_attr.max_memory) {
mvLog(MVLOG_ERROR, "The graph file is bigger than the device memory");
return NC_OUT_OF_MEMORY;
}
GLOBAL_LOCK();
while (d) {
if (d == deviceHandle->private_data)
@ -2006,6 +2001,11 @@ ncStatus_t ncGraphAllocate(struct ncDeviceHandle_t * deviceHandle,
}
GLOBAL_UNLOCK();
if (graphBufferLength > d->dev_attr.max_memory) {
mvLog(MVLOG_ERROR, "The graph file is bigger than the device memory");
return NC_OUT_OF_MEMORY;
}
lockAllInferences();
g->id = graphIdCount++;
streamId_t streamId;