SWDEV-492049 - Remove the handle of Phy Mem from Memobj

The hipGraph will use VMM by default when allocating memory.
However, the handle of Phy mem has been added to Memobj by default.
Since the Memobj will track the whole address range from handle to
handle + size, this needs the system to reserve the whole address
range. If the system range have not reserved by the system, then it
will have the potential issue that clr finds the Memobj incorrectly.

This patch removes the handle from the Memobj to fix this potential
issue.

Change-Id: I2da38e6b2d11d0d48e1afe66c46899500c290624
This commit is contained in:
Shane Xiao
2024-10-17 15:54:23 +08:00
committed by yao xiao
parent 7863eb92dc
commit 231b2410a0
2 changed files with 6 additions and 0 deletions
+4
View File
@@ -2335,6 +2335,10 @@ class GraphMemAllocNode final : public GraphNode {
memory_ = getMemoryObject(dptr, offset);
// Retain memory object because command release will release it
memory_->retain();
// Remove because the entry is not needed in MemObjMap after the memory_ has been saved.
// The Phy mem obj will be saved in virtual memory object during VirtualMapCommand::submit.
amd::MemObjMap::RemoveMemObj(dptr);
size_ = aligned_size;
// Execute the original mapping command
VirtualMapCommand::submit(device);
+2
View File
@@ -216,6 +216,8 @@ void* MemoryPool::AllocateMemory(size_t size, Stream* stream, void* dptr) {
}
} else {
dev_ptr = memory->getSvmPtr();
if (!amd::MemObjMap::FindMemObj(dev_ptr))
amd::MemObjMap::AddMemObj(dev_ptr, memory);
}
// Place the allocated memory into the busy heap
ts.AddSafeStream(stream);