Imported Upstream version 1.18.0
[platform/core/ml/nnfw.git] / compiler / luci / plan / include / luci / Plan / CircleNodeExecutionPlan.h
1 /*
2  * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved
3  *
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
7  *
8  *    http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #ifndef __LUCI_CIRCLE_NODE_EXECUTION_PLAN_H__
18 #define __LUCI_CIRCLE_NODE_EXECUTION_PLAN_H__
19
20 #include <luci/IR/CircleNode.h>
21
22 #include <utility>
23
24 namespace luci
25 {
26
27 class CircleNodeExecutionPlan
28 {
29 public:
30   CircleNodeExecutionPlan() = delete;
31
32   CircleNodeExecutionPlan(uint32_t order_in_plan, std::vector<uint32_t> offsets)
33   {
34     _order_in_plan = order_in_plan;
35     _offsets = std::move(offsets);
36   }
37
38   uint32_t order_in_plan(void) const { return _order_in_plan; }
39   void order_in_plan(const uint32_t &order_in_plan) { _order_in_plan = order_in_plan; }
40
41   std::vector<uint32_t> offsets(void) const { return _offsets; }
42   void offsets(const std::vector<uint32_t> &offsets) { _offsets = offsets; }
43
44 private:
45   uint32_t _order_in_plan = 0;
46   std::vector<uint32_t> _offsets;
47 };
48
49 bool has_execution_plan(const luci::CircleNode *circle_node);
50
51 void add_execution_plan(luci::CircleNode *circle_node,
52                         const luci::CircleNodeExecutionPlan &execution_plan);
53
54 luci::CircleNodeExecutionPlan get_execution_plan(const luci::CircleNode *circle_node);
55
56 } // namespace luci
57
58 #endif // __LUCI_CIRCLE_NODE_EXECUTION_PLAN_H__