| feat: 支持 GE Python 离线图编译执行接口
Co-authored-by: du-hua1024<duhua2@huawei.com>
# message auto-generated for no-merge-commit merge:
!1699 merge develop into develop
feat: 支持 GE Python 离线图编译执行接口
Created-by: du-hua1024
Commit-by: du-hua1024
Merged-by: cann-robot
Description: 20260326评审通过
# Pull Request
## 描述
本次提交新增 GE Python 离线图编译执行能力,围绕离线模型构建、保存、样例使用、文档说明和基础单测进行了补充。
主要修改如下:
- 新增 ge.offline_compile 模块,提供离线图编译相关 Python 接口:
- aclgrph_build_initialize
- aclgrph_build_finalize
- aclgrph_build_model
- aclgrph_save_model
- aclgrph_bundle_build_model
- aclgrph_bundle_save_model
- 新增 ModelBuffer 与 GraphWithOptions 辅助类型,用于承接单模型和 Bundle 模型的离线编译流程。
- 新增底层离线编译 wrapper:
- C++ wrapper:api/python/ge/ge_api_c_wrapper/c_offline_compile.cc
- Python ctypes wrapper:api/python/ge/ge/_capi/pyoffline_compile_wrapper.py
- 新增离线图编译样例 examples/offline_compile_run/python:
- 样例目录按 single_model/ 和 bundle_model/ 拆分,覆盖单模型离线编译与执行流程, Bundle 多图离线编译与子模型执行流程
- 更新 docs/ge_python 相关文档和设计说明,补充 offline_compile 模块的用途、结构和示例。
- 新增 Python 单测 tests/ge/ut/ge/graph/pyge_tests/offline_compile_test.py
## 变更类型
请选择本次引入的变更类型:
<!-- [x] 表示选中 -->
- [ ] 🐛 Bug 修复
- [x] ✨ 新功能
- [ ] 💄 代码风格更新(格式化,局部变量)
- [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动)
- [ ] 📦 构建过程或辅助工具的变动
- [x] 📝 文档内容更新
## 关联的Issue
暂无。
## 如何测试
在已安装 CANN toolkit/ops 且配置 pyACL 的环境中执行样例:
```bash
cd examples/offline_compile_run/python
bash run_sample.sh --soc-version Ascend910B1 -t sample_and_run_python
bash run_sample.sh --soc-version Ascend910B1 -t sample_and_run_bundle_python
```
## 核对清单
<!-- [x] 表示选中 -->
- [x] 我的代码遵循了项目的代码风格
- [x] 我已对代码进行了自测
- [x] 我已更新了相关的文档
- [x] 我在标题中使用了合适的类型标签(如:feat:, fix:)
- [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等
## 其他信息
See merge request: cann/ge!1699 | 1 个月前 |