• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2019-2024 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_PIPELINE_JIT_ACTION_H_
18 #define MINDSPORE_CCSRC_PIPELINE_JIT_ACTION_H_
19 
20 #include <vector>
21 #include <functional>
22 #include <utility>
23 #include <string>
24 #include "pipeline/jit/ps/resource.h"
25 #include "backend/graph_compiler/segment_runner.h"
26 #include "backend/graph_compiler/backend.h"
27 
28 namespace mindspore {
29 namespace pipeline {
30 using ActionItem = std::pair<std::string, std::function<bool(ResourcePtr)>>;
31 
32 bool BootstrapAction(const ResourcePtr &resource);
33 bool ParseAction(const ResourcePtr &resource);
34 bool SymbolResolveAction(const ResourcePtr &resource);
35 bool AutoMonadAction(const ResourcePtr &resource);
36 bool PreCConvAction(const ResourcePtr &resource);
37 bool TypeInferenceAction(const ResourcePtr &resource);
38 bool VmOptimizeAction(const ResourcePtr &resource);
39 bool TaskEmitAction(const ResourcePtr &resource);
40 bool ExecuteAction(const ResourcePtr &resource);
41 #if defined(__linux__) && defined(WITH_BACKEND)
42 bool StartPSSchedulerAction(const ResourcePtr &resource);
43 bool DistributedSplitAction(const ResourcePtr &resource);
44 #endif
45 
46 std::vector<ActionItem> VmPipeline(const ResourcePtr &resource, bool trace_flag = false, bool erase_parse = false);
47 std::vector<ActionItem> MindIRPipeline();
48 #if defined(__linux__) && defined(WITH_BACKEND)
49 std::vector<ActionItem> PSchedulerPipeline(const ResourcePtr &resource);
50 #endif
51 abstract::AnalysisResult AbstractAnalyze(const abstract::AnalysisEnginePtr &engine, const FuncGraphPtr &func_graph,
52                                          const abstract::AbstractBasePtrList &args_abs, bool is_load_resoure,
53                                          bool clear = false);
54 abstract::AnalysisResult AbstractAnalyze(const ValuePtr &value, const abstract::AbstractBasePtrList &args_abs,
55                                          bool clear = false);
56 
57 abstract::AnalysisResult AbstractAnalyzeWithResourceClean(const ValuePtr &value,
58                                                           const abstract::AbstractBasePtrList &args_abs);
59 
60 FuncGraphPtr ProgramSpecialize(const abstract::AnalysisEnginePtr &engine, const FuncGraphPtr &func_graph,
61                                const abstract::AnalysisContextPtr &context);
62 FuncGraphPtr Renormalize(const ResourcePtr &resource, const FuncGraphPtr &func_graph,
63                          const abstract::AbstractBasePtrList &args_abs);
64 FuncGraphPtr Renormalize(const ValuePtr &value, const abstract::AbstractBasePtrList &args_abs);
65 void SetRunMode(const FuncGraphPtr &func_graph, compile::Backend *backend_ptr, std::string *kbk_reason = nullptr);
66 bool IsDynamicShapeGraph(const FuncGraphPtr &func_graph);
67 AbstractBasePtr GetDefaultValueAbstract(const ParameterPtr &param);
68 }  // namespace pipeline
69 }  // namespace mindspore
70 
71 #endif  // MINDSPORE_CCSRC_PIPELINE_JIT_ACTION_H_
72