Derek Lamberti | 84da38b | 2019-06-13 11:40:08 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #pragma once |
| 7 | |
Derek Lamberti | 84da38b | 2019-06-13 11:40:08 +0100 | [diff] [blame] | 8 | #include <armnn/IRuntime.hpp> |
Derek Lamberti | f674aa0 | 2019-08-01 15:56:25 +0100 | [diff] [blame^] | 9 | #include <armnn/MemorySources.hpp> |
| 10 | #include <armnn/Types.hpp> |
Derek Lamberti | 84da38b | 2019-06-13 11:40:08 +0100 | [diff] [blame] | 11 | |
| 12 | namespace armnn |
| 13 | { |
| 14 | |
| 15 | class ITensorHandleFactory |
| 16 | { |
| 17 | public: |
| 18 | using FactoryId = std::string; |
| 19 | static const FactoryId LegacyFactoryId; // Use the workload factory to create the tensor handle |
| 20 | static const FactoryId DeferredFactoryId; // Some TensorHandleFactory decisions are deferred to run-time |
| 21 | |
| 22 | virtual ~ITensorHandleFactory() {} |
| 23 | |
Derek Lamberti | 84da38b | 2019-06-13 11:40:08 +0100 | [diff] [blame] | 24 | virtual std::unique_ptr<ITensorHandle> CreateSubTensorHandle(ITensorHandle& parent, |
| 25 | TensorShape const& subTensorShape, |
| 26 | unsigned int const* subTensorOrigin) const = 0; |
| 27 | |
| 28 | virtual std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo) const = 0; |
| 29 | |
| 30 | virtual const FactoryId GetId() const = 0; |
| 31 | |
| 32 | virtual bool SupportsSubTensors() const = 0; |
| 33 | |
| 34 | virtual bool SupportsMapUnmap() const final { return true; } |
| 35 | |
Derek Lamberti | f674aa0 | 2019-08-01 15:56:25 +0100 | [diff] [blame^] | 36 | virtual MemorySourceFlags GetExportFlags() const { return 0; } |
| 37 | virtual MemorySourceFlags GetImportFlags() const { return 0; } |
Derek Lamberti | 84da38b | 2019-06-13 11:40:08 +0100 | [diff] [blame] | 38 | }; |
| 39 | |
Derek Lamberti | f674aa0 | 2019-08-01 15:56:25 +0100 | [diff] [blame^] | 40 | enum class EdgeStrategy |
Derek Lamberti | 84da38b | 2019-06-13 11:40:08 +0100 | [diff] [blame] | 41 | { |
Derek Lamberti | f674aa0 | 2019-08-01 15:56:25 +0100 | [diff] [blame^] | 42 | Undefined, /// No strategy has been defined. Used internally to verify integrity of optimizations. |
| 43 | DirectCompatibility, /// Destination backend can work directly with tensors on source backend. |
| 44 | ExportToTarget, /// Source backends tensor data can be exported to destination backend tensor without copy. |
| 45 | CopyToTarget /// Copy contents from source backend tensor to destination backend tensor. |
Derek Lamberti | 84da38b | 2019-06-13 11:40:08 +0100 | [diff] [blame] | 46 | }; |
| 47 | |
| 48 | } //namespace armnn |