1 /** 2 * Copyright 2022-2024 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_RUNTIME_HARDWARE_DEPRECATED_INTERFACE_H_ 18 #define MINDSPORE_CCSRC_RUNTIME_HARDWARE_DEPRECATED_INTERFACE_H_ 19 20 #include <vector> 21 #include <string> 22 #include <memory> 23 #include "ir/func_graph.h" 24 #include "pybind11/pytypes.h" 25 #include "utils/ms_context.h" 26 #include "include/api/types.h" 27 #include "nlohmann/json.hpp" 28 29 namespace mindspore { 30 namespace device { 31 class DeprecatedInterface { 32 public: 33 virtual ~DeprecatedInterface() = default; 34 35 // ge DoExecNonInputGraph(const std::string & phase)36 virtual void DoExecNonInputGraph(const std::string &phase) {} ExportDFGraph(const std::string & file_name,const std::string & phase,const pybind11::object & encrypt,char * key)37 virtual void ExportDFGraph(const std::string &file_name, const std::string &phase, const pybind11::object &encrypt, 38 char *key) {} 39 BuildDFGraph(const FuncGraphPtr & anf_graph,const pybind11::dict & init_params)40 virtual FuncGraphPtr BuildDFGraph(const FuncGraphPtr &anf_graph, const pybind11::dict &init_params) { 41 return nullptr; 42 } RunInitGraph(const FuncGraphPtr & anf_graph,const pybind11::dict & init_params)43 virtual bool RunInitGraph(const FuncGraphPtr &anf_graph, const pybind11::dict &init_params) { return true; } ClearGraphWrapper()44 virtual void ClearGraphWrapper() {} ClearOpAdapterMap()45 virtual void ClearOpAdapterMap() {} UnregisterExternalAllocator()46 virtual void UnregisterExternalAllocator() {} 47 48 // ascend DumpProfileParallelStrategy(const FuncGraphPtr & func_graph)49 virtual void DumpProfileParallelStrategy(const FuncGraphPtr &func_graph) {} OpenTsd(const std::shared_ptr<MsContext> & ms_context_ptr)50 virtual bool OpenTsd(const std::shared_ptr<MsContext> &ms_context_ptr) { return true; } CloseTsd(const std::shared_ptr<MsContext> & ms_context_ptr,bool force)51 virtual bool CloseTsd(const std::shared_ptr<MsContext> &ms_context_ptr, bool force) { return true; } IsTsdOpened(const std::shared_ptr<MsContext> & inst_context)52 virtual bool IsTsdOpened(const std::shared_ptr<MsContext> &inst_context) { return true; } AclOptimizer(const FuncGraphPtr & graph)53 virtual void AclOptimizer(const FuncGraphPtr &graph) {} CheckIsAscend910Soc()54 virtual bool CheckIsAscend910Soc() { return true; } 55 // gpu GetGPUCapabilityMajor()56 virtual int GetGPUCapabilityMajor() { return -1; } GetGPUCapabilityMinor()57 virtual int GetGPUCapabilityMinor() { return -1; } GetGPUMultiProcessorCount()58 virtual int GetGPUMultiProcessorCount() { return -1; } 59 }; 60 } // namespace device 61 } // namespace mindspore 62 #endif // MINDSPORE_CCSRC_RUNTIME_HARDWARE_DEPRECATED_INTERFACE_H_ 63