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/resource.h" 27 28 namespace mindspore { 29 namespace pipeline { 30 struct ExecutorInfo { 31 FuncGraphPtr func_graph; 32 // The grad graph of func_graph, it will create in PyNative mode when @ms_function is used. 33 FuncGraphPtr grad_graph; 34 ResourcePtr resource; 35 // The num of input data. 36 std::size_t arg_list_size; 37 // The all args of graph,including input data and weight. 38 VectorRef arg_list; 39 }; 40 using ExecutorInfoPtr = std::shared_ptr<ExecutorInfo>; 41 GetPhasePrefix(const std::string & phase)42inline std::string GetPhasePrefix(const std::string &phase) { 43 auto pos = phase.find('.'); 44 if (pos == std::string::npos) { 45 MS_LOG(EXCEPTION) << "Phase has no . for prefix" << phase; 46 } 47 return phase.substr(0, pos); 48 } 49 } // namespace pipeline 50 } // namespace mindspore 51 52 #endif // MINDSPORE_CCSRC_PIPELINE_JIT_BASE_H_ 53