From a7fa9d736e46f4186b52f081c92ac64b6219de1a Mon Sep 17 00:00:00 2001 From: "Mrozek, Michal" Date: Tue, 23 Oct 2018 14:55:04 +0200 Subject: [PATCH] Delete freeGmm interface. Change-Id: I9a3ce6f6076d5accf69be2be50126a46f9bde23d --- runtime/memory_manager/memory_manager.cpp | 6 ------ runtime/memory_manager/memory_manager.h | 2 -- runtime/memory_manager/os_agnostic_memory_manager.cpp | 6 ++++-- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/runtime/memory_manager/memory_manager.cpp b/runtime/memory_manager/memory_manager.cpp index 029a768460..f86b3e5523 100644 --- a/runtime/memory_manager/memory_manager.cpp +++ b/runtime/memory_manager/memory_manager.cpp @@ -10,8 +10,6 @@ #include "runtime/event/event.h" #include "runtime/event/hw_timestamps.h" #include "runtime/event/perf_counter.h" -#include "runtime/gmm_helper/gmm.h" -#include "runtime/gmm_helper/resource_info.h" #include "runtime/helpers/aligned_memory.h" #include "runtime/helpers/basic_math.h" #include "runtime/helpers/kernel_commands.h" @@ -116,10 +114,6 @@ GraphicsAllocation *MemoryManager::allocateGraphicsMemoryForSVM(size_t size, boo return graphicsAllocation; } -void MemoryManager::freeGmm(GraphicsAllocation *gfxAllocation) { - delete gfxAllocation->gmm; -} - GraphicsAllocation *MemoryManager::allocateGraphicsMemory(size_t size, const void *ptr, bool forcePin) { std::lock_guard lock(mtx); auto requirements = HostPtrManager::getAllocationRequirements(ptr, size); diff --git a/runtime/memory_manager/memory_manager.h b/runtime/memory_manager/memory_manager.h index bc0a6a61fa..a73348de75 100644 --- a/runtime/memory_manager/memory_manager.h +++ b/runtime/memory_manager/memory_manager.h @@ -194,8 +194,6 @@ class MemoryManager { void checkGpuUsageAndDestroyGraphicsAllocations(GraphicsAllocation *gfxAllocation); - void freeGmm(GraphicsAllocation *gfxAllocation); - virtual uint64_t getSystemSharedMemory() = 0; virtual uint64_t getMaxApplicationAddress() = 0; diff --git a/runtime/memory_manager/os_agnostic_memory_manager.cpp b/runtime/memory_manager/os_agnostic_memory_manager.cpp index f7fd18cd1c..f888f95738 100644 --- a/runtime/memory_manager/os_agnostic_memory_manager.cpp +++ b/runtime/memory_manager/os_agnostic_memory_manager.cpp @@ -8,6 +8,7 @@ #include "runtime/memory_manager/os_agnostic_memory_manager.h" #include "runtime/gmm_helper/gmm.h" #include "runtime/gmm_helper/gmm_helper.h" +#include "runtime/gmm_helper/resource_info.h" #include "runtime/helpers/aligned_memory.h" #include "runtime/helpers/basic_math.h" #include "runtime/helpers/options.h" @@ -140,8 +141,9 @@ void OsAgnosticMemoryManager::removeAllocationFromHostPtrManager(GraphicsAllocat void OsAgnosticMemoryManager::freeGraphicsMemoryImpl(GraphicsAllocation *gfxAllocation) { if (gfxAllocation == nullptr) return; - if (gfxAllocation->gmm) - freeGmm(gfxAllocation); + + delete gfxAllocation->gmm; + if ((uintptr_t)gfxAllocation->getUnderlyingBuffer() == dummyAddress) { delete gfxAllocation; return;