From b785dd4a4e1e662630f4d79e0f578513958a71fd Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Thu, 19 Sep 2019 12:09:32 +0100 Subject: COMPMID-2670: [CL/GC] Create a test case for dynamic tensor support Change-Id: I35d28786ee3843ac11c1211aea55328782a99382 Signed-off-by: Georgios Pinitas Reviewed-on: https://review.mlplatform.org/c/1958 Tested-by: Arm Jenkins Reviewed-by: Michele Di Giorgio Comments-Addressed: Arm Jenkins --- src/runtime/BlobLifetimeManager.cpp | 10 ++++++++-- src/runtime/CL/CLTensorAllocator.cpp | 13 ++----------- src/runtime/CL/functions/CLL2NormalizeLayer.cpp | 5 ++++- 3 files changed, 14 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/runtime/BlobLifetimeManager.cpp b/src/runtime/BlobLifetimeManager.cpp index 1323bb3f8c..7a4760a990 100644 --- a/src/runtime/BlobLifetimeManager.cpp +++ b/src/runtime/BlobLifetimeManager.cpp @@ -33,13 +33,18 @@ #include #include -using namespace arm_compute; - +namespace arm_compute +{ BlobLifetimeManager::BlobLifetimeManager() : _blobs() { } +const BlobLifetimeManager::info_type &BlobLifetimeManager::info() const +{ + return _blobs; +} + std::unique_ptr BlobLifetimeManager::create_pool(IAllocator *allocator) { ARM_COMPUTE_ERROR_ON(allocator == nullptr); @@ -92,3 +97,4 @@ void BlobLifetimeManager::update_blobs_and_mappings() ++blob_idx; } } +} // namespace arm_compute diff --git a/src/runtime/CL/CLTensorAllocator.cpp b/src/runtime/CL/CLTensorAllocator.cpp index 60e1ca8df6..2b5fbb8241 100644 --- a/src/runtime/CL/CLTensorAllocator.cpp +++ b/src/runtime/CL/CLTensorAllocator.cpp @@ -128,17 +128,8 @@ void CLTensorAllocator::allocate() // Allocate tensor backing memory if(_associated_memory_group == nullptr) { - if(_memory.region() != nullptr && _memory.cl_region()->cl_data().get() != nullptr) - { - // Memory is already allocated. Reuse it if big enough, otherwise fire an assertion - ARM_COMPUTE_ERROR_ON_MSG(info().total_size() > _memory.region()->size(), - "Reallocation of a bigger memory region is not allowed!"); - } - else - { - // Perform memory allocation - _memory.set_owned_region(allocate_region(CLScheduler::get().context(), info().total_size(), 0)); - } + // Perform memory allocation + _memory.set_owned_region(allocate_region(CLScheduler::get().context(), info().total_size(), 0)); } else { diff --git a/src/runtime/CL/functions/CLL2NormalizeLayer.cpp b/src/runtime/CL/functions/CLL2NormalizeLayer.cpp index e76e4f601e..7d1c8182e3 100644 --- a/src/runtime/CL/functions/CLL2NormalizeLayer.cpp +++ b/src/runtime/CL/functions/CLL2NormalizeLayer.cpp @@ -38,7 +38,7 @@ namespace { constexpr int max_input_tensor_dim = 3; } // namespace - + CLL2NormalizeLayer::CLL2NormalizeLayer(std::shared_ptr memory_manager) : _memory_group(std::move(memory_manager)), _reduce_func(), _normalize_kernel(), _sumsq() { @@ -46,6 +46,9 @@ CLL2NormalizeLayer::CLL2NormalizeLayer(std::shared_ptr memory_ma void CLL2NormalizeLayer::configure(ICLTensor *input, ICLTensor *output, int axis, float epsilon) { + // Reset auxiliary tensor + _sumsq.allocator()->init(TensorInfo()); + // Manage intermediate buffers _memory_group.manage(&_sumsq); -- cgit v1.2.1