From cf3f4416250a3b8f75c76a88fa2a7c3f0c163e62 Mon Sep 17 00:00:00 2001 From: Sean Keely Date: Wed, 23 Mar 2022 23:31:04 -0500 Subject: [PATCH] Release host buffers after segment freeze. Release staging buffers after loading has completed. The debugger no longer uses this copy. Change-Id: I46f36b50033bebe5a9ebc648b291d46f1d09b21d [ROCm/ROCR-Runtime commit: 03a52655a83af14f0b80023df711a33cec420a0b] --- .../runtime/hsa-runtime/core/runtime/amd_loader_context.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_loader_context.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_loader_context.cpp index 72c71fa5fc..ad3d7ad831 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_loader_context.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/amd_loader_context.cpp @@ -358,6 +358,10 @@ bool RegionMemory::Freeze() { memcpy(ptr_, host_ptr_, size_); } + // Free host buffer + HSA::hsa_memory_free(host_ptr_); + host_ptr_ = nullptr; + // Invalidate agent caches which may hold lines of the new allocation. if (is_code_ && (region_->owner()->device_type() == core::Agent::kAmdGpuDevice)) ((AMD::GpuAgent*)region_->owner())->InvalidateCodeCaches();