ArmNN
 24.08
GpuFsaWorkloadFactory.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2022-2024 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #pragma once
6 
8 
9 #include <armnn/Optional.hpp>
10 
11 #include <arm_compute/core/CL/CLCompileContext.h>
12 
13 namespace armnn
14 {
15 
16 // Dynamic Fusion workload factory.
18 {
19 public:
20  explicit GpuFsaWorkloadFactory(const std::shared_ptr<GpuFsaMemoryManager>& memoryManager);
22 
24 
25  const BackendId& GetBackendId() const override;
26 
27  static bool IsLayerSupported(const Layer& layer,
28  Optional<DataType> dataType,
29  std::string& outReasonIfUnsupported);
30 
31  bool SupportsSubTensors() const override { return false; }
32 
33  ARMNN_DEPRECATED_MSG("Use ITensorHandleFactory::CreateSubTensorHandle instead")
35  TensorShape const& /*subTensorShape*/,
36  unsigned int const* /*subTensorOrigin*/) const override
37  {
38  return nullptr;
39  }
40 
41  ARMNN_DEPRECATED_MSG("Use ITensorHandleFactory::CreateTensorHandle instead")
42  std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo,
43  const bool IsMemoryManaged = true) const override;
44 
46  std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo,
47  DataLayout dataLayout,
48  const bool IsMemoryManaged = true) const override;
50 
51  std::unique_ptr<IWorkload> CreateWorkload(LayerType type,
52  const QueueDescriptor& descriptor,
53  const WorkloadInfo& info) const override;
54 
55 private:
56  template <typename QueueDescriptorType>
57  std::unique_ptr<IWorkload> MakeWorkload(const QueueDescriptorType& descriptor, const WorkloadInfo& info) const;
58 
59  mutable std::shared_ptr<GpuFsaMemoryManager> m_MemoryManager;
60  arm_compute::CLCompileContext m_CLCompileContext;
61 };
62 
63 } // namespace armnn
armnn::Optional
Definition: Optional.hpp:270
armnn::GpuFsaWorkloadFactory::CreateSubTensorHandle
std::unique_ptr< ITensorHandle > CreateSubTensorHandle(ITensorHandle &, TensorShape const &, unsigned int const *) const override
Definition: GpuFsaWorkloadFactory.hpp:34
armnn::DataLayout
DataLayout
Definition: Types.hpp:62
armnn::GpuFsaWorkloadFactory::~GpuFsaWorkloadFactory
~GpuFsaWorkloadFactory()
Definition: GpuFsaWorkloadFactory.hpp:23
armnn::GpuFsaWorkloadFactory::IsLayerSupported
static bool IsLayerSupported(const Layer &layer, Optional< DataType > dataType, std::string &outReasonIfUnsupported)
Definition: GpuFsaWorkloadFactory.cpp:65
armnn::GpuFsaWorkloadFactory::GpuFsaWorkloadFactory
GpuFsaWorkloadFactory()
Definition: GpuFsaWorkloadFactory.cpp:54
armnn::TensorInfo
Definition: Tensor.hpp:152
armnn::IWorkload
Workload interface to enqueue a layer computation.
Definition: IWorkload.hpp:23
armnn::GpuFsaWorkloadFactory::CreateTensorHandle
std::unique_ptr< ITensorHandle > CreateTensorHandle(const TensorInfo &tensorInfo, const bool IsMemoryManaged=true) const override
Definition: GpuFsaWorkloadFactory.cpp:72
armnn::GpuFsaWorkloadFactory::SupportsSubTensors
bool SupportsSubTensors() const override
Definition: GpuFsaWorkloadFactory.hpp:31
BaseMemoryManager.hpp
armnn::ITensorHandle
Definition: ITensorHandle.hpp:16
armnn::GpuFsaWorkloadFactory::InitializeCLCompileContext
void InitializeCLCompileContext()
Definition: GpuFsaWorkloadFactory.cpp:92
armnn::Layer
Definition: Layer.hpp:230
armnn::TensorShape
Definition: Tensor.hpp:20
Optional.hpp
armnn::WorkloadInfo
Contains information about TensorInfos of a layer.
Definition: WorkloadInfo.hpp:16
armnn::GpuFsaWorkloadFactory
Definition: GpuFsaWorkloadFactory.hpp:17
armnn::IWorkloadFactory
Definition: WorkloadFactory.hpp:22
armnn::QueueDescriptor
Definition: WorkloadData.hpp:24
armnn::ITensorHandleFactory
Definition: ITensorHandleFactory.hpp:46
ARMNN_DEPRECATED_MSG
#define ARMNN_DEPRECATED_MSG(message)
Definition: Deprecated.hpp:43
std
Definition: BackendId.hpp:149
armnn::BackendId
Definition: BackendId.hpp:75
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
armnn::GpuFsaMemoryManager
Definition: GpuFsaMemoryManager.hpp:16
armnn::GpuFsaWorkloadFactory::GetBackendId
const BackendId & GetBackendId() const override
Definition: GpuFsaWorkloadFactory.cpp:60
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::GpuFsaWorkloadFactory::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: GpuFsaWorkloadFactory.cpp:99