SWDEV-512344 - Unmap all subbuffers

Since hipMemMap can be called for multiple device handles on the same virtual memory, the same is true for hipMemUnmap, meaning that virtual memory can be "partially unmapped".

This means that the unmap function can be called for a specific part of the reserved address, meaning that only the designated subbuffer should be released. If unmap is called on the entire reserved memory, then all subbuffers should be released.

The main point is that for every hsa_amd_vmem_map, there should be a corresponding hsa_amd_vmem_unmap. Otherwise, if entire memory is unmapped by a single unmap call, then HSA will report the memory as "in use" if an attempt is made to delete it.

Change-Id: I039308eafb820decfb1c09f60347f26cdad1a362


[ROCm/clr commit: 3ec1d2d2f1]
This commit is contained in:
Marko Arandjelovic
2025-01-29 15:27:39 +00:00
zatwierdzone przez Marko Arandjelovic
rodzic 4e4c2038eb
commit 861491b824
2 zmienionych plików z 22 dodań i 20 usunięć
-6
Wyświetl plik
@@ -366,12 +366,6 @@ hipError_t hipMemUnmap(void* ptr, size_t size) {
cmd->enqueue();
cmd->awaitCompletion();
cmd->release();
vaddr_sub_obj->release();
// restore the original pa of the generic allocation
hip::GenericAllocation* ga
= reinterpret_cast<hip::GenericAllocation*>(phys_mem_obj->getUserData().data);
ga->release();
HIP_RETURN(hipSuccess);
}