aboutsummaryrefslogtreecommitdiff
path: root/src/armnn/backends/AclBaseMemoryManager.cpp
blob: fc796995c7a92c06b8a49bf2858d15631fc3dc66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//
// Copyright © 2017 Arm Ltd. All rights reserved.
// See LICENSE file in the project root for full license information.
//
#include "AclBaseMemoryManager.hpp"

namespace armnn
{

#if ARMCOMPUTENEON_ENABLED || ARMCOMPUTECL_ENABLED
AclBaseMemoryManager::AclBaseMemoryManager(std::unique_ptr<arm_compute::IAllocator> alloc)
{
    // (re)create the memory manager components
    m_Allocator = std::move(alloc);
    m_IntraLayerLifetimeMgr = std::make_shared<arm_compute::BlobLifetimeManager>();
    m_IntraLayerPoolMgr     = std::make_shared<arm_compute::PoolManager>();
    m_IntraLayerMemoryMgr   = std::make_shared<arm_compute::MemoryManagerOnDemand>(m_IntraLayerLifetimeMgr,
                                                                                   m_IntraLayerPoolMgr);
}

void AclBaseMemoryManager::Finalize()
{
    // Set allocator that the memory manager will use
    m_IntraLayerMemoryMgr->set_allocator(m_Allocator.get());
    // Number of pools that the manager will create. This specifies how many layers you want to run in parallel
    m_IntraLayerMemoryMgr->set_num_pools(1);
    // Finalize the memory manager. (Validity checks, memory allocations, etc)
    m_IntraLayerMemoryMgr->finalize();
}
#endif

}