1 /** 2 * Copyright 2023 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_GE_GRAPH_OPTIMIZATION_H 18 #define MINDSPORE_GE_GRAPH_OPTIMIZATION_H 19 #include <vector> 20 #include <set> 21 #include <memory> 22 #include "include/backend/kernel_graph.h" 23 #include "include/backend/optimizer/graph_optimizer.h" 24 namespace mindspore { 25 namespace device { 26 namespace ascend { 27 class GEGraphOptimization { 28 public: GetInstance()29 static GEGraphOptimization &GetInstance() { 30 static GEGraphOptimization instance; 31 return instance; 32 } 33 void OptimizeGEGraph(const KernelGraphPtr &graph, std::set<KernelGraphPtr> *const memo); 34 void OptimizeACLGraph(const KernelGraphPtr &graph, std::set<KernelGraphPtr> *const memo); 35 void OptimizeACLGraphAfterKernelSelect(const KernelGraphPtr &graph, std::set<KernelGraphPtr> *const memo); 36 void OptimizeACLGraphAfterInline(const KernelGraphPtr &graph); 37 void UnifyMindIR(const KernelGraphPtr &graph); 38 void GEMindIRPass(const KernelGraphPtr &graph) const; 39 40 private: GEGraphOptimization()41 GEGraphOptimization() {} 42 ~GEGraphOptimization() = default; 43 GEGraphOptimization(const GEGraphOptimization &) = delete; 44 GEGraphOptimization &operator=(const GEGraphOptimization &) = delete; 45 }; 46 47 } // namespace ascend 48 } // namespace device 49 } // namespace mindspore 50 51 #endif // MINDSPORE_GE_GRAPH_OPTIMIZATION_H 52