1 /** 2 * Copyright 2020 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_BASE_H_ 18 #define MINDSPORE_CCSRC_PIPELINE_JIT_BASE_H_ 19 20 #include <mutex> 21 #include <memory> 22 #include <string> 23 #include <sstream> 24 25 #include "ir/anf.h" 26 #include "pipeline/jit/ps/resource.h" 27 28 namespace mindspore { 29 namespace pipeline { 30 struct ExecutorInfo { 31 FuncGraphPtr jit_primal_func_graph{nullptr}; 32 FuncGraphPtr func_graph{nullptr}; 33 // The grad graph of func_graph, it will create in PyNative mode when @jit is used. 34 FuncGraphPtr jit_grad_graph{nullptr}; 35 ResourcePtr resource{nullptr}; 36 // The num of input data. 37 std::size_t arg_list_size; 38 // The all args of graph,including input data and weight. 39 VectorRef arg_list; 40 }; 41 using ExecutorInfoPtr = std::shared_ptr<ExecutorInfo>; 42 GetPhasePrefix(const std::string & phase)43inline std::string GetPhasePrefix(const std::string &phase) { 44 auto pos = phase.find('.'); 45 if (pos == std::string::npos) { 46 MS_LOG(INTERNAL_EXCEPTION) << "Phase has no . for prefix" << phase; 47 } 48 return phase.substr(0, pos); 49 } 50 } // namespace pipeline 51 } // namespace mindspore 52 53 #endif // MINDSPORE_CCSRC_PIPELINE_JIT_BASE_H_ 54