David Monahan | 8a57046 | 2023-11-22 13:24:25 +0000 | [diff] [blame] | 1 | // |
David Monahan | bd73808 | 2023-12-08 12:50:02 +0000 | [diff] [blame] | 2 | // Copyright © 2022-2024 Arm Ltd and Contributors. All rights reserved. |
David Monahan | 8a57046 | 2023-11-22 13:24:25 +0000 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | #pragma once |
| 6 | |
| 7 | #include <aclCommon/BaseMemoryManager.hpp> |
| 8 | |
| 9 | #include <armnn/Optional.hpp> |
| 10 | |
David Monahan | bd73808 | 2023-12-08 12:50:02 +0000 | [diff] [blame] | 11 | #include <arm_compute/core/CL/CLCompileContext.h> |
| 12 | |
David Monahan | 8a57046 | 2023-11-22 13:24:25 +0000 | [diff] [blame] | 13 | namespace armnn |
| 14 | { |
| 15 | |
| 16 | // Dynamic Fusion workload factory. |
| 17 | class GpuFsaWorkloadFactory : public IWorkloadFactory |
| 18 | { |
| 19 | public: |
| 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 Monahan | bd73808 | 2023-12-08 12:50:02 +0000 | [diff] [blame] | 49 | void InitializeCLCompileContext(); |
David Monahan | 8a57046 | 2023-11-22 13:24:25 +0000 | [diff] [blame] | 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; |
David Monahan | bd73808 | 2023-12-08 12:50:02 +0000 | [diff] [blame] | 60 | arm_compute::CLCompileContext m_CLCompileContext; |
David Monahan | 8a57046 | 2023-11-22 13:24:25 +0000 | [diff] [blame] | 61 | }; |
| 62 | |
| 63 | } // namespace armnn |