Imported Upstream version 1.25.0
[platform/core/ml/nnfw.git] / runtime / onert / core / src / dumper / dot / DotDumper.h
1 /*
2  * Copyright (c) 2018 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 #include "ir/Graph.h"
18 #include "compiler/ILoweredGraph.h"
19
20 #ifndef __ONERT_DUMPER_DOT_DOT_DUMPER_H__
21 #define __ONERT_DUMPER_DOT_DOT_DUMPER_H__
22
23 namespace onert
24 {
25 namespace dumper
26 {
27 namespace dot
28 {
29
30 class DotDumper
31 {
32 public:
33   enum Level
34   {
35     OFF = 0,               //< Do not dump
36     ALL_BUT_CONSTANTS = 1, //< Emit all operations and operands but constants
37     ALL = 2                //< Emit all operations and operands
38   };
39
40 public:
41   DotDumper(Level level) : _level{level} {}
42
43 public:
44   /**
45    * @brief Dump graph information to dot file as tag name if "GRAPH_DOT_DUMP" is set
46    *
47    * @param[in] graph  The graph that would be used to get operations and operands
48    * @param[in] tag    The name of dot file that would be created
49    * @return N/A
50    */
51   void dump(const ir::Graph &graph, const std::string &tag);
52
53   /**
54    * @brief Dump lowered graph information to dot file as tag name if "GRAPH_DOT_DUMP" is set
55    *
56    * @param[in] graph  The graph that would be used to get operations and operands
57    * @param[in] tag    The name of dot file that would be created
58    * @return N/A
59    */
60   void dump(const compiler::ILoweredGraph &lowered_graph, const std::string &tag);
61
62 private:
63   Level _level;
64 };
65
66 } // namespace dot
67 } // namespace dumper
68 } // namespace onert
69
70 #endif // __ONERT_DUMPER_DOT_DOT_DUMPER_H__