• 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 PARALLEL_STEP_AUTO_PARALLEL_H_
18 #define PARALLEL_STEP_AUTO_PARALLEL_H_
19 
20 #include <map>
21 #include <memory>
22 #include <string>
23 #include <vector>
24 #include "frontend/optimizer/opt.h"
25 #include "frontend/parallel/status.h"
26 #include "ir/anf.h"
27 #include "pipeline/jit/pipeline.h"
28 
29 namespace mindspore {
30 namespace parallel {
31 // main step of Auto-parallel
32 bool StepAutoParallel(const FuncGraphPtr &func_graph, const opt::OptimizerPtr &optimizer);
33 
34 bool IsSplittableOperator(const std::string &);
35 
36 bool IsAutoParallelCareNode(const CNodePtr &);
37 
38 void InitCostGraph();
39 
40 Status ConstructCostGraphNodesByUniqueId(const std::vector<AnfNodePtr> &all_nodes, const FuncGraphPtr &root);
41 
42 Status ConstructCostGraphNodesByUniqueIdTC(const std::vector<AnfNodePtr> &all_nodes, const FuncGraphPtr &root);
43 
44 void ConstructCostGraphEdges(const std::vector<AnfNodePtr> &all_nodes);
45 
46 void AugmentCostGraph(const std::vector<AnfNodePtr> &all_nodes);
47 
48 Status ParallelStrategySearch(const std::vector<AnfNodePtr> &all_nodes, const FuncGraphPtr &root);
49 
50 Status ParallelStrategyRecSearch(const std::vector<AnfNodePtr> &all_nodes, const FuncGraphPtr &root);
51 
52 std::vector<std::vector<std::string>> RecInputTensorNames(const std::map<std::string, std::string>::iterator &it,
53                                                           std::vector<std::vector<std::string>> input_tensor_names);
54 
55 CNodePtr GetInternalOperatorInfo(const CNodePtr &cnode, const ValueNodePtr &prim_anf_node);
56 
57 void ModifyInputsTensorNameListIfOperatorInfoCreated(const std::string &name, const std::string &uniqueid);
58 }  // namespace parallel
59 }  // namespace mindspore
60 #endif  // PARALLEL_STEP_AUTO_PARALLEL_H_
61