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 #ifndef MINDSPORE_CCSRC_RUNTIME_HARDWARE_ASCEND_ASCEND_DEPRECATED_INTERFACE_H_ 17 #define MINDSPORE_CCSRC_RUNTIME_HARDWARE_ASCEND_ASCEND_DEPRECATED_INTERFACE_H_ 18 19 #include <vector> 20 #include <memory> 21 #include <string> 22 #include <map> 23 #include "pybind11/pybind11.h" 24 #include "pybind11/pytypes.h" 25 #include "runtime/hardware/device_context.h" 26 #include "runtime/device/memory_manager.h" 27 #include "utils/ms_context.h" 28 29 namespace mindspore { 30 namespace device { 31 namespace ascend { 32 class GeDeviceContext; 33 34 class AscendDeprecatedInterface : public DeprecatedInterface { 35 public: AscendDeprecatedInterface(GeDeviceContext * ge_device_context)36 explicit AscendDeprecatedInterface(GeDeviceContext *ge_device_context) : ge_device_context_(ge_device_context) {} 37 ~AscendDeprecatedInterface() override = default; 38 39 // for ge 40 void DoExecNonInputGraph(const std::string &phase) override; 41 bool RunInitGraph(const FuncGraphPtr &anf_graph, const pybind11::dict &init_params) override; 42 void ExportDFGraph(const std::string &file_name, const std::string &phase, const pybind11::object &encrypt, 43 char *key) override; 44 FuncGraphPtr BuildDFGraph(const FuncGraphPtr &anf_graph, const pybind11::dict &init_params) override; 45 void ClearGraphWrapper() override; 46 void ClearOpAdapterMap() override; 47 void DumpProfileParallelStrategy(const FuncGraphPtr &func_graph) override; 48 49 bool OpenTsd(const std::shared_ptr<MsContext> &ms_context_ptr) override; 50 bool CloseTsd(const std::shared_ptr<MsContext> &ms_context_ptr, bool force) override; 51 bool IsTsdOpened(const std::shared_ptr<MsContext> &inst_context) override; 52 bool CheckIsAscend910Soc() override; 53 void UnregisterExternalAllocator() override; 54 55 private: 56 GeDeviceContext *const ge_device_context_; 57 }; 58 } // namespace ascend 59 } // namespace device 60 } // namespace mindspore 61 #endif // MINDSPORE_CCSRC_RUNTIME_HARDWARE_ASCEND_ASCEND_DEPRECATED_INTERFACE_H_ 62