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_COMPILER_EXECUTOR_FACTORY_H__
18 #define __ONERT_COMPILER_EXECUTOR_FACTORY_H__
20 #include <unordered_map>
22 #include "backend/ITensor.h"
23 #include "exec/IExecutor.h"
24 #include "ir/LoweredGraph.h"
25 #include "TensorBuilders.h"
35 static ExecutorFactory &get();
38 exec::IExecutor *create(std::unique_ptr<ir::LoweredGraph> lowered_graph,
39 const compiler::CompilerOptions &options,
40 const std::shared_ptr<exec::ExecutorMap> &executor_map);
46 static void initializeBackendContext(ir::LoweredGraph *lowered_graph);
47 static void runTensorRegistration(ir::LoweredGraph *lowered_graph,
48 const std::vector<ir::OpSequenceIndex> &order);
49 static std::vector<std::shared_ptr<backend::ITensor>>
50 initializeModelIOTensors(ir::LoweredGraph &lowered_graph,
51 const ir::OperandIndexSequence &indices);
52 static void prepareExternalTensors(ir::LoweredGraph &lowered_graph,
53 TensorBuilders &tensor_builders);
54 static exec::IExecutor *
55 createLinearExecutor(std::unique_ptr<ir::LoweredGraph> lowered_graph,
56 const compiler::CompilerOptions &options,
57 const std::shared_ptr<exec::ExecutorMap> &executor_map);
58 static exec::IExecutor *
59 createDataflowExecutor(std::unique_ptr<ir::LoweredGraph> lowered_graph,
60 const compiler::CompilerOptions &options,
61 const std::shared_ptr<exec::ExecutorMap> &executor_map, bool parallel);
65 std::string, std::function<exec::IExecutor *(
66 std::unique_ptr<ir::LoweredGraph>, const compiler::CompilerOptions &options,
67 const std::shared_ptr<exec::ExecutorMap> &executor_map)>>
71 } // namespace compiler
74 #endif // __ONERT_COMPILER_EXECUTOR_FACTORY_H__