ArmNN
 24.08
NeonWorkloadFactory.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017-2023 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #pragma once
6 
7 #include <armnn/Optional.hpp>
9 
13 
14 #include <arm_compute/runtime/IScheduler.h>
15 
16 namespace armnn
17 {
18 
19 // Neon workload factory.
21 {
22 public:
23  NeonWorkloadFactory(const std::shared_ptr<NeonMemoryManager>& memoryManager);
24 
25  NeonWorkloadFactory(const std::shared_ptr<NeonMemoryManager>& memoryManager,
27 
28  const BackendId& GetBackendId() const override;
29 
30  static bool IsLayerSupported(const Layer& layer,
31  Optional<DataType> dataType,
32  std::string& outReasonIfUnsupported);
33 
34  static bool IsLayerSupported(const IConnectableLayer& layer,
35  Optional<DataType> dataType,
36  std::string& outReasonIfUnsupported,
37  const ModelOptions& modelOptions);
38 
39  bool SupportsSubTensors() const override { return true; }
40 
41  ARMNN_DEPRECATED_MSG("Use ITensorHandleFactory::CreateSubTensorHandle instead")
43  TensorShape const& subTensorShape,
44  unsigned int const* subTensorOrigin) const override;
45 
47  std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo,
48  const bool IsMemoryManaged = true) const override;
49 
51  std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo,
52  DataLayout dataLayout,
53  const bool IsMemoryManaged = true) const override;
54 
55  std::unique_ptr<IWorkload> CreateWorkload(LayerType type,
56  const QueueDescriptor& descriptor,
57  const WorkloadInfo& info) const override;
58 private:
59  void SetNumberOfThreads();
60 
61  mutable std::shared_ptr<NeonMemoryManager> m_MemoryManager;
62  const IBackendInternal::IBackendSpecificModelContextPtr m_ModelContextPtr;
63 };
64 
65 } // namespace armnn
armnn::NeonWorkloadFactory::CreateTensorHandle
std::unique_ptr< ITensorHandle > CreateTensorHandle(const TensorInfo &tensorInfo, const bool IsMemoryManaged=true) const override
Definition: NeonWorkloadFactory.cpp:111
armnn::Optional
Definition: Optional.hpp:270
WorkloadFactoryBase.hpp
armnn::WorkloadFactoryBase
Definition: WorkloadFactoryBase.hpp:13
armnn::DataLayout
DataLayout
Definition: Types.hpp:62
armnn::NeonWorkloadFactory::IsLayerSupported
static bool IsLayerSupported(const Layer &layer, Optional< DataType > dataType, std::string &outReasonIfUnsupported)
Definition: NeonWorkloadFactory.cpp:34
armnn::TensorInfo
Definition: Tensor.hpp:152
armnn::IWorkload
Workload interface to enqueue a layer computation.
Definition: IWorkload.hpp:23
BaseMemoryManager.hpp
armnn::ITensorHandle
Definition: ITensorHandle.hpp:16
armnn::NeonWorkloadFactory::SupportsSubTensors
bool SupportsSubTensors() const override
Definition: NeonWorkloadFactory.hpp:39
armnn::NeonWorkloadFactory
Definition: NeonWorkloadFactory.hpp:20
IgnoreUnused.hpp
armnn::IBackendInternal
Definition: IBackendInternal.hpp:77
armnn::Layer
Definition: Layer.hpp:230
armnn::NeonWorkloadFactory::CreateWorkload
std::unique_ptr< IWorkload > CreateWorkload(LayerType type, const QueueDescriptor &descriptor, const WorkloadInfo &info) const override
Backends should implement their own CreateWorkload function with a switch statement.
Definition: NeonWorkloadFactory.cpp:134
armnn::TensorShape
Definition: Tensor.hpp:20
Optional.hpp
armnn::NeonMemoryManager
Definition: BaseMemoryManager.hpp:60
armnn::NeonWorkloadFactory::NeonWorkloadFactory
NeonWorkloadFactory(const std::shared_ptr< NeonMemoryManager > &memoryManager)
Definition: NeonWorkloadFactory.cpp:73
armnn::WorkloadInfo
Contains information about TensorInfos of a layer.
Definition: WorkloadInfo.hpp:16
IBackendInternal.hpp
armnn::QueueDescriptor
Definition: WorkloadData.hpp:24
armnn::ITensorHandleFactory
Definition: ITensorHandleFactory.hpp:46
armnn::NeonWorkloadFactory::CreateSubTensorHandle
std::unique_ptr< ITensorHandle > CreateSubTensorHandle(ITensorHandle &parent, TensorShape const &subTensorShape, unsigned int const *subTensorOrigin) const override
Definition: NeonWorkloadFactory.cpp:86
ARMNN_DEPRECATED_MSG
#define ARMNN_DEPRECATED_MSG(message)
Definition: Deprecated.hpp:43
std
Definition: BackendId.hpp:149
armnn::BackendId
Definition: BackendId.hpp:75
armnn::NeonWorkloadFactory::GetBackendId
const BackendId & GetBackendId() const override
Definition: NeonWorkloadFactory.cpp:49
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
armnn::IConnectableLayer
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
Definition: INetwork.hpp:80
armnn::ModelOptions
std::vector< BackendOptions > ModelOptions
Definition: BackendOptions.hpp:18
armnn::LayerType
LayerType
When adding a new layer, adapt also the LastLayer enum value in the enum class LayerType below.
Definition: Types.hpp:491
armnn::IBackendInternal::IBackendSpecificModelContextPtr
std::shared_ptr< IBackendModelContext > IBackendSpecificModelContextPtr
Definition: IBackendInternal.hpp:96