From c8283844d6606691abda9e64415760a7fb0ee461 Mon Sep 17 00:00:00 2001 From: Alejandro Saucedo Date: Sat, 6 Feb 2021 19:09:48 +0000 Subject: [PATCH 1/2] Added destructor for staging tensors --- src/OpTensorCreate.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/OpTensorCreate.cpp b/src/OpTensorCreate.cpp index eac588a6..cc3f698c 100644 --- a/src/OpTensorCreate.cpp +++ b/src/OpTensorCreate.cpp @@ -23,6 +23,16 @@ OpTensorCreate::OpTensorCreate( OpTensorCreate::~OpTensorCreate() { SPDLOG_DEBUG("Kompute OpTensorCreate destructor started"); + + SPDLOG_DEBUG("Kompute OpBase freeing staging tensors"); + for (std::shared_ptr tensor : this->mStagingTensors) { + if (tensor && tensor->isInit()) { + tensor->freeMemoryDestroyGPUResources(); + } else { + SPDLOG_ERROR("Kompute OpBase expected to free " + "tensor but has already been freed."); + } + } } void From 71f09339f7e1c465473a5fff1dc9fa1bd4d3f66a Mon Sep 17 00:00:00 2001 From: Alejandro Saucedo Date: Sun, 7 Feb 2021 08:42:03 +0000 Subject: [PATCH 2/2] Updated docs --- src/OpTensorCreate.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OpTensorCreate.cpp b/src/OpTensorCreate.cpp index cc3f698c..ac9485ba 100644 --- a/src/OpTensorCreate.cpp +++ b/src/OpTensorCreate.cpp @@ -24,12 +24,12 @@ OpTensorCreate::~OpTensorCreate() { SPDLOG_DEBUG("Kompute OpTensorCreate destructor started"); - SPDLOG_DEBUG("Kompute OpBase freeing staging tensors"); + SPDLOG_DEBUG("Kompute OpTensorCreate freeing staging tensors"); for (std::shared_ptr tensor : this->mStagingTensors) { if (tensor && tensor->isInit()) { tensor->freeMemoryDestroyGPUResources(); } else { - SPDLOG_ERROR("Kompute OpBase expected to free " + SPDLOG_ERROR("Kompute OpTensorCreate expected to free " "tensor but has already been freed."); } }