From be66e29e94e75fc2235616506ba4373489d8a0f3 Mon Sep 17 00:00:00 2001 From: Vladislav Sytchenko Date: Tue, 20 Oct 2020 12:10:14 -0400 Subject: [PATCH] [PAL] Change free mem tracking logic to use PAL size PAL may internally align up the allocation size to the page size reported by KMD. This will cause a mismatch in size between OCL and PAL. To avoid this, use PAL size when updating the free memory counter on both alloc and free. Change-Id: Ic6e8c861a52170476474fb70a769eef93be3261f --- rocclr/device/pal/palresource.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rocclr/device/pal/palresource.cpp b/rocclr/device/pal/palresource.cpp index 90266f923f..fdfd875d40 100644 --- a/rocclr/device/pal/palresource.cpp +++ b/rocclr/device/pal/palresource.cpp @@ -84,7 +84,7 @@ GpuMemoryReference* GpuMemoryReference::Create(const Device& dev, } if (!createInfo.flags.sdiExternal) { // Update free memory size counters - dev.updateAllocedMemory(createInfo.heaps[0], createInfo.size, false); + dev.updateAllocedMemory(memRef->gpuMem_->Desc().preferredHeap, memRef->gpuMem_->Desc().size, false); } return memRef; } @@ -111,7 +111,7 @@ GpuMemoryReference* GpuMemoryReference::Create(const Device& dev, } } // Update free memory size counters - dev.updateAllocedMemory(Pal::GpuHeap::GpuHeapGartCacheable, createInfo.size, false); + dev.updateAllocedMemory(memRef->gpuMem_->Desc().preferredHeap, memRef->gpuMem_->Desc().size, false); return memRef; } @@ -136,7 +136,7 @@ GpuMemoryReference* GpuMemoryReference::Create(const Device& dev, } } // Update free memory size counters - dev.updateAllocedMemory(Pal::GpuHeap::GpuHeapGartCacheable, createInfo.size, false); + dev.updateAllocedMemory(memRef->gpuMem_->Desc().preferredHeap, memRef->gpuMem_->Desc().size, false); return memRef; }