2 * Copyright (c) 2019 Samsung Electronics Co., Ltd. All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef __ONERT_EXEC_PARALLEL_EXECUTOR_H__
18 #define __ONERT_EXEC_PARALLEL_EXECUTOR_H__
22 #include <unordered_map>
24 #include "exec/FunctionSequence.h"
26 #include "ir/OperandIndexSequence.h"
29 #include "exec/DataflowExecutor.h"
30 #include "ParallelScheduler.h"
38 * @brief Class to execute Graph in parallel
40 class ParallelExecutor : public DataflowExecutor
43 void notify(uint32_t finished_job_id) override;
47 * @brief Constructs a ParallelExecutor object
49 * @param lowered_graph LoweredGraph object
50 * @param tensor_builders Tensor builders that are currently used
51 * @param code_map OpSequence and its code map
53 ParallelExecutor(std::unique_ptr<compiler::LoweredGraph> lowered_graph,
54 const std::vector<backend::ITensor *> &input_tensors,
55 const std::vector<backend::ITensor *> &output_tensors,
56 const compiler::TensorRegistries &tensor_regs, compiler::CodeMap &&code_map);
58 void executeImpl() override;
61 std::condition_variable _cv_jobs;
63 std::unique_ptr<ParallelScheduler> _scheduler;
69 #endif // __ONERT_EXEC_PARALLEL_EXECUTOR_H__