blob: 89a2a7fa3b6e5fe771157e0ba3e3adbc79ecf0e9 [file] [log] [blame]
Derek Lamberti84da38b2019-06-13 11:40:08 +01001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5
6#pragma once
7
Derek Lamberti84da38b2019-06-13 11:40:08 +01008#include <armnn/IRuntime.hpp>
Derek Lambertif674aa02019-08-01 15:56:25 +01009#include <armnn/MemorySources.hpp>
10#include <armnn/Types.hpp>
Derek Lamberti84da38b2019-06-13 11:40:08 +010011
12namespace armnn
13{
14
15class ITensorHandleFactory
16{
17public:
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 Lamberti84da38b2019-06-13 11:40:08 +010024 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 Lambertif674aa02019-08-01 15:56:25 +010036 virtual MemorySourceFlags GetExportFlags() const { return 0; }
37 virtual MemorySourceFlags GetImportFlags() const { return 0; }
Derek Lamberti84da38b2019-06-13 11:40:08 +010038};
39
Derek Lambertif674aa02019-08-01 15:56:25 +010040enum class EdgeStrategy
Derek Lamberti84da38b2019-06-13 11:40:08 +010041{
Derek Lambertif674aa02019-08-01 15:56:25 +010042 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 Lamberti84da38b2019-06-13 11:40:08 +010046};
47
48} //namespace armnn