From caa7deedfe1b0d0020c6099d8f616ec92b1bd5e9 Mon Sep 17 00:00:00 2001 From: Michalis Spyrou Date: Mon, 9 Sep 2019 19:23:39 +0100 Subject: COMPMID-2641 [NEON] Create a test case for dynamic tensor support Change-Id: I181e9acffd34ff1c807c65a822cfafb7327b8c8a Signed-off-by: Michalis Spyrou Reviewed-on: https://review.mlplatform.org/c/1913 Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins --- src/runtime/CL/CLTensorAllocator.cpp | 2 +- src/runtime/GLES_COMPUTE/GCTensorAllocator.cpp | 4 ++-- src/runtime/ISimpleLifetimeManager.cpp | 4 ++-- src/runtime/OffsetLifetimeManager.cpp | 5 +++++ src/runtime/OffsetMemoryPool.cpp | 12 +++++++++--- src/runtime/TensorAllocator.cpp | 2 +- 6 files changed, 20 insertions(+), 9 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/CL/CLTensorAllocator.cpp b/src/runtime/CL/CLTensorAllocator.cpp index 51caf69297..72b5854c5c 100644 --- a/src/runtime/CL/CLTensorAllocator.cpp +++ b/src/runtime/CL/CLTensorAllocator.cpp @@ -181,7 +181,7 @@ Status CLTensorAllocator::import_memory(cl::Buffer buffer) void CLTensorAllocator::set_associated_memory_group(CLMemoryGroup *associated_memory_group) { ARM_COMPUTE_ERROR_ON(associated_memory_group == nullptr); - ARM_COMPUTE_ERROR_ON(_associated_memory_group != nullptr); + ARM_COMPUTE_ERROR_ON(_associated_memory_group != nullptr && _associated_memory_group != associated_memory_group); ARM_COMPUTE_ERROR_ON(_memory.region() != nullptr && _memory.cl_region()->cl_data().get() != nullptr); _associated_memory_group = associated_memory_group; diff --git a/src/runtime/GLES_COMPUTE/GCTensorAllocator.cpp b/src/runtime/GLES_COMPUTE/GCTensorAllocator.cpp index a0dd540a7c..9a5d139517 100644 --- a/src/runtime/GLES_COMPUTE/GCTensorAllocator.cpp +++ b/src/runtime/GLES_COMPUTE/GCTensorAllocator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -65,7 +65,7 @@ void GCTensorAllocator::free() void GCTensorAllocator::set_associated_memory_group(GCMemoryGroup *associated_memory_group) { ARM_COMPUTE_ERROR_ON(associated_memory_group == nullptr); - ARM_COMPUTE_ERROR_ON(_associated_memory_group != nullptr); + ARM_COMPUTE_ERROR_ON(_associated_memory_group != nullptr && _associated_memory_group != associated_memory_group); ARM_COMPUTE_ERROR_ON(_memory.region() != nullptr && _memory.gc_region()->gc_ssbo_name() != 0); _associated_memory_group = associated_memory_group; diff --git a/src/runtime/ISimpleLifetimeManager.cpp b/src/runtime/ISimpleLifetimeManager.cpp index 97c20d1882..39a4096799 100644 --- a/src/runtime/ISimpleLifetimeManager.cpp +++ b/src/runtime/ISimpleLifetimeManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -100,7 +100,7 @@ void ISimpleLifetimeManager::end_lifetime(void *obj, IMemory &obj_memory, size_t occupied_blob_it->id = nullptr; _free_blobs.splice(std::begin(_free_blobs), _occupied_blobs, occupied_blob_it); - // Check if all object are finalized and reset active group + // Check if all objects are finalized and reset active group if(are_all_finalized()) { ARM_COMPUTE_ERROR_ON(!_occupied_blobs.empty()); diff --git a/src/runtime/OffsetLifetimeManager.cpp b/src/runtime/OffsetLifetimeManager.cpp index ad23220c0e..e9aa1ff447 100644 --- a/src/runtime/OffsetLifetimeManager.cpp +++ b/src/runtime/OffsetLifetimeManager.cpp @@ -49,6 +49,11 @@ OffsetLifetimeManager::OffsetLifetimeManager() { } +const OffsetLifetimeManager::info_type &OffsetLifetimeManager::info() const +{ + return _blob; +} + std::unique_ptr OffsetLifetimeManager::create_pool(IAllocator *allocator) { ARM_COMPUTE_ERROR_ON(allocator == nullptr); diff --git a/src/runtime/OffsetMemoryPool.cpp b/src/runtime/OffsetMemoryPool.cpp index 70cbe90bf0..a335f6087a 100644 --- a/src/runtime/OffsetMemoryPool.cpp +++ b/src/runtime/OffsetMemoryPool.cpp @@ -32,8 +32,8 @@ #include "arm_compute/runtime/Types.h" #include "support/ToolchainSupport.h" -using namespace arm_compute; - +namespace arm_compute +{ OffsetMemoryPool::OffsetMemoryPool(IAllocator *allocator, BlobInfo blob_info) : _allocator(allocator), _blob(), _blob_info(blob_info) { @@ -41,6 +41,11 @@ OffsetMemoryPool::OffsetMemoryPool(IAllocator *allocator, BlobInfo blob_info) _blob = _allocator->make_region(blob_info.size, blob_info.alignment); } +const BlobInfo &OffsetMemoryPool::info() const +{ + return _blob_info; +} + void OffsetMemoryPool::acquire(MemoryMappings &handles) { ARM_COMPUTE_ERROR_ON(_blob == nullptr); @@ -71,4 +76,5 @@ std::unique_ptr OffsetMemoryPool::duplicate() { ARM_COMPUTE_ERROR_ON(!_allocator); return support::cpp14::make_unique(_allocator, _blob_info); -} \ No newline at end of file +} +} // namespace arm_compute \ No newline at end of file diff --git a/src/runtime/TensorAllocator.cpp b/src/runtime/TensorAllocator.cpp index d9616ca09d..dfe239c586 100644 --- a/src/runtime/TensorAllocator.cpp +++ b/src/runtime/TensorAllocator.cpp @@ -164,7 +164,7 @@ Status TensorAllocator::import_memory(void *memory) void TensorAllocator::set_associated_memory_group(MemoryGroup *associated_memory_group) { ARM_COMPUTE_ERROR_ON(associated_memory_group == nullptr); - ARM_COMPUTE_ERROR_ON(_associated_memory_group != nullptr); + ARM_COMPUTE_ERROR_ON(_associated_memory_group != nullptr && _associated_memory_group != associated_memory_group); ARM_COMPUTE_ERROR_ON(_memory.region() != nullptr && _memory.region()->buffer() != nullptr); _associated_memory_group = associated_memory_group; -- cgit v1.2.1