SWDEV-485904 - propagate hsa_amd_vmem_address_free error to hip API

Unit_hipMemSetAccess_GrowVMM test fails with
HSA_STATUS_ERROR_RESOURCE_FREE silently

Change-Id: I7a78410e432de4a2e877062782abf8761645f392
This commit is contained in:
Anusha GodavarthySurya
2024-09-20 12:08:42 +00:00
committed by Anusha Godavarthy Surya
parent 1f55a707b4
commit b498103f9b
6 changed files with 21 additions and 13 deletions
+6 -2
View File
@@ -2470,18 +2470,22 @@ void* Device::virtualAlloc(void* req_addr, size_t size, size_t alignment) {
return mem->getSvmPtr();
}
void Device::virtualFree(void* addr) {
bool Device::virtualFree(void* addr) {
amd::Memory* memObj = amd::MemObjMap::FindVirtualMemObj(addr);
if (memObj == nullptr) {
LogPrintfError("Cannot find the Virtual MemObj entry for this addr 0x%x", addr);
}
memObj->getContext().devices()[0]->DestroyVirtualBuffer(memObj);
if (!memObj->getContext().devices()[0]->DestroyVirtualBuffer(memObj)) {
return false;
}
hsa_status_t hsa_status = hsa_amd_vmem_address_free(memObj->getSvmPtr(), memObj->getSize());
if (hsa_status != HSA_STATUS_SUCCESS) {
LogPrintfError("Failed hsa_amd_vmem_address_free. Failed with status:%d \n", hsa_status);
return false;
}
return true;
}
bool Device::SetMemAccess(void* va_addr, size_t va_size, VmmAccess access_flags) {