From a6d480e098f0f35741e169264d027be7acc84690 Mon Sep 17 00:00:00 2001 From: German Andryeyev Date: Thu, 14 Dec 2023 16:57:42 -0500 Subject: [PATCH] SWDEV-436869 - Destroy host memory Recent changes disabled system memory allocation in the abstraciton layer. That requires memory allocation/destruction in ROCR. Add destruction logic. Change-Id: I68fe6b0a620ca743fe5850052ea0efa8bb7931c2 --- rocclr/device/rocm/rocmemory.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rocclr/device/rocm/rocmemory.cpp b/rocclr/device/rocm/rocmemory.cpp index bb926e38e7..2ef82fec0c 100644 --- a/rocclr/device/rocm/rocmemory.cpp +++ b/rocclr/device/rocm/rocmemory.cpp @@ -702,6 +702,9 @@ void Buffer::destroy() { if (dev().settings().apuSystem_) { const_cast(dev()).updateFreeMemory(size(), true); } + } else if ((memFlags & CL_MEM_ALLOC_HOST_PTR) && + (owner()->getContext().devices().size() == 1)) { + dev().hostFree(deviceMemory_, size()); } } }