feature: Propagate error from makeResident to caller

Have makeResident return error to the caller, instead of always
SUCCESS. This will allow interfaces like zeContextMakeMemoryResident
to fail properly.

Additionally, change the parsing of MemoryOperationsStatus from
ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY to
ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY, since when making resources
resident, it is the device running out of memory, instead of the
host.

Related-To: LOCI-4443

Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
This commit is contained in:
Jaime Arteaga
2023-05-23 04:23:38 +00:00
committed by Compute-Runtime-Automation
parent ded9d7bff2
commit 37ed03a15c
4 changed files with 11 additions and 6 deletions

View File

@@ -28,11 +28,15 @@ DrmMemoryOperationsHandlerBind::~DrmMemoryOperationsHandlerBind() = default;
MemoryOperationsStatus DrmMemoryOperationsHandlerBind::makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations) {
auto &engines = device->getAllEngines();
MemoryOperationsStatus result = MemoryOperationsStatus::SUCCESS;
for (const auto &engine : engines) {
engine.commandStreamReceiver->initializeResources();
this->makeResidentWithinOsContext(engine.osContext, gfxAllocations, false);
result = this->makeResidentWithinOsContext(engine.osContext, gfxAllocations, false);
if (result != MemoryOperationsStatus::SUCCESS) {
break;
}
}
return MemoryOperationsStatus::SUCCESS;
return result;
}
MemoryOperationsStatus DrmMemoryOperationsHandlerBind::makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable) {