blob: e1cdc8bbacdeb42f2e074400e37fdc585a6d839b [file] [log] [blame]
Narumol Prangnawarat4e3e8182019-08-14 12:25:50 +01001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5
6#pragma once
7
8#include <aclCommon/BaseMemoryManager.hpp>
Matteo Martincighe5b8eb92019-11-28 15:45:42 +00009#include <armnn/backends/ITensorHandleFactory.hpp>
Narumol Prangnawarat4e3e8182019-08-14 12:25:50 +010010
11namespace armnn
12{
13
Jan Eilerse9f0f0f2019-08-16 10:28:37 +010014constexpr const char* NeonTensorHandleFactoryId() { return "Arm/Neon/TensorHandleFactory"; }
15
Narumol Prangnawarat4e3e8182019-08-14 12:25:50 +010016class NeonTensorHandleFactory : public ITensorHandleFactory
17{
18public:
Jan Eilerse9f0f0f2019-08-16 10:28:37 +010019 NeonTensorHandleFactory(std::weak_ptr<NeonMemoryManager> mgr)
James Conroy57d10b72019-10-25 09:44:14 +010020 : m_MemoryManager(mgr)
Narumol Prangnawarat4e3e8182019-08-14 12:25:50 +010021 {}
22
23 std::unique_ptr<ITensorHandle> CreateSubTensorHandle(ITensorHandle& parent,
Jan Eilerse9f0f0f2019-08-16 10:28:37 +010024 const TensorShape& subTensorShape,
25 const unsigned int* subTensorOrigin) const override;
Narumol Prangnawarat4e3e8182019-08-14 12:25:50 +010026
David Monahanc6e5a6e2019-10-02 09:33:57 +010027 std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo) const override;
28
29 std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo,
30 DataLayout dataLayout) const override;
31
David Monahan3fb7e102019-08-20 11:25:29 +010032 std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo,
33 const bool IsMemoryManaged = true) const override;
Narumol Prangnawarat4e3e8182019-08-14 12:25:50 +010034
35 std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo,
David Monahan3fb7e102019-08-20 11:25:29 +010036 DataLayout dataLayout,
37 const bool IsMemoryManaged = true) const override;
Narumol Prangnawarat4e3e8182019-08-14 12:25:50 +010038
Jan Eilerse9f0f0f2019-08-16 10:28:37 +010039 static const FactoryId& GetIdStatic();
40
Ferran Balaguerbfeb2712019-08-07 15:14:56 +010041 const FactoryId& GetId() const override;
Narumol Prangnawarat4e3e8182019-08-14 12:25:50 +010042
43 bool SupportsSubTensors() const override;
44
45 MemorySourceFlags GetExportFlags() const override;
46
47 MemorySourceFlags GetImportFlags() const override;
48
49private:
Jan Eilerse9f0f0f2019-08-16 10:28:37 +010050 mutable std::shared_ptr<NeonMemoryManager> m_MemoryManager;
Narumol Prangnawarat4e3e8182019-08-14 12:25:50 +010051};
52
53} // namespace armnn