Francis Murtagh | 9270d9e | 2022-08-12 13:54:17 +0100 | [diff] [blame] | 1 | // |
Kevin May | 1bea6be | 2023-12-12 11:18:46 +0000 | [diff] [blame^] | 2 | // Copyright © 2022-2023 Arm Ltd and Contributors. All rights reserved. |
Francis Murtagh | 9270d9e | 2022-08-12 13:54:17 +0100 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #pragma once |
| 7 | |
| 8 | #include "armnn/backends/Workload.hpp" |
| 9 | |
Matthew Sloyan | 5c54c38 | 2022-11-09 16:28:51 +0000 | [diff] [blame] | 10 | #include <graph_status.h> |
| 11 | #include <model_runner.h> |
| 12 | |
Francis Murtagh | 9270d9e | 2022-08-12 13:54:17 +0100 | [diff] [blame] | 13 | #include <memory> |
| 14 | #include <string> |
| 15 | #include <vector> |
| 16 | |
| 17 | namespace armnn |
| 18 | { |
| 19 | |
| 20 | bool TosaRefPreCompiledWorkloadValidate(std::string* reasonIfUnsupported); |
| 21 | |
| 22 | class TosaRefPreCompiledWorkload : public BaseWorkload<PreCompiledQueueDescriptor> |
| 23 | { |
| 24 | public: |
| 25 | TosaRefPreCompiledWorkload(const PreCompiledQueueDescriptor& descriptor, |
| 26 | const WorkloadInfo& info); |
| 27 | void Execute() const override; |
| 28 | |
| 29 | private: |
| 30 | bool SupportsTensorHandleReplacement() const override |
| 31 | { |
| 32 | return true; |
| 33 | } |
| 34 | |
| 35 | void ReplaceInputTensorHandle(ITensorHandle* tensorHandle, unsigned int slot) override |
| 36 | { |
| 37 | this->m_Data.m_Inputs[slot] = tensorHandle; |
| 38 | } |
| 39 | |
| 40 | void ReplaceOutputTensorHandle(ITensorHandle* tensorHandle, unsigned int slot) override |
| 41 | { |
| 42 | this->m_Data.m_Outputs[slot] = tensorHandle; |
| 43 | } |
Matthew Sloyan | 5c54c38 | 2022-11-09 16:28:51 +0000 | [diff] [blame] | 44 | |
Teresa Charlin | ce65588 | 2023-11-21 15:44:13 +0000 | [diff] [blame] | 45 | template <typename T, typename Trunner> |
| 46 | void SetInput(TosaReference::IModelRunner& runner, std::string inputName, uint32_t inputIndex) const; |
| 47 | |
Matthew Sloyan | 5c54c38 | 2022-11-09 16:28:51 +0000 | [diff] [blame] | 48 | template <typename T> |
| 49 | void SetInput(TosaReference::IModelRunner& runner, std::string inputName, uint32_t inputIndex) const; |
| 50 | |
Teresa Charlin | ce65588 | 2023-11-21 15:44:13 +0000 | [diff] [blame] | 51 | template <typename T, typename Trunner> |
| 52 | void GetOutput(TosaReference::IModelRunner& runner, std::string outputName, uint32_t outputIndex) const; |
| 53 | |
Matthew Sloyan | 5c54c38 | 2022-11-09 16:28:51 +0000 | [diff] [blame] | 54 | template <typename T> |
| 55 | void GetOutput(TosaReference::IModelRunner& runner, std::string outputName, uint32_t outputIndex) const; |
| 56 | |
| 57 | WorkloadInfo m_workloadInfo; |
Francis Murtagh | 9270d9e | 2022-08-12 13:54:17 +0100 | [diff] [blame] | 58 | }; |
| 59 | |
| 60 | } //namespace armnn |