| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
feat: 新增 Python 自定义算子样例及文档 Co-authored-by: du-hua1024<duhua2@huawei.com> # message auto-generated for no-merge-commit merge: !3989 merge op into develop feat: 新增 Python 自定义算子样例及文档 Created-by: du-hua1024 Commit-by: du-hua1024 Merged-by: cann-robot Description: # Pull Request ## 描述 在 args_refresh_add_custom 路径下新增 Python 版本样例,展示通过 Python EagerExecuteOp 在 GE 在线执行中加载 Bisheng 预编译产物,并使用 ACL Python runtime 完成 kernel 参数构造和下发。 主要变更: - 将原 args_refresh_add_custom C++ 样例整理到 cpp/ 目录,保持原 ArgsUpdater 对比样例能力。 - 新增 python/ 样例,包括 REG_OP proto、ES wheel 生成、run.sh、Python custom op 实现和 Session.run_graph 入口。 - Python 样例通过 bisheng 编译 host object,并提取 .aicore_binary 后由 acl.rt.binary_load_from_file 加载。 - 更新 custom op 示例总览和 GE Python custom op 设计文档。 ## 变更类型 请选择本次引入的变更类型: <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [x] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [x] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [ ] 📦 构建过程或辅助工具的变动 - [x] 📝 文档内容更新 ## 关联的Issue 无 ## 如何测试 - bash -n examples/custom_op/args_refresh_add_custom/python/run.sh ## 核对清单 <!-- [x] 表示选中 --> - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如:feat:, fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 ## 其他信息 无 See merge request: cann/ge!3989 | 16 天前 | |
fix: 非主线包补充 custom_op_runtime 并收束 Python runtime 生命周期 Co-authored-by: du-hua1024<duhua2@huawei.com> # message auto-generated for no-merge-commit merge: !4035 merge op into develop fix: 非主线包补充 custom_op_runtime 并收束 Python runtime 生命周期 Created-by: du-hua1024 Commit-by: du-hua1024 Merged-by: cann-robot Description: # Pull Request ## 描述 - 非主线包安装列表补充 custom_op_runtime,确保 Python 自定义算子运行时组件随包交付。 - 样例 README 同步补充 toolkit/ops 包安装和环境变量设置前置条件,明确 run 包编译 Python 版本需与执行版本一致。 - 清理 GeExecutor::Initialize() 和 GeGenerator::Initialize() 中对进程级 Python runtime 的重复初始化/析构职责,避免 executor/generator 层额外持有 EnsureReady()/ShutdownProcess() guard。acl 离线运行支持python自定义算子场景后续分析。 - ATC 侧将 GePythonRuntimeManager 生命周期收束到 api/atc/main_impl.cc::main_impl():raw options 加载成功后统一 EnsureReady(),并通过入口作用域 guard 在 ATC 退出时统一 ShutdownProcess()。 - ATC 子路径继续只负责各自资源:PrepareOmGeneration() / GenerateSingleOp() / ConvertModelToJson() 保留 custom op 加载或清理,GenerateModel() 保留 GELib 和 GeGenerator 的初始化/释放,不再分散管理 Python runtime。 GeGenerator::Initialize() 调用侧 GePythonRuntimeManager::EnsureReady() 覆盖链路说明 - ATC 总入口:main_impl() -> LoadRawOptionsForAtc() -> GePythonRuntimeManager::Instance().EnsureReady() -> 注册 release_python_runtime guard -> CheckGlobalOptionsBeforeRun() -> RunAtcByMode(raw_options)。因此 ATC 后续所有模式都处于同一个入口级 Python runtime 生命周期内。 - ACL graph build 初始化:aclgrphBuildInitialize() -> EnsureReady() + LoadCustomOps() + LoadPassPlugins();后续 aclgrphBuildModel() / aclgrphBundleBuildModel() 进入 Impl::BuildModel() -> Impl::Init() -> generator_.Initialize(),依赖先 initialize 后 build 的接口生命周期契约。 - ACL 单算子本地编译:aclopCompile() / aclopCompileAndExecute() / aclopCompileAndExecuteV2() / aclGenGraphAndDumpForOp() -> OpCompileProcessor::GetInstance() -> OpCompileProcessor::Init() -> SetOption() -> OpCompileService::SetCompileStrategy(NATIVE_COMPILER) -> LocalCompiler::CreateCompiler() -> LocalCompiler::Init() -> GEInitialize() -> GEInitializeV2() -> EnsureReady() + LoadCustomOps();之后 cache miss 或 dump 图路径再进入 LocalCompiler::OnlineCompileAndDump() -> GeGenerator::Initialize()。 ## 变更类型 请选择本次引入的变更类型(勾选对应项): - [x] 🐛 Bug 修复 - [ ] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [x] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [ ] 📦 构建过程或辅助工具的变动 - [x] 📝 文档内容更新 ## 关联的Issue 无。 ## 如何测试 历史用例通过,python自定义算子example正常运行 ## 核对清单 - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如:feat:, fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 ## 其他信息 See merge request: cann/ge!4035 | 14 天前 |