Skip to content

Commit fcada73

Browse files
AMD-ShaneXiaosatyanveshd
authored andcommitted
SWDEV-492049 - Remove the handle of Phy Mem from Memobj for VMM
The physical handle is not needed since the Phy mem obj will be saved in virtual mem obj during mapping. And if the phy mem handle will tracked by Memobj, then the whole address ranged from handle to handle + size will be tracked. This fixed the potential issue that the clr find the wrong Memobj if we do not remove the phy mem handle from Memobj. Change-Id: Ia442adb8e5b1cbed2d15e8fe9221ae8a0db82d8c
1 parent cd065d1 commit fcada73

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

hipamd/src/hip_vm.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ hipError_t hipMemCreate(hipMemGenericAllocationHandle_t* handle, size_t size,
131131
phys_mem_obj->getUserData().data = new hip::GenericAllocation(*phys_mem_obj, size, *prop);
132132
*handle = reinterpret_cast<hipMemGenericAllocationHandle_t>(phys_mem_obj->getUserData().data);
133133

134+
// Remove because the entry is not needed in MemObjMap.
135+
// We save the copy of Phy mem obj in virtual mem obj during mapping.
136+
amd::MemObjMap::RemoveMemObj(ptr);
137+
134138
HIP_RETURN(hipSuccess);
135139
}
136140

0 commit comments

Comments
 (0)