SWDEV-482130 - Fix release of virtual mem obj

Change-Id: I893a8353aa1a25d00e36c8e601caf31cc0fc1f22
Tá an tiomantas seo le fáil i:
Branislav Brzak
2024-09-12 14:40:31 +02:00
tiomanta ag Anusha Godavarthy Surya
tuismitheoir 522ae8ead4
tiomantas 43fcac1739
D'athraigh 3 comhad le 24 breiseanna agus 9 scriosta
+7 -1
Féach ar an gComhad
@@ -95,8 +95,14 @@ bool Heap::RemoveMemory(amd::Memory* memory, MemoryTimestamp* ts) {
Heap::SortedMap::iterator Heap::EraseAllocaton(Heap::SortedMap::iterator& it) {
auto memory = it->first.second;
const device::Memory* dev_mem = memory->getDeviceMemory(*device_->devices()[0]);
void* dev_mem_vaddr = reinterpret_cast<void*>(dev_mem->virtualAddress());
total_size_ -= it->first.first;
amd::SvmBuffer::free(memory->getContext(), reinterpret_cast<void*>(dev_mem->virtualAddress()));
if (dev_mem_vaddr != nullptr) {
amd::SvmBuffer::free(memory->getContext(), dev_mem_vaddr);
} else {
amd::SvmBuffer::free(memory->getContext(), memory->getSvmPtr());
}
// Clear HIP event
it->second.SetEvent(nullptr);
// Remove the allocation from the map