• 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 MINDSPORE_CCSRC_PIPELINE_JIT_PASS_H_
18 #define MINDSPORE_CCSRC_PIPELINE_JIT_PASS_H_
19 
20 #include <vector>
21 #include <functional>
22 #include <utility>
23 #include <string>
24 #include "pipeline/jit/resource.h"
25 
26 namespace mindspore {
27 namespace opt {
28 namespace irpass {
29 class OptimizeIRPassLib;
30 }  // namespace irpass
31 }  // namespace opt
32 
33 namespace pipeline {
34 using PassItem = std::pair<std::string, std::function<bool(ResourcePtr)>>;
35 
36 extern std::vector<PassItem> kGePasses;
37 extern std::vector<PassItem> kVmPasses;
38 extern std::vector<PassItem> kInlinePasses;
39 extern std::vector<PassItem> kPynativePasses;
40 
41 bool CconvPass(const ResourcePtr &res);
42 bool PipelineSplitPass(const ResourcePtr &res);
43 bool ValidatePass(const ResourcePtr &res);
44 bool ConvertPrepareAdapt(const ResourcePtr &res);
45 bool AddCacheEmbeddingPass(const ResourcePtr &res);
46 bool InferenceOptPreparePass(const ResourcePtr &res);
47 void ReclaimOptimizer();
48 bool PynativeOptPass(const ResourcePtr &res);
49 bool AutoMonadElimOptPass(const FuncGraphPtr &func_graph);
50 FuncGraphPtr PrimBpOptPassStep1(const opt::irpass::OptimizeIRPassLib &irpass, const ResourcePtr &res);
51 FuncGraphPtr PrimBpOptPassStep2(const opt::irpass::OptimizeIRPassLib &irpass, const ResourcePtr &res);
52 FuncGraphPtr BpropGraphFinalOptPass(const ResourcePtr &res);
53 }  // namespace pipeline
54 }  // namespace mindspore
55 
56 #endif  // MINDSPORE_CCSRC_PIPELINE_JIT_PASS_H_
57