Kristofer Jonsson | 3f5510f | 2023-02-08 14:23:00 +0100 | [diff] [blame] | 1 | /* |
Mikael Olsson | 6870951 | 2024-02-12 13:30:31 +0100 | [diff] [blame^] | 2 | * SPDX-FileCopyrightText: Copyright 2022-2024 Arm Limited and/or its affiliates <open-source-office@arm.com> |
Kristofer Jonsson | 3f5510f | 2023-02-08 14:23:00 +0100 | [diff] [blame] | 3 | * SPDX-License-Identifier: Apache-2.0 |
| 4 | * |
| 5 | * Licensed under the Apache License, Version 2.0 (the License); you may |
| 6 | * not use _this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at |
| 8 | * |
| 9 | * www.apache.org/licenses/LICENSE-2.0 |
| 10 | * |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT |
| 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | */ |
| 17 | |
| 18 | #pragma once |
| 19 | |
| 20 | /***************************************************************************** |
| 21 | * Includes |
| 22 | *****************************************************************************/ |
| 23 | |
| 24 | #include "message_handler.hpp" |
| 25 | |
| 26 | #include <inference_process.hpp> |
| 27 | |
| 28 | /***************************************************************************** |
Mikael Olsson | 918cd90 | 2023-12-13 09:57:42 +0100 | [diff] [blame] | 29 | * JobContext |
| 30 | *****************************************************************************/ |
| 31 | |
| 32 | struct JobContext; |
| 33 | |
| 34 | /***************************************************************************** |
Kristofer Jonsson | 3f5510f | 2023-02-08 14:23:00 +0100 | [diff] [blame] | 35 | * InferenceRunner |
| 36 | *****************************************************************************/ |
| 37 | |
| 38 | class InferenceRunner { |
| 39 | public: |
| 40 | InferenceRunner(uint8_t *tensorArena, |
| 41 | size_t arenaSize, |
| 42 | MessageHandler::InferenceQueue &inferenceQueue, |
| 43 | MessageHandler::ResponseQueue &responseQueue); |
| 44 | ~InferenceRunner(); |
| 45 | |
| 46 | private: |
| 47 | static void inferenceTask(void *param); |
| 48 | |
Mikael Olsson | 6870951 | 2024-02-12 13:30:31 +0100 | [diff] [blame^] | 49 | void |
| 50 | handleInferenceRequest(const uint32_t src, const uint64_t msgId, const EthosU::ethosu_rpmsg_inference_req &request); |
| 51 | InferenceProcess::InferenceJob makeInferenceJob(const EthosU::ethosu_rpmsg_inference_req &request, |
Mikael Olsson | 918cd90 | 2023-12-13 09:57:42 +0100 | [diff] [blame] | 52 | JobContext &context); |
Kristofer Jonsson | 3f5510f | 2023-02-08 14:23:00 +0100 | [diff] [blame] | 53 | |
| 54 | MessageHandler::InferenceQueue &inferenceQueue; |
| 55 | MessageHandler::ResponseQueue &responseQueue; |
| 56 | InferenceProcess::InferenceProcess inference; |
| 57 | |
| 58 | // FreeRTOS |
| 59 | TaskHandle_t taskHandle; |
| 60 | }; |