blob: 82e388e62931474197bcf94f845298abfee7c435 [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>
9#include <backendsCommon/ITensorHandleFactory.hpp>
10
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)
20 : m_MemoryManager(mgr),
21 m_ImportFlags(static_cast<MemorySourceFlags>(MemorySource::Undefined)),
22 m_ExportFlags(static_cast<MemorySourceFlags>(MemorySource::Undefined))
Narumol Prangnawarat4e3e8182019-08-14 12:25:50 +010023 {}
24
25 std::unique_ptr<ITensorHandle> CreateSubTensorHandle(ITensorHandle& parent,
Jan Eilerse9f0f0f2019-08-16 10:28:37 +010026 const TensorShape& subTensorShape,
27 const unsigned int* subTensorOrigin) const override;
Narumol Prangnawarat4e3e8182019-08-14 12:25:50 +010028
29 std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo) const override;
30
31 std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo,
32 DataLayout dataLayout) const override;
33
Jan Eilerse9f0f0f2019-08-16 10:28:37 +010034 static const FactoryId& GetIdStatic();
35
Ferran Balaguerbfeb2712019-08-07 15:14:56 +010036 const FactoryId& GetId() const override;
Narumol Prangnawarat4e3e8182019-08-14 12:25:50 +010037
38 bool SupportsSubTensors() const override;
39
40 MemorySourceFlags GetExportFlags() const override;
41
42 MemorySourceFlags GetImportFlags() const override;
43
44private:
Jan Eilerse9f0f0f2019-08-16 10:28:37 +010045 mutable std::shared_ptr<NeonMemoryManager> m_MemoryManager;
Narumol Prangnawarat4e3e8182019-08-14 12:25:50 +010046 MemorySourceFlags m_ImportFlags;
47 MemorySourceFlags m_ExportFlags;
Narumol Prangnawarat4e3e8182019-08-14 12:25:50 +010048};
49
50} // namespace armnn