Narumol Prangnawarat | 4e3e818 | 2019-08-14 12:25:50 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #pragma once |
| 7 | |
| 8 | #include <aclCommon/BaseMemoryManager.hpp> |
| 9 | #include <backendsCommon/ITensorHandleFactory.hpp> |
| 10 | |
| 11 | namespace armnn |
| 12 | { |
| 13 | |
Jan Eilers | e9f0f0f | 2019-08-16 10:28:37 +0100 | [diff] [blame] | 14 | constexpr const char* NeonTensorHandleFactoryId() { return "Arm/Neon/TensorHandleFactory"; } |
| 15 | |
Narumol Prangnawarat | 4e3e818 | 2019-08-14 12:25:50 +0100 | [diff] [blame] | 16 | class NeonTensorHandleFactory : public ITensorHandleFactory |
| 17 | { |
| 18 | public: |
Jan Eilers | e9f0f0f | 2019-08-16 10:28:37 +0100 | [diff] [blame] | 19 | NeonTensorHandleFactory(std::weak_ptr<NeonMemoryManager> mgr) |
| 20 | : m_MemoryManager(mgr), |
David Monahan | 3fb7e10 | 2019-08-20 11:25:29 +0100 | [diff] [blame] | 21 | m_ImportFlags(static_cast<MemorySourceFlags>(MemorySource::Malloc)), |
| 22 | m_ExportFlags(static_cast<MemorySourceFlags>(MemorySource::Malloc)) |
Narumol Prangnawarat | 4e3e818 | 2019-08-14 12:25:50 +0100 | [diff] [blame] | 23 | {} |
| 24 | |
| 25 | std::unique_ptr<ITensorHandle> CreateSubTensorHandle(ITensorHandle& parent, |
Jan Eilers | e9f0f0f | 2019-08-16 10:28:37 +0100 | [diff] [blame] | 26 | const TensorShape& subTensorShape, |
| 27 | const unsigned int* subTensorOrigin) const override; |
Narumol Prangnawarat | 4e3e818 | 2019-08-14 12:25:50 +0100 | [diff] [blame] | 28 | |
David Monahan | 3fb7e10 | 2019-08-20 11:25:29 +0100 | [diff] [blame] | 29 | std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo, |
| 30 | const bool IsMemoryManaged = true) const override; |
Narumol Prangnawarat | 4e3e818 | 2019-08-14 12:25:50 +0100 | [diff] [blame] | 31 | |
| 32 | std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo, |
David Monahan | 3fb7e10 | 2019-08-20 11:25:29 +0100 | [diff] [blame] | 33 | DataLayout dataLayout, |
| 34 | const bool IsMemoryManaged = true) const override; |
Narumol Prangnawarat | 4e3e818 | 2019-08-14 12:25:50 +0100 | [diff] [blame] | 35 | |
Jan Eilers | e9f0f0f | 2019-08-16 10:28:37 +0100 | [diff] [blame] | 36 | static const FactoryId& GetIdStatic(); |
| 37 | |
Ferran Balaguer | bfeb271 | 2019-08-07 15:14:56 +0100 | [diff] [blame] | 38 | const FactoryId& GetId() const override; |
Narumol Prangnawarat | 4e3e818 | 2019-08-14 12:25:50 +0100 | [diff] [blame] | 39 | |
| 40 | bool SupportsSubTensors() const override; |
| 41 | |
| 42 | MemorySourceFlags GetExportFlags() const override; |
| 43 | |
| 44 | MemorySourceFlags GetImportFlags() const override; |
| 45 | |
| 46 | private: |
Jan Eilers | e9f0f0f | 2019-08-16 10:28:37 +0100 | [diff] [blame] | 47 | mutable std::shared_ptr<NeonMemoryManager> m_MemoryManager; |
Narumol Prangnawarat | 4e3e818 | 2019-08-14 12:25:50 +0100 | [diff] [blame] | 48 | MemorySourceFlags m_ImportFlags; |
| 49 | MemorySourceFlags m_ExportFlags; |
Narumol Prangnawarat | 4e3e818 | 2019-08-14 12:25:50 +0100 | [diff] [blame] | 50 | }; |
| 51 | |
| 52 | } // namespace armnn |