From f34036e155e9dde35eae432d737e498504c81b17 Mon Sep 17 00:00:00 2001 From: Vladislav Sytchenko Date: Sat, 7 Aug 2021 19:15:22 -0400 Subject: [PATCH] SWDEV-297808 - Don't update free memory counter when creating views Current logic when creating a buffer view will end up going into the allocation block. Even though no memory will be allocated, since owner()->getSvmPtr() is already allocated, we'll still end up calling updateFreeMemory(). Checking if we're creating a view, will skip the SVM allocation logic and let us fall into the actual view creation logic. This won't end up updating the free memory counter. Change-Id: I1c260a9ef57895130b272ea1246e06e812b25b37 [ROCm/clr commit: f16713691819218c8346de8f40bef82718990bcf] --- projects/clr/rocclr/device/rocm/rocmemory.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/clr/rocclr/device/rocm/rocmemory.cpp b/projects/clr/rocclr/device/rocm/rocmemory.cpp index 2182111c86..62707c3c33 100644 --- a/projects/clr/rocclr/device/rocm/rocmemory.cpp +++ b/projects/clr/rocclr/device/rocm/rocmemory.cpp @@ -712,7 +712,8 @@ bool Buffer::create() { // Allocate backing storage in device local memory unless UHP or AHP are set cl_mem_flags memFlags = owner()->getMemFlags(); - if (owner()->getSvmPtr() != nullptr) { + if ((owner()->parent() == nullptr) && + (owner()->getSvmPtr() != nullptr)) { if (dev().forceFineGrain(owner()) || dev().isFineGrainedSystem(true)) { memFlags |= CL_MEM_SVM_FINE_GRAIN_BUFFER; }