• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2021-2022 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_CCSRC_RUNTIME_FRAMEWORK_ACTOR_ACTOR_DUMP_H_
18 #define MINDSPORE_CCSRC_RUNTIME_FRAMEWORK_ACTOR_ACTOR_DUMP_H_
19 
20 #include <vector>
21 #include <string>
22 #include <memory>
23 #include <fstream>
24 #include <tuple>
25 #include "runtime/graph_scheduler/actor/abstract_actor.h"
26 #include "runtime/graph_scheduler/actor/data_prepare_actor.h"
27 #include "runtime/graph_scheduler/actor/data_source_actor.h"
28 #include "runtime/graph_scheduler/actor/loop_count_actor.h"
29 #include "runtime/graph_scheduler/actor/kernel_actor.h"
30 #include "runtime/graph_scheduler/actor/super_kernel_actor.h"
31 #include "runtime/graph_scheduler/actor/output_actor.h"
32 #include "runtime/graph_scheduler/actor/copy_actor.h"
33 #include "runtime/graph_scheduler/actor/custom_actor.h"
34 #include "runtime/graph_scheduler/actor/fusion/fusion_actor.h"
35 #include "runtime/graph_scheduler/actor/memory/memory_swap_actor.h"
36 #include "runtime/graph_scheduler/actor/memory/memory_alloc_actor.h"
37 #include "runtime/graph_scheduler/actor/memory/memory_free_actor.h"
38 #include "runtime/graph_scheduler/actor/control_flow/control_actor.h"
39 #include "runtime/graph_scheduler/actor/control_flow/switch_actor.h"
40 #include "runtime/graph_scheduler/actor/control_flow/gather_actor.h"
41 #include "runtime/graph_scheduler/actor/control_flow/entrance_actor.h"
42 #include "runtime/graph_scheduler/actor/control_flow/exit_actor.h"
43 #include "runtime/graph_scheduler/actor/control_flow/stack_actor.h"
44 #include "runtime/graph_scheduler/control_node_scheduler.h"
45 
46 namespace mindspore {
47 namespace runtime {
48 void DumpDataPrepareActor(const DataPrepareActorPtr &actor, std::ofstream &ofs);
49 void DumpLoopCountActor(const LoopCountActorPtr &actor, std::ofstream &ofs);
50 void DumpOutputActor(const OutputActorPtr &actor, std::ofstream &ofs);
51 void DumpDSActors(const std::vector<DataSourceActorPtr> &actors, std::ofstream &ofs);
52 void DumpKernelActors(const std::vector<KernelActorPtr> &actors, std::ofstream &ofs);
53 void DumpKernelInferActors(const std::vector<KernelInferActorPtr> &actors, std::ofstream &ofs);
54 void DumpKernelResizeActors(const std::vector<KernelResizeActorPtr> &actors, std::ofstream &ofs);
55 void DumpSuperKernelActors(const std::vector<SuperKernelActorPtr> &actors, std::ofstream &ofs);
56 void DumpAnyTypeKernelActors(const std::vector<AnyTypeKernelActorPtr> &actors, std::ofstream &ofs);
57 void DumpNoInputKernelActors(const std::vector<AbstractActorPtr> &actors, std::ofstream &ofs);
58 void DumpMemoryActors(const std::vector<MemoryAwareActorPtr> &actors, std::ofstream &ofs);
59 void DumpCopyActors(const std::vector<CopyActorPtr> &actors, std::ofstream &ofs);
60 void DumpFusionActors(const std::vector<FusionActorPtr> &actors, std::ofstream &ofs);
61 void DumpControlActors(const ControlActorSetPtr &control_actor_set, std::ofstream &ofs);
62 void DumpCustomActors(const std::vector<CustomActorPtr> &actors, std::ofstream &ofs);
63 void DumpSwapActors(const std::vector<std::vector<MemSwapActorPtr>> &actors, std::ofstream &ofs);
64 
65 using ActorInfoMap =
66   mindspore::HashMap<AbstractActor *, std::tuple<size_t, std::vector<BaseShapePtr>, std::vector<TypePtr>>>;
67 std::vector<AbstractActor *> TopoSortForActor(AbstractActor *root);
68 void DumpActorInfo(AbstractActor *actor, size_t index, ActorInfoMap *actor_info, std::ofstream &ofs);
69 }  // namespace runtime
70 }  // namespace mindspore
71 
72 #endif  // MINDSPORE_CCSRC_RUNTIME_FRAMEWORK_ACTOR_ACTOR_DUMP_H_
73