blob: 04074cf0ab5188c2cabf4c2961d853909bcdf5ae [file] [log] [blame]
David Monahan8a570462023-11-22 13:24:25 +00001//
David Monahanbd738082023-12-08 12:50:02 +00002// Copyright © 2022-2024 Arm Ltd and Contributors. All rights reserved.
David Monahan8a570462023-11-22 13:24:25 +00003// SPDX-License-Identifier: MIT
4//
5#pragma once
6
7#include <aclCommon/BaseMemoryManager.hpp>
8
9#include <armnn/Optional.hpp>
10
David Monahanbd738082023-12-08 12:50:02 +000011#include <arm_compute/core/CL/CLCompileContext.h>
12
David Monahan8a570462023-11-22 13:24:25 +000013namespace armnn
14{
15
16// Dynamic Fusion workload factory.
17class GpuFsaWorkloadFactory : public IWorkloadFactory
18{
19public:
20 explicit GpuFsaWorkloadFactory(const std::shared_ptr<GpuFsaMemoryManager>& memoryManager);
21 GpuFsaWorkloadFactory();
22
23 ~GpuFsaWorkloadFactory() {}
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")
34 std::unique_ptr<ITensorHandle> CreateSubTensorHandle(ITensorHandle& /*parent*/,
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
45 ARMNN_DEPRECATED_MSG("Use ITensorHandleFactory::CreateTensorHandle instead")
46 std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo,
47 DataLayout dataLayout,
48 const bool IsMemoryManaged = true) const override;
David Monahanbd738082023-12-08 12:50:02 +000049 void InitializeCLCompileContext();
David Monahan8a570462023-11-22 13:24:25 +000050
51 std::unique_ptr<IWorkload> CreateWorkload(LayerType type,
52 const QueueDescriptor& descriptor,
53 const WorkloadInfo& info) const override;
54
55private:
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;
David Monahanbd738082023-12-08 12:50:02 +000060 arm_compute::CLCompileContext m_CLCompileContext;
David Monahan8a570462023-11-22 13:24:25 +000061};
62
63} // namespace armnn