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_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/resource.h" 25 #include "vm/segment_runner.h" 26 27 namespace mindspore { 28 extern const char kMsConvert[]; 29 30 namespace pipeline { 31 using ActionItem = std::pair<std::string, std::function<bool(ResourcePtr)>>; 32 33 bool ParseAction(const ResourcePtr &res); 34 bool SymbolResolveAction(const ResourcePtr &res); 35 bool AutoMonadAction(const ResourcePtr &res); 36 bool AbstractSpecializeAction(const ResourcePtr &res); 37 bool GeOptimizeAction(const ResourcePtr &res); 38 bool VmOptimizeAction(const ResourcePtr &res); 39 bool PynativeElimOpt(const ResourcePtr &res); 40 bool TaskEmitAction(const ResourcePtr &res); 41 bool ExecuteAction(const ResourcePtr &res); 42 bool StartPSWorkerAction(const ResourcePtr &res); 43 bool StartFLWorkerAction(const ResourcePtr &res); 44 bool StartPSServerAction(const ResourcePtr &res); 45 bool StartPSSchedulerAction(const ResourcePtr &res); 46 // This action is only for federated learning only. In later version, parameter server mode and federated learning will 47 // use the same action. 48 bool StartServerAction(const ResourcePtr &res); 49 50 std::vector<ActionItem> GePipeline(); 51 std::vector<ActionItem> VmPipeline(); 52 std::vector<ActionItem> MindIRPipeline(); 53 std::vector<ActionItem> BackendPipeline(); 54 std::vector<ActionItem> PServerPipeline(); 55 std::vector<ActionItem> ServerPipeline(); 56 std::vector<ActionItem> PSchedulerPipeline(); 57 abstract::AnalysisResult AbstractAnalyze(const ResourcePtr &res, const FuncGraphPtr &func_graph, 58 const abstract::AbstractBasePtrList &args_spec, bool clear = false); 59 FuncGraphPtr ProgramSpecialize(const ResourcePtr &res, const FuncGraphPtr &func_graph, 60 const abstract::AnalysisContextPtr &context); 61 FuncGraphPtr Renormalize(const ResourcePtr &res, const FuncGraphPtr &func_graph, 62 const abstract::AbstractBasePtrList &args_spec); 63 } // namespace pipeline 64 } // namespace mindspore 65 66 #endif // MINDSPORE_CCSRC_PIPELINE_JIT_ACTION_H_ 67