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: f167136918]
This commit is contained in:
Vladislav Sytchenko
2021-08-07 19:15:22 -04:00
committed by Maneesh Gupta
parent a8e3c3f9c1
commit f34036e155
@@ -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;
}