• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2019 Huawei Technologies Co., Ltd
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 MINDSPORE_CORE_UTILS_TRACE_INFO_H_
18 #define MINDSPORE_CORE_UTILS_TRACE_INFO_H_
19 
20 #include <iostream>
21 #include <string>
22 #include <memory>
23 #include <stack>
24 #include <utility>
25 #include <vector>
26 
27 #include "base/base.h"
28 
29 namespace mindspore {
30 class TraceInfo;
31 using TraceInfoPtr = std::shared_ptr<TraceInfo>;
32 class Location;
33 using LocationPtr = std::shared_ptr<Location>;
34 class DebugInfo;
35 using DebugInfoPtr = std::shared_ptr<DebugInfo>;
36 
37 // namespace to support intermediate representation definition
38 class TraceInfo : public Base {
39  public:
TraceInfo(const DebugInfoPtr & info,const std::string & full_name,const std::string & symbol)40   TraceInfo(const DebugInfoPtr &info, const std::string &full_name, const std::string &symbol) {
41     symbol_ = symbol;
42     full_name_ = full_name;
43     name_ = full_name_;
44     debug_info_ = info;
45   }
TraceInfo(const TraceInfo & info)46   TraceInfo(const TraceInfo &info)
47       : Base(), debug_info_(info.debug_info_), symbol_(info.symbol_), full_name_(info.full_name_), name_(info.name_) {}
48   ~TraceInfo() override = default;
49   MS_DECLARE_PARENT(TraceInfo, Base);
name()50   virtual std::string name() const { return name_; }
symbol()51   virtual std::string symbol() const { return symbol_; }
full_name()52   virtual std::string full_name() const { return full_name_; }
clone()53   virtual TraceInfoPtr clone() { return shared_from_base<TraceInfo>(); }
action_name()54   virtual std::string action_name() const { return ""; }
55   virtual std::string GetActionBetweenNode(const DebugInfoPtr &info) const;
set_debug_info(const DebugInfoPtr & info)56   void set_debug_info(const DebugInfoPtr &info) { debug_info_ = info; }
debug_info()57   DebugInfoPtr debug_info() const { return debug_info_; }
58 
59  protected:
60   DebugInfoPtr debug_info_;
61   std::string symbol_;
62   std::string full_name_;
63   std::string name_;
64 };
65 
66 class TracePhi : public TraceInfo {
67  public:
TracePhi(const DebugInfoPtr & info)68   explicit TracePhi(const DebugInfoPtr &info) : TraceInfo(info, "phi", "Φ") {}
69   MS_DECLARE_PARENT(TracePhi, TraceInfo);
70   ~TracePhi() override = default;
clone()71   TraceInfoPtr clone() override { return std::make_shared<TracePhi>(*shared_from_base<TracePhi>()); }
72 };
73 
74 class TraceIfStmtTrueBranch : public TraceInfo {
75  public:
76   TraceIfStmtTrueBranch(const TraceIfStmtTrueBranch &) = default;
TraceIfStmtTrueBranch(const DebugInfoPtr & info)77   explicit TraceIfStmtTrueBranch(const DebugInfoPtr &info) : TraceInfo(info, "if_true", "✓") {}
78   MS_DECLARE_PARENT(TraceIfStmtTrueBranch, TraceInfo);
79   ~TraceIfStmtTrueBranch() override = default;
clone()80   TraceInfoPtr clone() override {
81     return std::make_shared<TraceIfStmtTrueBranch>(*shared_from_base<TraceIfStmtTrueBranch>());
82   }
83 };
84 
85 class TraceIfStmtFalseBranch : public TraceInfo {
86  public:
87   TraceIfStmtFalseBranch(const TraceIfStmtFalseBranch &) = default;
TraceIfStmtFalseBranch(const DebugInfoPtr & info)88   explicit TraceIfStmtFalseBranch(const DebugInfoPtr &info) : TraceInfo(info, "if_false", "✗") {}
89   MS_DECLARE_PARENT(TraceIfStmtFalseBranch, TraceInfo);
90   ~TraceIfStmtFalseBranch() override = default;
clone()91   TraceInfoPtr clone() override {
92     return std::make_shared<TraceIfStmtFalseBranch>(*shared_from_base<TraceIfStmtFalseBranch>());
93   }
94 };
95 
96 class TraceIfStmtAfterBranch : public TraceInfo {
97  public:
TraceIfStmtAfterBranch(const DebugInfoPtr & info)98   explicit TraceIfStmtAfterBranch(const DebugInfoPtr &info) : TraceInfo(info, "if_after", "↓") {}
99   MS_DECLARE_PARENT(TraceIfStmtAfterBranch, TraceInfo);
100   ~TraceIfStmtAfterBranch() override = default;
clone()101   TraceInfoPtr clone() override {
102     return std::make_shared<TraceIfStmtAfterBranch>(*shared_from_base<TraceIfStmtAfterBranch>());
103   }
104 };
105 
106 class TraceIfExpTrueBranch : public TraceInfo {
107  public:
TraceIfExpTrueBranch(const DebugInfoPtr & info)108   explicit TraceIfExpTrueBranch(const DebugInfoPtr &info) : TraceInfo(info, "ifexp_true", "↰") {}
109   MS_DECLARE_PARENT(TraceIfExpTrueBranch, TraceInfo);
110   ~TraceIfExpTrueBranch() override = default;
clone()111   TraceInfoPtr clone() override {
112     return std::make_shared<TraceIfExpTrueBranch>(*shared_from_base<TraceIfExpTrueBranch>());
113   }
114 };
115 
116 class TraceIfExpFalseBranch : public TraceInfo {
117  public:
TraceIfExpFalseBranch(const DebugInfoPtr & info)118   explicit TraceIfExpFalseBranch(const DebugInfoPtr &info) : TraceInfo(info, "ifexp_false", "↱") {}
119   MS_DECLARE_PARENT(TraceIfExpFalseBranch, TraceInfo);
120   ~TraceIfExpFalseBranch() override = default;
clone()121   TraceInfoPtr clone() override {
122     return std::make_shared<TraceIfExpFalseBranch>(*shared_from_base<TraceIfExpFalseBranch>());
123   }
124 };
125 
126 class TraceCopy : public TraceInfo {
127  public:
TraceCopy()128   TraceCopy() : TraceInfo(nullptr, "copy", "") {}
TraceCopy(const DebugInfoPtr & info)129   explicit TraceCopy(const DebugInfoPtr &info) : TraceInfo(info, "copy", "") {}
130   MS_DECLARE_PARENT(TraceCopy, TraceInfo);
131   ~TraceCopy() override = default;
clone()132   TraceInfoPtr clone() override { return std::make_shared<TraceCopy>(*shared_from_base<TraceCopy>()); }
133 };
134 
135 class TraceIterator : public TraceInfo {
136  public:
TraceIterator(const DebugInfoPtr & info)137   explicit TraceIterator(const DebugInfoPtr &info) : TraceInfo(info, "iterator", "@") {}
138   MS_DECLARE_PARENT(TraceIterator, TraceInfo);
139   ~TraceIterator() override = default;
clone()140   TraceInfoPtr clone() override { return std::make_shared<TraceIterator>(*shared_from_base<TraceIterator>()); }
141 };
142 
143 class TraceWhileHeader : public TraceInfo {
144  public:
TraceWhileHeader(const DebugInfoPtr & info)145   explicit TraceWhileHeader(const DebugInfoPtr &info) : TraceInfo(info, "while_header", "⤾") {}
146   MS_DECLARE_PARENT(TraceWhileHeader, TraceInfo);
147   ~TraceWhileHeader() override = default;
clone()148   TraceInfoPtr clone() override { return std::make_shared<TraceWhileHeader>(*shared_from_base<TraceWhileHeader>()); }
149 };
150 
151 class TraceWhileBody : public TraceInfo {
152  public:
TraceWhileBody(const DebugInfoPtr & info)153   explicit TraceWhileBody(const DebugInfoPtr &info) : TraceInfo(info, "while_body", "⥁") {}
154   MS_DECLARE_PARENT(TraceWhileBody, TraceInfo);
155   ~TraceWhileBody() override = default;
clone()156   TraceInfoPtr clone() override { return std::make_shared<TraceWhileBody>(*shared_from_base<TraceWhileBody>()); }
157 };
158 
159 class TraceWhileAfter : public TraceInfo {
160  public:
TraceWhileAfter(const DebugInfoPtr & info)161   explicit TraceWhileAfter(const DebugInfoPtr &info) : TraceInfo(info, "while_after", "↓") {}
162   MS_DECLARE_PARENT(TraceWhileAfter, TraceInfo);
163   ~TraceWhileAfter() override = default;
clone()164   TraceInfoPtr clone() override { return std::make_shared<TraceWhileAfter>(*shared_from_base<TraceWhileAfter>()); }
165 };
166 
167 class TraceForHeader : public TraceInfo {
168  public:
TraceForHeader(const DebugInfoPtr & info)169   explicit TraceForHeader(const DebugInfoPtr &info) : TraceInfo(info, "for_header", "⤾") {}
170   MS_DECLARE_PARENT(TraceForHeader, TraceInfo);
171   ~TraceForHeader() override = default;
clone()172   TraceInfoPtr clone() override { return std::make_shared<TraceForHeader>(*shared_from_base<TraceForHeader>()); }
173 };
174 
175 class TraceForBody : public TraceInfo {
176  public:
TraceForBody(const DebugInfoPtr & info)177   explicit TraceForBody(const DebugInfoPtr &info) : TraceInfo(info, "for_body", "⥁") {}
178   MS_DECLARE_PARENT(TraceForBody, TraceInfo);
179   ~TraceForBody() override = default;
clone()180   TraceInfoPtr clone() override { return std::make_shared<TraceForBody>(*shared_from_base<TraceForBody>()); }
181 };
182 
183 class TraceForAfter : public TraceInfo {
184  public:
TraceForAfter(const DebugInfoPtr & info)185   explicit TraceForAfter(const DebugInfoPtr &info) : TraceInfo(info, "for_after", "↓") {}
186   MS_DECLARE_PARENT(TraceForAfter, TraceInfo);
187   ~TraceForAfter() override = default;
clone()188   TraceInfoPtr clone() override { return std::make_shared<TraceForAfter>(*shared_from_base<TraceForAfter>()); }
189 };
190 
191 class TraceLoopEnd : public TraceInfo {
192  public:
TraceLoopEnd(const DebugInfoPtr & info)193   explicit TraceLoopEnd(const DebugInfoPtr &info) : TraceInfo(info, "loop_end", "↓↓") {}
194   MS_DECLARE_PARENT(TraceLoopEnd, TraceInfo);
195   ~TraceLoopEnd() override = default;
clone()196   TraceInfoPtr clone() override { return std::make_shared<TraceLoopEnd>(*shared_from_base<TraceLoopEnd>()); }
197 };
198 
199 class TraceEquiv : public TraceInfo {
200  public:
TraceEquiv(const DebugInfoPtr & info)201   explicit TraceEquiv(const DebugInfoPtr &info) : TraceInfo(info, "equiv", "equiv") {}
202   MS_DECLARE_PARENT(TraceEquiv, TraceInfo);
203   ~TraceEquiv() override = default;
clone()204   TraceInfoPtr clone() override { return std::make_shared<TraceEquiv>(*shared_from_base<TraceEquiv>()); }
205 };
206 
207 class TraceGradFpropApp : public TraceInfo {
208  public:
TraceGradFpropApp()209   TraceGradFpropApp() : TraceInfo(nullptr, "grad_fprop_app", "▲") {}
TraceGradFpropApp(const DebugInfoPtr & info)210   explicit TraceGradFpropApp(const DebugInfoPtr &info) : TraceInfo(info, "grad_fprop_app", "▲") {}
211   MS_DECLARE_PARENT(TraceGradFpropApp, TraceInfo);
212   ~TraceGradFpropApp() override = default;
clone()213   TraceInfoPtr clone() override { return std::make_shared<TraceGradFpropApp>(*shared_from_base<TraceGradFpropApp>()); }
214 };
215 
216 class TraceGradBpropApp : public TraceInfo {
217  public:
TraceGradBpropApp()218   TraceGradBpropApp() : TraceInfo(nullptr, "grad_bprop_app", "▼") {}
TraceGradBpropApp(const DebugInfoPtr & info)219   explicit TraceGradBpropApp(const DebugInfoPtr &info) : TraceInfo(info, "grad_bprop_app", "▼") {}
220   MS_DECLARE_PARENT(TraceGradBpropApp, TraceInfo);
221   ~TraceGradBpropApp() override = default;
clone()222   TraceInfoPtr clone() override { return std::make_shared<TraceGradBpropApp>(*shared_from_base<TraceGradBpropApp>()); }
223 };
224 
225 class TraceGradFprop : public TraceInfo {
226  public:
TraceGradFprop()227   TraceGradFprop() : TraceInfo(nullptr, "grad_fprop", "▶") {}
TraceGradFprop(const DebugInfoPtr & info)228   explicit TraceGradFprop(const DebugInfoPtr &info) : TraceInfo(info, "grad_fprop", "▶") {}
229   MS_DECLARE_PARENT(TraceGradFprop, TraceInfo);
230   ~TraceGradFprop() override = default;
clone()231   TraceInfoPtr clone() override { return std::make_shared<TraceGradFprop>(*shared_from_base<TraceGradFprop>()); }
232 };
233 
234 class TraceGradBprop : public TraceInfo {
235  public:
TraceGradBprop()236   TraceGradBprop() : TraceInfo(nullptr, "grad_bprop", "◀") {}
TraceGradBprop(const DebugInfoPtr & info)237   explicit TraceGradBprop(const DebugInfoPtr &info) : TraceInfo(info, "grad_bprop", "◀") {}
238   MS_DECLARE_PARENT(TraceGradBprop, TraceInfo);
239   ~TraceGradBprop() override = default;
clone()240   TraceInfoPtr clone() override { return std::make_shared<TraceGradBprop>(*shared_from_base<TraceGradBprop>()); }
241 };
242 
243 class TraceGradSens : public TraceInfo {
244  public:
TraceGradSens()245   TraceGradSens() : TraceInfo(nullptr, "grad_sens", "∇") {}
TraceGradSens(const DebugInfoPtr & info)246   explicit TraceGradSens(const DebugInfoPtr &info) : TraceInfo(info, "grad_sens", "∇") {}
247   MS_DECLARE_PARENT(TraceGradSens, TraceInfo);
248   ~TraceGradSens() override = default;
clone()249   TraceInfoPtr clone() override { return std::make_shared<TraceGradSens>(*shared_from_base<TraceGradSens>()); }
250 };
251 
252 class TraceSpecialize : public TraceInfo {
253  public:
TraceSpecialize(const std::string & counter)254   explicit TraceSpecialize(const std::string &counter) : TraceInfo(nullptr, "specialize", "") { counter_ = counter; }
255   MS_DECLARE_PARENT(TraceSpecialize, TraceInfo);
name()256   std::string name() const override { return full_name_ + counter_; }
symbol()257   std::string symbol() const override { return counter_ + "_"; }
full_name()258   std::string full_name() const override { return full_name_ + counter_ + "_"; }
259   ~TraceSpecialize() override = default;
clone()260   TraceInfoPtr clone() override { return std::make_shared<TraceSpecialize>(*shared_from_base<TraceSpecialize>()); }
261 
262  private:
263   std::string counter_;
264 };
265 
266 class TraceGradOperation : public TraceInfo {
267  public:
TraceGradOperation(const DebugInfoPtr & info)268   explicit TraceGradOperation(const DebugInfoPtr &info) : TraceInfo(info, "grad_ops", "") {}
269   MS_DECLARE_PARENT(TraceGradOperation, TraceInfo);
270   ~TraceGradOperation() override = default;
clone()271   TraceInfoPtr clone() override {
272     return std::make_shared<TraceGradOperation>(*shared_from_base<TraceGradOperation>());
273   }
274 };
275 
276 class TraceForceBool : public TraceInfo {
277  public:
TraceForceBool(const DebugInfoPtr & info)278   explicit TraceForceBool(const DebugInfoPtr &info) : TraceInfo(info, "force_bool", "") {}
279   MS_DECLARE_PARENT(TraceForceBool, TraceInfo);
280   ~TraceForceBool() override = default;
clone()281   TraceInfoPtr clone() override { return std::make_shared<TraceForceBool>(*shared_from_base<TraceForceBool>()); }
282 };
283 
284 class TraceForceWhileCond : public TraceInfo {
285  public:
TraceForceWhileCond(const DebugInfoPtr & info)286   explicit TraceForceWhileCond(const DebugInfoPtr &info) : TraceInfo(info, "force_while_cond", "") {}
287   MS_DECLARE_PARENT(TraceForceWhileCond, TraceInfo);
288   ~TraceForceWhileCond() override = default;
clone()289   TraceInfoPtr clone() override {
290     return std::make_shared<TraceForceWhileCond>(*shared_from_base<TraceForceWhileCond>());
291   }
292 };
293 
294 class TraceExpandJ : public TraceInfo {
295  public:
TraceExpandJ(const DebugInfoPtr & info)296   explicit TraceExpandJ(const DebugInfoPtr &info) : TraceInfo(info, "expand_j", "") {}
297   MS_DECLARE_PARENT(TraceExpandJ, TraceInfo);
298   ~TraceExpandJ() override = default;
clone()299   TraceInfoPtr clone() override { return std::make_shared<TraceExpandJ>(*shared_from_base<TraceExpandJ>()); }
300 };
301 
302 class TraceGenMetaFuncGraph : public TraceInfo {
303  public:
TraceGenMetaFuncGraph(const DebugInfoPtr & info)304   explicit TraceGenMetaFuncGraph(const DebugInfoPtr &info) : TraceInfo(info, "GenMetaFuncGraph", "") {}
305   MS_DECLARE_PARENT(TraceGenMetaFuncGraph, TraceInfo);
306   ~TraceGenMetaFuncGraph() override = default;
clone()307   TraceInfoPtr clone() override {
308     return std::make_shared<TraceGenMetaFuncGraph>(*shared_from_base<TraceGenMetaFuncGraph>());
309   }
310 };
311 
312 class TraceEvaluatorGenGraph : public TraceInfo {
313  public:
TraceEvaluatorGenGraph(const DebugInfoPtr & info)314   explicit TraceEvaluatorGenGraph(const DebugInfoPtr &info) : TraceInfo(info, "GenEvaluatorGraph", "") {}
315   MS_DECLARE_PARENT(TraceEvaluatorGenGraph, TraceInfo);
316   ~TraceEvaluatorGenGraph() override = default;
clone()317   TraceInfoPtr clone() override {
318     return std::make_shared<TraceEvaluatorGenGraph>(*shared_from_base<TraceEvaluatorGenGraph>());
319   }
320 };
321 
322 class TraceResolve : public TraceInfo {
323  public:
TraceResolve(const DebugInfoPtr & info)324   explicit TraceResolve(const DebugInfoPtr &info) : TraceInfo(info, "resolve", "") {}
325   MS_DECLARE_PARENT(TraceResolve, TraceInfo);
326   ~TraceResolve() override = default;
clone()327   TraceInfoPtr clone() override { return std::make_shared<TraceResolve>(*shared_from_base<TraceResolve>()); }
328 };
329 
330 class TraceTransform : public TraceInfo {
331  public:
TraceTransform()332   TraceTransform() : TraceInfo(nullptr, "transform", "") { transform_name_ = ""; }
TraceTransform(const std::string & transform_name)333   explicit TraceTransform(const std::string &transform_name) : TraceInfo(nullptr, "transform", "") {
334     transform_name_ = transform_name;
335   }
336 
full_name()337   std::string full_name() const override { return full_name_ + transform_name_; }
338   MS_DECLARE_PARENT(TraceTransform, TraceInfo);
symbol()339   std::string symbol() const override {
340     if (transform_name_.empty()) {
341       return "";
342     }
343     return transform_name_ + "_";
344   }
345 
346   ~TraceTransform() override = default;
clone()347   TraceInfoPtr clone() override { return std::make_shared<TraceTransform>(*shared_from_base<TraceTransform>()); }
348   std::string transform_name_;
349 };
350 
351 class TraceGenerateVarArg : public TraceInfo {
352  public:
TraceGenerateVarArg(const DebugInfoPtr & info)353   explicit TraceGenerateVarArg(const DebugInfoPtr &info) : TraceInfo(info, "GenerateVarArg", "") {}
354   MS_DECLARE_PARENT(TraceGenerateVarArg, TraceInfo);
355   ~TraceGenerateVarArg() override = default;
clone()356   TraceInfoPtr clone() override {
357     return std::make_shared<TraceGenerateVarArg>(*shared_from_base<TraceGenerateVarArg>());
358   }
359 };
360 
361 class TraceGenerateKwArg : public TraceInfo {
362  public:
TraceGenerateKwArg(const DebugInfoPtr & info)363   explicit TraceGenerateKwArg(const DebugInfoPtr &info) : TraceInfo(info, "GenerateKwArg", "") {}
364   MS_DECLARE_PARENT(TraceGenerateKwArg, TraceInfo);
365   ~TraceGenerateKwArg() override = default;
clone()366   TraceInfoPtr clone() override {
367     return std::make_shared<TraceGenerateKwArg>(*shared_from_base<TraceGenerateKwArg>());
368   }
369 };
370 
371 class TraceTrasformK : public TraceInfo {
372  public:
TraceTrasformK(const DebugInfoPtr & info)373   explicit TraceTrasformK(const DebugInfoPtr &info) : TraceInfo(info, "TraceTrasformK", "") {}
374   MS_DECLARE_PARENT(TraceTrasformK, TraceInfo);
375   ~TraceTrasformK() override = default;
clone()376   TraceInfoPtr clone() override { return std::make_shared<TraceTrasformK>(*shared_from_base<TraceTrasformK>()); }
377 };
378 
379 class TracePartialTransform : public TraceInfo {
380  public:
TracePartialTransform(const DebugInfoPtr & info)381   explicit TracePartialTransform(const DebugInfoPtr &info) : TraceInfo(info, "PartialTransform", "") {}
382   MS_DECLARE_PARENT(TracePartialTransform, TraceInfo);
383   ~TracePartialTransform() override = default;
clone()384   TraceInfoPtr clone() override {
385     return std::make_shared<TracePartialTransform>(*shared_from_base<TracePartialTransform>());
386   }
387 };
388 
389 class TraceGetEnv : public TraceInfo {
390  public:
TraceGetEnv(const DebugInfoPtr & info)391   explicit TraceGetEnv(const DebugInfoPtr &info) : TraceInfo(info, "get_env", "") {}
392   MS_DECLARE_PARENT(TraceGetEnv, TraceInfo);
393   ~TraceGetEnv() override = default;
clone()394   TraceInfoPtr clone() override { return std::make_shared<TraceGetEnv>(*shared_from_base<TraceGetEnv>()); }
395 };
396 
397 class TraceDoSignature : public TraceInfo {
398  public:
TraceDoSignature(const DebugInfoPtr & info)399   explicit TraceDoSignature(const DebugInfoPtr &info) : TraceInfo(info, "DoSignature", "") {}
400   MS_DECLARE_PARENT(TraceDoSignature, TraceInfo);
401   ~TraceDoSignature() override = default;
clone()402   TraceInfoPtr clone() override { return std::make_shared<TraceDoSignature>(*shared_from_base<TraceDoSignature>()); }
403 };
404 
405 class TraceCombileLikeGraphs : public TraceInfo {
406  public:
TraceCombileLikeGraphs()407   TraceCombileLikeGraphs() : TraceInfo(nullptr, "CombileLike", "L-") {}
TraceCombileLikeGraphs(const DebugInfoPtr & info)408   explicit TraceCombileLikeGraphs(const DebugInfoPtr &info) : TraceInfo(info, "CombileLike", "L-") {}
409   MS_DECLARE_PARENT(TraceCombileLikeGraphs, TraceInfo);
410   ~TraceCombileLikeGraphs() override = default;
clone()411   TraceInfoPtr clone() override {
412     return std::make_shared<TraceCombileLikeGraphs>(*shared_from_base<TraceCombileLikeGraphs>());
413   }
414 };
415 
416 class TraceSegmentTransform : public TraceInfo {
417  public:
TraceSegmentTransform(const DebugInfoPtr & info)418   explicit TraceSegmentTransform(const DebugInfoPtr &info) : TraceInfo(info, "segment_transform", "") {}
419   MS_DECLARE_PARENT(TraceSegmentTransform, TraceInfo);
420   ~TraceSegmentTransform() override = default;
clone()421   TraceInfoPtr clone() override {
422     return std::make_shared<TraceSegmentTransform>(*shared_from_base<TraceSegmentTransform>());
423   }
424 };
425 
426 class TraceOpt : public TraceInfo {
427  public:
TraceOpt(const DebugInfoPtr & info)428   explicit TraceOpt(const DebugInfoPtr &info) : TraceInfo(info, "opt", "") {}
429   MS_DECLARE_PARENT(TraceOpt, TraceInfo);
430   ~TraceOpt() override = default;
clone()431   TraceInfoPtr clone() override { return std::make_shared<TraceOpt>(*shared_from_base<TraceOpt>()); }
432 };
433 
434 class TraceListComp : public TraceInfo {
435  public:
TraceListComp(const DebugInfoPtr & info)436   explicit TraceListComp(const DebugInfoPtr &info) : TraceInfo(info, "ListComp", "G-") {}
437   MS_DECLARE_PARENT(TraceListComp, TraceInfo);
438   ~TraceListComp() override = default;
clone()439   TraceInfoPtr clone() override { return std::make_shared<TraceListComp>(*shared_from_base<TraceListComp>()); }
440 };
441 }  // namespace mindspore
442 
443 #endif  // MINDSPORE_CORE_UTILS_TRACE_INFO_H_
444