aboutsummaryrefslogtreecommitdiff
path: root/src/backends/aclCommon/memory/BaseMemoryManager.cpp
diff options
context:
space:
mode:
authorAron Virginas-Tar <Aron.Virginas-Tar@arm.com>2018-10-31 11:04:01 +0000
committerDavid Beck <david.beck@arm.com>2018-11-08 11:34:44 +0000
commit60578950322491e44b4203fe085c3230ead19c7a (patch)
treee68bd71cb7b90d66d69a3de25561e32a13dd4e17 /src/backends/aclCommon/memory/BaseMemoryManager.cpp
parentdb49a8880ba869627e884b5ba5245a3932de218d (diff)
downloadarmnn-60578950322491e44b4203fe085c3230ead19c7a.tar.gz
IVGCVSW-1709: Clean up memory manager bodge
* Added quick workaround for the memory management errors in the CL/Neon unit tests Change-Id: I56250db462cdbdc1acc0a5824807d288fb0c1d11
Diffstat (limited to 'src/backends/aclCommon/memory/BaseMemoryManager.cpp')
-rw-r--r--src/backends/aclCommon/memory/BaseMemoryManager.cpp125
1 files changed, 0 insertions, 125 deletions
diff --git a/src/backends/aclCommon/memory/BaseMemoryManager.cpp b/src/backends/aclCommon/memory/BaseMemoryManager.cpp
deleted file mode 100644
index 532692b1ce..0000000000
--- a/src/backends/aclCommon/memory/BaseMemoryManager.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#include "BaseMemoryManager.hpp"
-
-#if defined(ARMCOMPUTENEON_ENABLED) || defined(ARMCOMPUTECL_ENABLED)
-#include "BlobLifetimeManager.hpp"
-#include "PoolManager.hpp"
-#include "OffsetLifetimeManager.hpp"
-#endif
-
-#include <boost/polymorphic_cast.hpp>
-
-namespace armnn
-{
-
-#if defined(ARMCOMPUTENEON_ENABLED) || defined(ARMCOMPUTECL_ENABLED)
-BaseMemoryManager::BaseMemoryManager(std::unique_ptr<arm_compute::IAllocator> alloc,
- MemoryAffinity memoryAffinity)
-{
- // (Re)create the memory manager components.
- m_Allocator = std::move(alloc);
-
- m_IntraLayerMemoryMgr = CreateArmComputeMemoryManager(memoryAffinity);
- m_InterLayerMemoryMgr = CreateArmComputeMemoryManager(memoryAffinity);
-}
-
-std::shared_ptr<arm_compute::MemoryManagerOnDemand>
-BaseMemoryManager::CreateArmComputeMemoryManager(MemoryAffinity memoryAffinity)
-{
- std::shared_ptr<arm_compute::ILifetimeManager> lifetimeManager = nullptr;
-
- if (memoryAffinity == MemoryAffinity::Buffer)
- {
- lifetimeManager = std::make_shared<BlobLifetimeManager>();
- }
- else
- {
- lifetimeManager = std::make_shared<OffsetLifetimeManager>();
- }
-
- auto poolManager = std::make_shared<PoolManager>();
- auto memoryManager = std::make_shared<arm_compute::MemoryManagerOnDemand>(lifetimeManager, poolManager);
-
- // Set allocator that the memory manager will use
- memoryManager->set_allocator(m_Allocator.get());
-
- return memoryManager;
-}
-
-void BaseMemoryManager::FinalizeMemoryManager(arm_compute::MemoryManagerOnDemand& memoryManager)
-{
- // Number of pools that the manager will create. This specifies how many layers you want to run in parallel
- memoryManager.set_num_pools(1);
-
- // Finalize the memory manager. (Validity checks, memory allocations, etc)
- memoryManager.finalize();
-}
-
-void BaseMemoryManager::Finalize()
-{
- BOOST_ASSERT(m_IntraLayerMemoryMgr);
- FinalizeMemoryManager(*m_IntraLayerMemoryMgr.get());
-
- BOOST_ASSERT(m_InterLayerMemoryMgr);
- FinalizeMemoryManager(*m_InterLayerMemoryMgr.get());
-}
-
-void BaseMemoryManager::Acquire()
-{
- // Allocate memory pools for intra-layer memory manager
- BOOST_ASSERT(m_IntraLayerMemoryMgr);
- IPoolManager* poolManager = boost::polymorphic_downcast<IPoolManager*>(m_IntraLayerMemoryMgr->pool_manager());
- BOOST_ASSERT(poolManager);
- poolManager->AllocatePools();
-
- // Allocate memory pools for inter-layer memory manager
- BOOST_ASSERT(m_InterLayerMemoryMgr);
- poolManager = boost::polymorphic_downcast<IPoolManager*>(m_InterLayerMemoryMgr->pool_manager());
- BOOST_ASSERT(poolManager);
- poolManager->AllocatePools();
-
- // Acquire inter-layer memory group. NOTE: This has to come after allocating the pools
- BOOST_ASSERT(m_InterLayerMemoryGroup);
- m_InterLayerMemoryGroup->acquire();
-}
-
-void BaseMemoryManager::Release()
-{
- // Release inter-layer memory group. NOTE: This has to come before releasing the pools
- BOOST_ASSERT(m_InterLayerMemoryGroup);
- m_InterLayerMemoryGroup->release();
-
- // Release memory pools managed by intra-layer memory manager
- BOOST_ASSERT(m_IntraLayerMemoryMgr);
- IPoolManager* poolManager = boost::polymorphic_downcast<IPoolManager*>(m_IntraLayerMemoryMgr->pool_manager());
- BOOST_ASSERT(poolManager);
- poolManager->ReleasePools();
-
- // Release memory pools managed by inter-layer memory manager
- BOOST_ASSERT(m_InterLayerMemoryMgr);
- poolManager = boost::polymorphic_downcast<IPoolManager*>(m_InterLayerMemoryMgr->pool_manager());
- BOOST_ASSERT(poolManager);
- poolManager->ReleasePools();
-}
-#endif
-
-#ifdef ARMCOMPUTENEON_ENABLED
-std::shared_ptr<arm_compute::IMemoryGroup>
-NeonMemoryManager::CreateMemoryGroup(const std::shared_ptr<arm_compute::MemoryManagerOnDemand>& memoryManager)
-{
- return std::make_shared<arm_compute::MemoryGroup>(memoryManager);
-}
-#endif
-
-#ifdef ARMCOMPUTECL_ENABLED
-std::shared_ptr<arm_compute::IMemoryGroup>
-ClMemoryManager::CreateMemoryGroup(const std::shared_ptr<arm_compute::MemoryManagerOnDemand>& memoryManager)
-{
- return std::make_shared<arm_compute::CLMemoryGroup>(memoryManager);
-}
-#endif
-
-}