| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
feat: 支持 Python 自定义算子原型与实现桥接注册 Co-authored-by: lfz<220252399@seu.edu.cn> # message auto-generated for no-merge-commit merge: !4320 merge develop2 into develop feat: 支持 Python 自定义算子原型与实现桥接注册 Created-by: lfz2812 Commit-by: lfz Merged-by: cann-robot Description: # Pull Request ## 描述 支持 Python 自定义算子原型从 Python descriptor 到 GE OperatorFactory 的注册,并完善 Python 自定义算子实现的 bridge 注册、校验和生命周期管理。 主要变更: - 根据 Python 函数签名收集输入、属性、输出及 mutates_args,生成并深拷贝 Python custom op proto。 - 将 Python proto 注册为 OperatorFactory creator,并通过公开 IR 查询接口获取 canonical IR。 - 按 proto 注册、canonical IR 收集、impl 签名校验、Adapter 注册的顺序完成加载。 - 支持 proto-only、proto + Python impl、C++ proto + Python impl 以及 legacy impl。 - 完善 Adapter descriptor、runtime registry 和 holder 的所有权管理。 - 支持重复加载幂等、runtime lease pending cleanup 和注册失败回滚。 - 增加 Python proto、descriptor、bridge loader、Adapter 以及 ST/UT 覆盖。 - 当前阶段不执行 Python infer_meta,暂不覆盖编译期 Meta 推导和 RT2 runtime infer。 - 同步更新中英文 Python custom op 设计文档。 ## 变更类型 请选择本次引入的变更类型: <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [x] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [ ] 📦 构建过程或辅助工具的变动 - [x] 📝 文档内容更新 ## 关联的Issue [#299](https://gitcode.com/cann/ge/issues/299) ## 如何测试 本次补充和扩展以下测试: 1. Python UT: - proto/impl descriptor 快照和关联关系。 - proto-only、proto + schema-bound impl、C++ proto + Python impl 和 legacy impl 场景。 - canonical IR 与 execute 签名校验。 - schema-bound 输入和属性绑定、执行上下文作用域及失效检查。 - plugin 和 bridge/native artifact 加载检查。 2. C++ UT: - proto C POD view 解析和 owning 数据转换。 - 支持的属性类型及默认值转换。 - Operator creator 注册、冲突保护和卸载。 - Adapter capability、runtime entry、holder 和 callback 生命周期。 - loader 注册事务、失败回滚、幂等加载及 pending cleanup。 3. ST: - Python proto 和 impl 注册、创建及卸载。 - Python 自定义算子文件加载失败。 - 不可访问的非 Python自定义算子路径跳过处理。 建议执行: bash bash tests/run_test.sh --ut=python cmake --build build_ut --target ut_libge_multiparts_utest -j4 ctest --test-dir build_ut -R ut_libge_multiparts_utest --output-on-failure git diff --check ## 核对清单 <!-- [x] 表示选中 --> - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如:feat:, fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 ## 其他信息 - 本次完成 Python 原型到 C++ OperatorFactory 的注册,以及 Python 实现到 CustomOpFactory 的 Adapter 注册。 - 本次不执行 Python infer_meta,不包含 infer callback、编译期 shape/data type 回写或 RT2 runtime infer 链路;这些内容由后续 PR 完成。 - 本次保持 schema-bound execute 和迁移期 legacy execute(ctx) 的现有行为。 - Bridge ABI 当前按同批构建和整体替换使用,不承诺不同版本 V1 artifact 混用。 - 本次未修改公开 API,也未修改 build_fwk.sh 等公共构建脚本。 See merge request: cann/ge!4320 | 27 天前 | |
fix: 修复aclop与图模式混跑时Python Custom Op资源被提前释放的问题 Co-authored-by: qq_45842700<caodazhou@huawei.com> # message auto-generated for no-merge-commit merge: !4284 merge fix/custom-op-lifecycle into develop fix: 修复aclop与图模式混跑时Python Custom Op资源被提前释放的问题 Created-by: qq_45842700 Commit-by: qq_45842700 Merged-by: cann-robot Description: # Pull Request ## 描述 PR #4243 修复了 aclop 与图模式混跑时自定义 Pass 资源被提前释放的问题,但同一 GeGenerator::Finalize() 路径中 ShutdownCustomOpsForProcess() 仍被无条件调用,导致 Python Custom Op 存在同类生命周期缺陷(Issue #505)。 本 PR 参照 PR #4243 对 Pass 的修复方式,为 CustomOpLoader 引入 active_users_ 引用计数。 ### 核心修改 1. **runtime/custom_op/custom_op_loader.cc**:引入 active_users_ 引用计数 - Load():每次调用 active_users_++,首次(active_users_ == 0)才真正加载;同时重置 shutdown_done_ = false 以支持 reload 后完整 shutdown - Unload():每次调用 active_users_--,仅当 active_users_ 归零时才执行卸载(UnloadPythonCustomOps + ShutdownPythonCustomOpsForProcess) - 保留 ShutdownCustomOpsForProcess() 作为兼容 wrapper,内部调用 Unload() - 新增 cpp_custom_ops_loaded_ 标志和 RollbackCustomOpsLoad() 回滚方法 2. **调用点替换**(4 个文件):将 ShutdownCustomOpsForProcess() 替换为 UnloadCustomOps() - compiler/api/generator/ge_generator.cc:510(aclop 路径,最关键) - api/session/client/ge_api_v2.cc:267,405(GEInitialize guard + GEFinalize) - compiler/api/aclgrph/ge_ir_build.cc:443,490(aclgrphBuildInitialize guard + aclgrphBuildFinalize) - api/atc/main_impl.cc:2383(ATC 清理路径) ## 变更类型 - [x] 🐛 Bug 修复 ## 关联的Issue - Issue #505 - PR #4243(Pass 同类修复) ## 如何测试 ### Bug 复现条件 在同一 Python 进程内: 1. Phase 1:GEInitialize → Session.add_graph(含 Python Custom Op)→ Session.run_graph → Custom Op execute 成功 2. Phase 2:torch_npu.npu.set_compile_mode(jit_compile=True) → 执行 matmul 等 NPU 单算子 → aclop 创建临时 GeGenerator → Finalize → ShutdownCustomOpsForProcess 3. Phase 3:Session.run_graph(同一已编译图)→ Custom Op 裸指针悬空 ### 修复前 Phase 3 SIGSEGV (exit code 139),Custom Op 被 aclop Finalize 卸载后悬空指针导致段错误。 ### 修复后 - Phase 1:Custom Op 正常加载执行 ✅ - Phase 2:aclop 编译成功 ✅ - Phase 3:Custom Op 仍正常执行 ✅(不再崩溃) - 引用计数日志:LoadCustomOps active_users_=1 → =2(aclop Load)→ =1(aclop Unload,不卸载)→ =0(GEFinalize,真正卸载) ### 测试环境 - Ascend 910, CANN 9.2.0, Python 3.12 ## 核对清单 - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我在标题中使用了合适的类型标签(fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定 ## 其他信息 修复方案完全对齐 PR #4243 对 Pass 的修复模式(active_users_ 引用计数),改动量小、风险可控。Pass 和 Custom Op 的修复模式一致,便于后续维护。 See merge request: cann/ge!4284 | 1 个月前 | |
fix: 修复aclop与图模式混跑时Python Custom Op资源被提前释放的问题 Co-authored-by: qq_45842700<caodazhou@huawei.com> # message auto-generated for no-merge-commit merge: !4284 merge fix/custom-op-lifecycle into develop fix: 修复aclop与图模式混跑时Python Custom Op资源被提前释放的问题 Created-by: qq_45842700 Commit-by: qq_45842700 Merged-by: cann-robot Description: # Pull Request ## 描述 PR #4243 修复了 aclop 与图模式混跑时自定义 Pass 资源被提前释放的问题,但同一 GeGenerator::Finalize() 路径中 ShutdownCustomOpsForProcess() 仍被无条件调用,导致 Python Custom Op 存在同类生命周期缺陷(Issue #505)。 本 PR 参照 PR #4243 对 Pass 的修复方式,为 CustomOpLoader 引入 active_users_ 引用计数。 ### 核心修改 1. **runtime/custom_op/custom_op_loader.cc**:引入 active_users_ 引用计数 - Load():每次调用 active_users_++,首次(active_users_ == 0)才真正加载;同时重置 shutdown_done_ = false 以支持 reload 后完整 shutdown - Unload():每次调用 active_users_--,仅当 active_users_ 归零时才执行卸载(UnloadPythonCustomOps + ShutdownPythonCustomOpsForProcess) - 保留 ShutdownCustomOpsForProcess() 作为兼容 wrapper,内部调用 Unload() - 新增 cpp_custom_ops_loaded_ 标志和 RollbackCustomOpsLoad() 回滚方法 2. **调用点替换**(4 个文件):将 ShutdownCustomOpsForProcess() 替换为 UnloadCustomOps() - compiler/api/generator/ge_generator.cc:510(aclop 路径,最关键) - api/session/client/ge_api_v2.cc:267,405(GEInitialize guard + GEFinalize) - compiler/api/aclgrph/ge_ir_build.cc:443,490(aclgrphBuildInitialize guard + aclgrphBuildFinalize) - api/atc/main_impl.cc:2383(ATC 清理路径) ## 变更类型 - [x] 🐛 Bug 修复 ## 关联的Issue - Issue #505 - PR #4243(Pass 同类修复) ## 如何测试 ### Bug 复现条件 在同一 Python 进程内: 1. Phase 1:GEInitialize → Session.add_graph(含 Python Custom Op)→ Session.run_graph → Custom Op execute 成功 2. Phase 2:torch_npu.npu.set_compile_mode(jit_compile=True) → 执行 matmul 等 NPU 单算子 → aclop 创建临时 GeGenerator → Finalize → ShutdownCustomOpsForProcess 3. Phase 3:Session.run_graph(同一已编译图)→ Custom Op 裸指针悬空 ### 修复前 Phase 3 SIGSEGV (exit code 139),Custom Op 被 aclop Finalize 卸载后悬空指针导致段错误。 ### 修复后 - Phase 1:Custom Op 正常加载执行 ✅ - Phase 2:aclop 编译成功 ✅ - Phase 3:Custom Op 仍正常执行 ✅(不再崩溃) - 引用计数日志:LoadCustomOps active_users_=1 → =2(aclop Load)→ =1(aclop Unload,不卸载)→ =0(GEFinalize,真正卸载) ### 测试环境 - Ascend 910, CANN 9.2.0, Python 3.12 ## 核对清单 - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我在标题中使用了合适的类型标签(fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定 ## 其他信息 修复方案完全对齐 PR #4243 对 Pass 的修复模式(active_users_ 引用计数),改动量小、风险可控。Pass 和 Custom Op 的修复模式一致,便于后续维护。 See merge request: cann/ge!4284 | 1 个月前 | |
feat: 支持 Python 自定义算子原型与实现桥接注册 Co-authored-by: lfz<220252399@seu.edu.cn> # message auto-generated for no-merge-commit merge: !4320 merge develop2 into develop feat: 支持 Python 自定义算子原型与实现桥接注册 Created-by: lfz2812 Commit-by: lfz Merged-by: cann-robot Description: # Pull Request ## 描述 支持 Python 自定义算子原型从 Python descriptor 到 GE OperatorFactory 的注册,并完善 Python 自定义算子实现的 bridge 注册、校验和生命周期管理。 主要变更: - 根据 Python 函数签名收集输入、属性、输出及 mutates_args,生成并深拷贝 Python custom op proto。 - 将 Python proto 注册为 OperatorFactory creator,并通过公开 IR 查询接口获取 canonical IR。 - 按 proto 注册、canonical IR 收集、impl 签名校验、Adapter 注册的顺序完成加载。 - 支持 proto-only、proto + Python impl、C++ proto + Python impl 以及 legacy impl。 - 完善 Adapter descriptor、runtime registry 和 holder 的所有权管理。 - 支持重复加载幂等、runtime lease pending cleanup 和注册失败回滚。 - 增加 Python proto、descriptor、bridge loader、Adapter 以及 ST/UT 覆盖。 - 当前阶段不执行 Python infer_meta,暂不覆盖编译期 Meta 推导和 RT2 runtime infer。 - 同步更新中英文 Python custom op 设计文档。 ## 变更类型 请选择本次引入的变更类型: <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [x] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [ ] 📦 构建过程或辅助工具的变动 - [x] 📝 文档内容更新 ## 关联的Issue [#299](https://gitcode.com/cann/ge/issues/299) ## 如何测试 本次补充和扩展以下测试: 1. Python UT: - proto/impl descriptor 快照和关联关系。 - proto-only、proto + schema-bound impl、C++ proto + Python impl 和 legacy impl 场景。 - canonical IR 与 execute 签名校验。 - schema-bound 输入和属性绑定、执行上下文作用域及失效检查。 - plugin 和 bridge/native artifact 加载检查。 2. C++ UT: - proto C POD view 解析和 owning 数据转换。 - 支持的属性类型及默认值转换。 - Operator creator 注册、冲突保护和卸载。 - Adapter capability、runtime entry、holder 和 callback 生命周期。 - loader 注册事务、失败回滚、幂等加载及 pending cleanup。 3. ST: - Python proto 和 impl 注册、创建及卸载。 - Python 自定义算子文件加载失败。 - 不可访问的非 Python自定义算子路径跳过处理。 建议执行: bash bash tests/run_test.sh --ut=python cmake --build build_ut --target ut_libge_multiparts_utest -j4 ctest --test-dir build_ut -R ut_libge_multiparts_utest --output-on-failure git diff --check ## 核对清单 <!-- [x] 表示选中 --> - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如:feat:, fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 ## 其他信息 - 本次完成 Python 原型到 C++ OperatorFactory 的注册,以及 Python 实现到 CustomOpFactory 的 Adapter 注册。 - 本次不执行 Python infer_meta,不包含 infer callback、编译期 shape/data type 回写或 RT2 runtime infer 链路;这些内容由后续 PR 完成。 - 本次保持 schema-bound execute 和迁移期 legacy execute(ctx) 的现有行为。 - Bridge ABI 当前按同批构建和整体替换使用,不承诺不同版本 V1 artifact 混用。 - 本次未修改公开 API,也未修改 build_fwk.sh 等公共构建脚本。 See merge request: cann/ge!4320 | 27 天前 | |
feat: 支持 Python 自定义算子原型与实现桥接注册 Co-authored-by: lfz<220252399@seu.edu.cn> # message auto-generated for no-merge-commit merge: !4320 merge develop2 into develop feat: 支持 Python 自定义算子原型与实现桥接注册 Created-by: lfz2812 Commit-by: lfz Merged-by: cann-robot Description: # Pull Request ## 描述 支持 Python 自定义算子原型从 Python descriptor 到 GE OperatorFactory 的注册,并完善 Python 自定义算子实现的 bridge 注册、校验和生命周期管理。 主要变更: - 根据 Python 函数签名收集输入、属性、输出及 mutates_args,生成并深拷贝 Python custom op proto。 - 将 Python proto 注册为 OperatorFactory creator,并通过公开 IR 查询接口获取 canonical IR。 - 按 proto 注册、canonical IR 收集、impl 签名校验、Adapter 注册的顺序完成加载。 - 支持 proto-only、proto + Python impl、C++ proto + Python impl 以及 legacy impl。 - 完善 Adapter descriptor、runtime registry 和 holder 的所有权管理。 - 支持重复加载幂等、runtime lease pending cleanup 和注册失败回滚。 - 增加 Python proto、descriptor、bridge loader、Adapter 以及 ST/UT 覆盖。 - 当前阶段不执行 Python infer_meta,暂不覆盖编译期 Meta 推导和 RT2 runtime infer。 - 同步更新中英文 Python custom op 设计文档。 ## 变更类型 请选择本次引入的变更类型: <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [x] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [ ] 📦 构建过程或辅助工具的变动 - [x] 📝 文档内容更新 ## 关联的Issue [#299](https://gitcode.com/cann/ge/issues/299) ## 如何测试 本次补充和扩展以下测试: 1. Python UT: - proto/impl descriptor 快照和关联关系。 - proto-only、proto + schema-bound impl、C++ proto + Python impl 和 legacy impl 场景。 - canonical IR 与 execute 签名校验。 - schema-bound 输入和属性绑定、执行上下文作用域及失效检查。 - plugin 和 bridge/native artifact 加载检查。 2. C++ UT: - proto C POD view 解析和 owning 数据转换。 - 支持的属性类型及默认值转换。 - Operator creator 注册、冲突保护和卸载。 - Adapter capability、runtime entry、holder 和 callback 生命周期。 - loader 注册事务、失败回滚、幂等加载及 pending cleanup。 3. ST: - Python proto 和 impl 注册、创建及卸载。 - Python 自定义算子文件加载失败。 - 不可访问的非 Python自定义算子路径跳过处理。 建议执行: bash bash tests/run_test.sh --ut=python cmake --build build_ut --target ut_libge_multiparts_utest -j4 ctest --test-dir build_ut -R ut_libge_multiparts_utest --output-on-failure git diff --check ## 核对清单 <!-- [x] 表示选中 --> - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如:feat:, fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 ## 其他信息 - 本次完成 Python 原型到 C++ OperatorFactory 的注册,以及 Python 实现到 CustomOpFactory 的 Adapter 注册。 - 本次不执行 Python infer_meta,不包含 infer callback、编译期 shape/data type 回写或 RT2 runtime infer 链路;这些内容由后续 PR 完成。 - 本次保持 schema-bound execute 和迁移期 legacy execute(ctx) 的现有行为。 - Bridge ABI 当前按同批构建和整体替换使用,不承诺不同版本 V1 artifact 混用。 - 本次未修改公开 API,也未修改 build_fwk.sh 等公共构建脚本。 See merge request: cann/ge!4320 | 27 天前 | |
feat: 支持 Python 自定义算子原型与实现桥接注册 Co-authored-by: lfz<220252399@seu.edu.cn> # message auto-generated for no-merge-commit merge: !4320 merge develop2 into develop feat: 支持 Python 自定义算子原型与实现桥接注册 Created-by: lfz2812 Commit-by: lfz Merged-by: cann-robot Description: # Pull Request ## 描述 支持 Python 自定义算子原型从 Python descriptor 到 GE OperatorFactory 的注册,并完善 Python 自定义算子实现的 bridge 注册、校验和生命周期管理。 主要变更: - 根据 Python 函数签名收集输入、属性、输出及 mutates_args,生成并深拷贝 Python custom op proto。 - 将 Python proto 注册为 OperatorFactory creator,并通过公开 IR 查询接口获取 canonical IR。 - 按 proto 注册、canonical IR 收集、impl 签名校验、Adapter 注册的顺序完成加载。 - 支持 proto-only、proto + Python impl、C++ proto + Python impl 以及 legacy impl。 - 完善 Adapter descriptor、runtime registry 和 holder 的所有权管理。 - 支持重复加载幂等、runtime lease pending cleanup 和注册失败回滚。 - 增加 Python proto、descriptor、bridge loader、Adapter 以及 ST/UT 覆盖。 - 当前阶段不执行 Python infer_meta,暂不覆盖编译期 Meta 推导和 RT2 runtime infer。 - 同步更新中英文 Python custom op 设计文档。 ## 变更类型 请选择本次引入的变更类型: <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [x] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [ ] 📦 构建过程或辅助工具的变动 - [x] 📝 文档内容更新 ## 关联的Issue [#299](https://gitcode.com/cann/ge/issues/299) ## 如何测试 本次补充和扩展以下测试: 1. Python UT: - proto/impl descriptor 快照和关联关系。 - proto-only、proto + schema-bound impl、C++ proto + Python impl 和 legacy impl 场景。 - canonical IR 与 execute 签名校验。 - schema-bound 输入和属性绑定、执行上下文作用域及失效检查。 - plugin 和 bridge/native artifact 加载检查。 2. C++ UT: - proto C POD view 解析和 owning 数据转换。 - 支持的属性类型及默认值转换。 - Operator creator 注册、冲突保护和卸载。 - Adapter capability、runtime entry、holder 和 callback 生命周期。 - loader 注册事务、失败回滚、幂等加载及 pending cleanup。 3. ST: - Python proto 和 impl 注册、创建及卸载。 - Python 自定义算子文件加载失败。 - 不可访问的非 Python自定义算子路径跳过处理。 建议执行: bash bash tests/run_test.sh --ut=python cmake --build build_ut --target ut_libge_multiparts_utest -j4 ctest --test-dir build_ut -R ut_libge_multiparts_utest --output-on-failure git diff --check ## 核对清单 <!-- [x] 表示选中 --> - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如:feat:, fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 ## 其他信息 - 本次完成 Python 原型到 C++ OperatorFactory 的注册,以及 Python 实现到 CustomOpFactory 的 Adapter 注册。 - 本次不执行 Python infer_meta,不包含 infer callback、编译期 shape/data type 回写或 RT2 runtime infer 链路;这些内容由后续 PR 完成。 - 本次保持 schema-bound execute 和迁移期 legacy execute(ctx) 的现有行为。 - Bridge ABI 当前按同批构建和整体替换使用,不承诺不同版本 V1 artifact 混用。 - 本次未修改公开 API,也未修改 build_fwk.sh 等公共构建脚本。 See merge request: cann/ge!4320 | 27 天前 | |
feat: 支持 Python 自定义算子原型与实现桥接注册 Co-authored-by: lfz<220252399@seu.edu.cn> # message auto-generated for no-merge-commit merge: !4320 merge develop2 into develop feat: 支持 Python 自定义算子原型与实现桥接注册 Created-by: lfz2812 Commit-by: lfz Merged-by: cann-robot Description: # Pull Request ## 描述 支持 Python 自定义算子原型从 Python descriptor 到 GE OperatorFactory 的注册,并完善 Python 自定义算子实现的 bridge 注册、校验和生命周期管理。 主要变更: - 根据 Python 函数签名收集输入、属性、输出及 mutates_args,生成并深拷贝 Python custom op proto。 - 将 Python proto 注册为 OperatorFactory creator,并通过公开 IR 查询接口获取 canonical IR。 - 按 proto 注册、canonical IR 收集、impl 签名校验、Adapter 注册的顺序完成加载。 - 支持 proto-only、proto + Python impl、C++ proto + Python impl 以及 legacy impl。 - 完善 Adapter descriptor、runtime registry 和 holder 的所有权管理。 - 支持重复加载幂等、runtime lease pending cleanup 和注册失败回滚。 - 增加 Python proto、descriptor、bridge loader、Adapter 以及 ST/UT 覆盖。 - 当前阶段不执行 Python infer_meta,暂不覆盖编译期 Meta 推导和 RT2 runtime infer。 - 同步更新中英文 Python custom op 设计文档。 ## 变更类型 请选择本次引入的变更类型: <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [x] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [ ] 📦 构建过程或辅助工具的变动 - [x] 📝 文档内容更新 ## 关联的Issue [#299](https://gitcode.com/cann/ge/issues/299) ## 如何测试 本次补充和扩展以下测试: 1. Python UT: - proto/impl descriptor 快照和关联关系。 - proto-only、proto + schema-bound impl、C++ proto + Python impl 和 legacy impl 场景。 - canonical IR 与 execute 签名校验。 - schema-bound 输入和属性绑定、执行上下文作用域及失效检查。 - plugin 和 bridge/native artifact 加载检查。 2. C++ UT: - proto C POD view 解析和 owning 数据转换。 - 支持的属性类型及默认值转换。 - Operator creator 注册、冲突保护和卸载。 - Adapter capability、runtime entry、holder 和 callback 生命周期。 - loader 注册事务、失败回滚、幂等加载及 pending cleanup。 3. ST: - Python proto 和 impl 注册、创建及卸载。 - Python 自定义算子文件加载失败。 - 不可访问的非 Python自定义算子路径跳过处理。 建议执行: bash bash tests/run_test.sh --ut=python cmake --build build_ut --target ut_libge_multiparts_utest -j4 ctest --test-dir build_ut -R ut_libge_multiparts_utest --output-on-failure git diff --check ## 核对清单 <!-- [x] 表示选中 --> - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如:feat:, fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 ## 其他信息 - 本次完成 Python 原型到 C++ OperatorFactory 的注册,以及 Python 实现到 CustomOpFactory 的 Adapter 注册。 - 本次不执行 Python infer_meta,不包含 infer callback、编译期 shape/data type 回写或 RT2 runtime infer 链路;这些内容由后续 PR 完成。 - 本次保持 schema-bound execute 和迁移期 legacy execute(ctx) 的现有行为。 - Bridge ABI 当前按同批构建和整体替换使用,不承诺不同版本 V1 artifact 混用。 - 本次未修改公开 API,也未修改 build_fwk.sh 等公共构建脚本。 See merge request: cann/ge!4320 | 27 天前 | |
feat: 支持 Python 自定义算子原型与实现桥接注册 Co-authored-by: lfz<220252399@seu.edu.cn> # message auto-generated for no-merge-commit merge: !4320 merge develop2 into develop feat: 支持 Python 自定义算子原型与实现桥接注册 Created-by: lfz2812 Commit-by: lfz Merged-by: cann-robot Description: # Pull Request ## 描述 支持 Python 自定义算子原型从 Python descriptor 到 GE OperatorFactory 的注册,并完善 Python 自定义算子实现的 bridge 注册、校验和生命周期管理。 主要变更: - 根据 Python 函数签名收集输入、属性、输出及 mutates_args,生成并深拷贝 Python custom op proto。 - 将 Python proto 注册为 OperatorFactory creator,并通过公开 IR 查询接口获取 canonical IR。 - 按 proto 注册、canonical IR 收集、impl 签名校验、Adapter 注册的顺序完成加载。 - 支持 proto-only、proto + Python impl、C++ proto + Python impl 以及 legacy impl。 - 完善 Adapter descriptor、runtime registry 和 holder 的所有权管理。 - 支持重复加载幂等、runtime lease pending cleanup 和注册失败回滚。 - 增加 Python proto、descriptor、bridge loader、Adapter 以及 ST/UT 覆盖。 - 当前阶段不执行 Python infer_meta,暂不覆盖编译期 Meta 推导和 RT2 runtime infer。 - 同步更新中英文 Python custom op 设计文档。 ## 变更类型 请选择本次引入的变更类型: <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [x] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [ ] 📦 构建过程或辅助工具的变动 - [x] 📝 文档内容更新 ## 关联的Issue [#299](https://gitcode.com/cann/ge/issues/299) ## 如何测试 本次补充和扩展以下测试: 1. Python UT: - proto/impl descriptor 快照和关联关系。 - proto-only、proto + schema-bound impl、C++ proto + Python impl 和 legacy impl 场景。 - canonical IR 与 execute 签名校验。 - schema-bound 输入和属性绑定、执行上下文作用域及失效检查。 - plugin 和 bridge/native artifact 加载检查。 2. C++ UT: - proto C POD view 解析和 owning 数据转换。 - 支持的属性类型及默认值转换。 - Operator creator 注册、冲突保护和卸载。 - Adapter capability、runtime entry、holder 和 callback 生命周期。 - loader 注册事务、失败回滚、幂等加载及 pending cleanup。 3. ST: - Python proto 和 impl 注册、创建及卸载。 - Python 自定义算子文件加载失败。 - 不可访问的非 Python自定义算子路径跳过处理。 建议执行: bash bash tests/run_test.sh --ut=python cmake --build build_ut --target ut_libge_multiparts_utest -j4 ctest --test-dir build_ut -R ut_libge_multiparts_utest --output-on-failure git diff --check ## 核对清单 <!-- [x] 表示选中 --> - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如:feat:, fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 ## 其他信息 - 本次完成 Python 原型到 C++ OperatorFactory 的注册,以及 Python 实现到 CustomOpFactory 的 Adapter 注册。 - 本次不执行 Python infer_meta,不包含 infer callback、编译期 shape/data type 回写或 RT2 runtime infer 链路;这些内容由后续 PR 完成。 - 本次保持 schema-bound execute 和迁移期 legacy execute(ctx) 的现有行为。 - Bridge ABI 当前按同批构建和整体替换使用,不承诺不同版本 V1 artifact 混用。 - 本次未修改公开 API,也未修改 build_fwk.sh 等公共构建脚本。 See merge request: cann/ge!4320 | 27 天前 | |
feat: 支持 Python 自定义算子原型与实现桥接注册 Co-authored-by: lfz<220252399@seu.edu.cn> # message auto-generated for no-merge-commit merge: !4320 merge develop2 into develop feat: 支持 Python 自定义算子原型与实现桥接注册 Created-by: lfz2812 Commit-by: lfz Merged-by: cann-robot Description: # Pull Request ## 描述 支持 Python 自定义算子原型从 Python descriptor 到 GE OperatorFactory 的注册,并完善 Python 自定义算子实现的 bridge 注册、校验和生命周期管理。 主要变更: - 根据 Python 函数签名收集输入、属性、输出及 mutates_args,生成并深拷贝 Python custom op proto。 - 将 Python proto 注册为 OperatorFactory creator,并通过公开 IR 查询接口获取 canonical IR。 - 按 proto 注册、canonical IR 收集、impl 签名校验、Adapter 注册的顺序完成加载。 - 支持 proto-only、proto + Python impl、C++ proto + Python impl 以及 legacy impl。 - 完善 Adapter descriptor、runtime registry 和 holder 的所有权管理。 - 支持重复加载幂等、runtime lease pending cleanup 和注册失败回滚。 - 增加 Python proto、descriptor、bridge loader、Adapter 以及 ST/UT 覆盖。 - 当前阶段不执行 Python infer_meta,暂不覆盖编译期 Meta 推导和 RT2 runtime infer。 - 同步更新中英文 Python custom op 设计文档。 ## 变更类型 请选择本次引入的变更类型: <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [x] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [ ] 📦 构建过程或辅助工具的变动 - [x] 📝 文档内容更新 ## 关联的Issue [#299](https://gitcode.com/cann/ge/issues/299) ## 如何测试 本次补充和扩展以下测试: 1. Python UT: - proto/impl descriptor 快照和关联关系。 - proto-only、proto + schema-bound impl、C++ proto + Python impl 和 legacy impl 场景。 - canonical IR 与 execute 签名校验。 - schema-bound 输入和属性绑定、执行上下文作用域及失效检查。 - plugin 和 bridge/native artifact 加载检查。 2. C++ UT: - proto C POD view 解析和 owning 数据转换。 - 支持的属性类型及默认值转换。 - Operator creator 注册、冲突保护和卸载。 - Adapter capability、runtime entry、holder 和 callback 生命周期。 - loader 注册事务、失败回滚、幂等加载及 pending cleanup。 3. ST: - Python proto 和 impl 注册、创建及卸载。 - Python 自定义算子文件加载失败。 - 不可访问的非 Python自定义算子路径跳过处理。 建议执行: bash bash tests/run_test.sh --ut=python cmake --build build_ut --target ut_libge_multiparts_utest -j4 ctest --test-dir build_ut -R ut_libge_multiparts_utest --output-on-failure git diff --check ## 核对清单 <!-- [x] 表示选中 --> - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如:feat:, fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 ## 其他信息 - 本次完成 Python 原型到 C++ OperatorFactory 的注册,以及 Python 实现到 CustomOpFactory 的 Adapter 注册。 - 本次不执行 Python infer_meta,不包含 infer callback、编译期 shape/data type 回写或 RT2 runtime infer 链路;这些内容由后续 PR 完成。 - 本次保持 schema-bound execute 和迁移期 legacy execute(ctx) 的现有行为。 - Bridge ABI 当前按同批构建和整体替换使用,不承诺不同版本 V1 artifact 混用。 - 本次未修改公开 API,也未修改 build_fwk.sh 等公共构建脚本。 See merge request: cann/ge!4320 | 27 天前 | |
fix: 修复Python自定义算子和自定义pass加载失败清理 Co-authored-by: du-hua1024<duhua2@huawei.com> # message auto-generated for no-merge-commit merge: !3850 merge develop into develop fix: 修复Python自定义算子和自定义pass加载失败清理 Created-by: du-hua1024 Commit-by: du-hua1024 Merged-by: cann-robot Description: # Pull Request ## 描述 修复 Python 自定义算子和 Python 自定义融合 pass 在加载失败路径上的错误处理与资源清理问题,避免无效环境变量被静默忽略、加载失败后遗留半初始化状态,以及 Python runtime finalizing 阶段因 pybind 对象未清理导致 core。 ## 问题及修改方案 1. ASCEND_CUSTOM_OPP_PATH 中存在无效路径时,Python 自定义算子入口探测原先 stat 失败只返回 false,导致 LoadCustomOps 跳过 Python 加载,和 Python pass 的失败语义不一致。 修改方案:将探测接口调整为 CheckNeedLoadPythonCustomOps(bool &need_load),非空路径项 stat 失败统一返回 FAILED;已有普通 .py 文件、Python 包或一级 .py 文件仍判定为需要加载;已有非 Python 文件不作为 Python 入口加载。 2. Python 自定义算子加载失败后只返回错误,可能留下已注册或半初始化的 Python custom op 状态,随后失败路径关闭 Python runtime 时,可能在 CPython finalizing 阶段因残留 pybind 对象触发 core。 修改方案:在 LoadPythonCustomOps 失败路径调用 RollbackPythonCustomOpsLoad(),执行 UnloadPythonCustomOps() 并复位 python_custom_ops_loaded_。 3. Python 自定义 pass 注册重名或加载异常时,RegisterPythonPassesFromPlugin() 返回失败但 pass bridge/module 未回滚;随后 GEInitialize、IR build 或 ATC 失败路径关闭 Python runtime 时,可能在 CPython finalizing 阶段因残留 pybind 对象触发 core。 修改方案:pass 加载失败时调用 RollbackPythonPassesLoad();GEInitialize、aclgrphBuildInitialize 和 ATC 主流程失败清理中按 ShutdownPassPluginsForProcess() -> ShutdownCustomOpsForProcess() -> ShutdownProcess() 顺序释放。 4. ir_build_so_in_om_multi_customize_priroity 测试修改 ASCEND_CUSTOM_OPP_PATH 后未恢复,且 setenv(..., 0) 可能受外部环境影响。 修改方案:测试保存并恢复原始 ASCEND_CUSTOM_OPP_PATH,设置测试路径时允许覆盖。 ## 变更类型 - [x] Bug 修复 - [ ] 新功能 - [ ] 代码风格更新 - [ ] 重构 - [ ] 构建过程或辅助工具的变动 - [ ] 文档内容更新 ## 关联的Issue 无 ## 如何测试 - 使用重名python 自定义pass、自定义算子,正常失败退出,没有core dump - 自定义算子环境变量设置非法路径、文件时,显示报错 ## 核对清单 - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [ ] 我已更新了相关的文档:本次为加载失败路径修复,未新增公开接口说明 - [x] 我在标题中使用了合适的类型标签 - [x] 我已经详细阅读了贡献指南,并遵守了其中的提交要求 ## 其他信息 See merge request: cann/ge!3850 | 1 个月前 | |
feat: 支持 Python 自定义算子原型与实现桥接注册 Co-authored-by: lfz<220252399@seu.edu.cn> # message auto-generated for no-merge-commit merge: !4320 merge develop2 into develop feat: 支持 Python 自定义算子原型与实现桥接注册 Created-by: lfz2812 Commit-by: lfz Merged-by: cann-robot Description: # Pull Request ## 描述 支持 Python 自定义算子原型从 Python descriptor 到 GE OperatorFactory 的注册,并完善 Python 自定义算子实现的 bridge 注册、校验和生命周期管理。 主要变更: - 根据 Python 函数签名收集输入、属性、输出及 mutates_args,生成并深拷贝 Python custom op proto。 - 将 Python proto 注册为 OperatorFactory creator,并通过公开 IR 查询接口获取 canonical IR。 - 按 proto 注册、canonical IR 收集、impl 签名校验、Adapter 注册的顺序完成加载。 - 支持 proto-only、proto + Python impl、C++ proto + Python impl 以及 legacy impl。 - 完善 Adapter descriptor、runtime registry 和 holder 的所有权管理。 - 支持重复加载幂等、runtime lease pending cleanup 和注册失败回滚。 - 增加 Python proto、descriptor、bridge loader、Adapter 以及 ST/UT 覆盖。 - 当前阶段不执行 Python infer_meta,暂不覆盖编译期 Meta 推导和 RT2 runtime infer。 - 同步更新中英文 Python custom op 设计文档。 ## 变更类型 请选择本次引入的变更类型: <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [x] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [ ] 📦 构建过程或辅助工具的变动 - [x] 📝 文档内容更新 ## 关联的Issue [#299](https://gitcode.com/cann/ge/issues/299) ## 如何测试 本次补充和扩展以下测试: 1. Python UT: - proto/impl descriptor 快照和关联关系。 - proto-only、proto + schema-bound impl、C++ proto + Python impl 和 legacy impl 场景。 - canonical IR 与 execute 签名校验。 - schema-bound 输入和属性绑定、执行上下文作用域及失效检查。 - plugin 和 bridge/native artifact 加载检查。 2. C++ UT: - proto C POD view 解析和 owning 数据转换。 - 支持的属性类型及默认值转换。 - Operator creator 注册、冲突保护和卸载。 - Adapter capability、runtime entry、holder 和 callback 生命周期。 - loader 注册事务、失败回滚、幂等加载及 pending cleanup。 3. ST: - Python proto 和 impl 注册、创建及卸载。 - Python 自定义算子文件加载失败。 - 不可访问的非 Python自定义算子路径跳过处理。 建议执行: bash bash tests/run_test.sh --ut=python cmake --build build_ut --target ut_libge_multiparts_utest -j4 ctest --test-dir build_ut -R ut_libge_multiparts_utest --output-on-failure git diff --check ## 核对清单 <!-- [x] 表示选中 --> - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如:feat:, fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 ## 其他信息 - 本次完成 Python 原型到 C++ OperatorFactory 的注册,以及 Python 实现到 CustomOpFactory 的 Adapter 注册。 - 本次不执行 Python infer_meta,不包含 infer callback、编译期 shape/data type 回写或 RT2 runtime infer 链路;这些内容由后续 PR 完成。 - 本次保持 schema-bound execute 和迁移期 legacy execute(ctx) 的现有行为。 - Bridge ABI 当前按同批构建和整体替换使用,不承诺不同版本 V1 artifact 混用。 - 本次未修改公开 API,也未修改 build_fwk.sh 等公共构建脚本。 See merge request: cann/ge!4320 | 27 天前 | |
feat: 支持 Python 自定义算子原型与实现桥接注册 Co-authored-by: lfz<220252399@seu.edu.cn> # message auto-generated for no-merge-commit merge: !4320 merge develop2 into develop feat: 支持 Python 自定义算子原型与实现桥接注册 Created-by: lfz2812 Commit-by: lfz Merged-by: cann-robot Description: # Pull Request ## 描述 支持 Python 自定义算子原型从 Python descriptor 到 GE OperatorFactory 的注册,并完善 Python 自定义算子实现的 bridge 注册、校验和生命周期管理。 主要变更: - 根据 Python 函数签名收集输入、属性、输出及 mutates_args,生成并深拷贝 Python custom op proto。 - 将 Python proto 注册为 OperatorFactory creator,并通过公开 IR 查询接口获取 canonical IR。 - 按 proto 注册、canonical IR 收集、impl 签名校验、Adapter 注册的顺序完成加载。 - 支持 proto-only、proto + Python impl、C++ proto + Python impl 以及 legacy impl。 - 完善 Adapter descriptor、runtime registry 和 holder 的所有权管理。 - 支持重复加载幂等、runtime lease pending cleanup 和注册失败回滚。 - 增加 Python proto、descriptor、bridge loader、Adapter 以及 ST/UT 覆盖。 - 当前阶段不执行 Python infer_meta,暂不覆盖编译期 Meta 推导和 RT2 runtime infer。 - 同步更新中英文 Python custom op 设计文档。 ## 变更类型 请选择本次引入的变更类型: <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [x] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [ ] 📦 构建过程或辅助工具的变动 - [x] 📝 文档内容更新 ## 关联的Issue [#299](https://gitcode.com/cann/ge/issues/299) ## 如何测试 本次补充和扩展以下测试: 1. Python UT: - proto/impl descriptor 快照和关联关系。 - proto-only、proto + schema-bound impl、C++ proto + Python impl 和 legacy impl 场景。 - canonical IR 与 execute 签名校验。 - schema-bound 输入和属性绑定、执行上下文作用域及失效检查。 - plugin 和 bridge/native artifact 加载检查。 2. C++ UT: - proto C POD view 解析和 owning 数据转换。 - 支持的属性类型及默认值转换。 - Operator creator 注册、冲突保护和卸载。 - Adapter capability、runtime entry、holder 和 callback 生命周期。 - loader 注册事务、失败回滚、幂等加载及 pending cleanup。 3. ST: - Python proto 和 impl 注册、创建及卸载。 - Python 自定义算子文件加载失败。 - 不可访问的非 Python自定义算子路径跳过处理。 建议执行: bash bash tests/run_test.sh --ut=python cmake --build build_ut --target ut_libge_multiparts_utest -j4 ctest --test-dir build_ut -R ut_libge_multiparts_utest --output-on-failure git diff --check ## 核对清单 <!-- [x] 表示选中 --> - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如:feat:, fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 ## 其他信息 - 本次完成 Python 原型到 C++ OperatorFactory 的注册,以及 Python 实现到 CustomOpFactory 的 Adapter 注册。 - 本次不执行 Python infer_meta,不包含 infer callback、编译期 shape/data type 回写或 RT2 runtime infer 链路;这些内容由后续 PR 完成。 - 本次保持 schema-bound execute 和迁移期 legacy execute(ctx) 的现有行为。 - Bridge ABI 当前按同批构建和整体替换使用,不承诺不同版本 V1 artifact 混用。 - 本次未修改公开 API,也未修改 build_fwk.sh 等公共构建脚本。 See merge request: cann/ge!4320 | 27 天前 | |
feat: 支持 Python 自定义算子原型与实现桥接注册 Co-authored-by: lfz<220252399@seu.edu.cn> # message auto-generated for no-merge-commit merge: !4320 merge develop2 into develop feat: 支持 Python 自定义算子原型与实现桥接注册 Created-by: lfz2812 Commit-by: lfz Merged-by: cann-robot Description: # Pull Request ## 描述 支持 Python 自定义算子原型从 Python descriptor 到 GE OperatorFactory 的注册,并完善 Python 自定义算子实现的 bridge 注册、校验和生命周期管理。 主要变更: - 根据 Python 函数签名收集输入、属性、输出及 mutates_args,生成并深拷贝 Python custom op proto。 - 将 Python proto 注册为 OperatorFactory creator,并通过公开 IR 查询接口获取 canonical IR。 - 按 proto 注册、canonical IR 收集、impl 签名校验、Adapter 注册的顺序完成加载。 - 支持 proto-only、proto + Python impl、C++ proto + Python impl 以及 legacy impl。 - 完善 Adapter descriptor、runtime registry 和 holder 的所有权管理。 - 支持重复加载幂等、runtime lease pending cleanup 和注册失败回滚。 - 增加 Python proto、descriptor、bridge loader、Adapter 以及 ST/UT 覆盖。 - 当前阶段不执行 Python infer_meta,暂不覆盖编译期 Meta 推导和 RT2 runtime infer。 - 同步更新中英文 Python custom op 设计文档。 ## 变更类型 请选择本次引入的变更类型: <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [x] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [ ] 📦 构建过程或辅助工具的变动 - [x] 📝 文档内容更新 ## 关联的Issue [#299](https://gitcode.com/cann/ge/issues/299) ## 如何测试 本次补充和扩展以下测试: 1. Python UT: - proto/impl descriptor 快照和关联关系。 - proto-only、proto + schema-bound impl、C++ proto + Python impl 和 legacy impl 场景。 - canonical IR 与 execute 签名校验。 - schema-bound 输入和属性绑定、执行上下文作用域及失效检查。 - plugin 和 bridge/native artifact 加载检查。 2. C++ UT: - proto C POD view 解析和 owning 数据转换。 - 支持的属性类型及默认值转换。 - Operator creator 注册、冲突保护和卸载。 - Adapter capability、runtime entry、holder 和 callback 生命周期。 - loader 注册事务、失败回滚、幂等加载及 pending cleanup。 3. ST: - Python proto 和 impl 注册、创建及卸载。 - Python 自定义算子文件加载失败。 - 不可访问的非 Python自定义算子路径跳过处理。 建议执行: bash bash tests/run_test.sh --ut=python cmake --build build_ut --target ut_libge_multiparts_utest -j4 ctest --test-dir build_ut -R ut_libge_multiparts_utest --output-on-failure git diff --check ## 核对清单 <!-- [x] 表示选中 --> - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如:feat:, fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 ## 其他信息 - 本次完成 Python 原型到 C++ OperatorFactory 的注册,以及 Python 实现到 CustomOpFactory 的 Adapter 注册。 - 本次不执行 Python infer_meta,不包含 infer callback、编译期 shape/data type 回写或 RT2 runtime infer 链路;这些内容由后续 PR 完成。 - 本次保持 schema-bound execute 和迁移期 legacy execute(ctx) 的现有行为。 - Bridge ABI 当前按同批构建和整体替换使用,不承诺不同版本 V1 artifact 混用。 - 本次未修改公开 API,也未修改 build_fwk.sh 等公共构建脚本。 See merge request: cann/ge!4320 | 27 天前 | |
feat: 支持 Python 自定义算子原型与实现桥接注册 Co-authored-by: lfz<220252399@seu.edu.cn> # message auto-generated for no-merge-commit merge: !4320 merge develop2 into develop feat: 支持 Python 自定义算子原型与实现桥接注册 Created-by: lfz2812 Commit-by: lfz Merged-by: cann-robot Description: # Pull Request ## 描述 支持 Python 自定义算子原型从 Python descriptor 到 GE OperatorFactory 的注册,并完善 Python 自定义算子实现的 bridge 注册、校验和生命周期管理。 主要变更: - 根据 Python 函数签名收集输入、属性、输出及 mutates_args,生成并深拷贝 Python custom op proto。 - 将 Python proto 注册为 OperatorFactory creator,并通过公开 IR 查询接口获取 canonical IR。 - 按 proto 注册、canonical IR 收集、impl 签名校验、Adapter 注册的顺序完成加载。 - 支持 proto-only、proto + Python impl、C++ proto + Python impl 以及 legacy impl。 - 完善 Adapter descriptor、runtime registry 和 holder 的所有权管理。 - 支持重复加载幂等、runtime lease pending cleanup 和注册失败回滚。 - 增加 Python proto、descriptor、bridge loader、Adapter 以及 ST/UT 覆盖。 - 当前阶段不执行 Python infer_meta,暂不覆盖编译期 Meta 推导和 RT2 runtime infer。 - 同步更新中英文 Python custom op 设计文档。 ## 变更类型 请选择本次引入的变更类型: <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [x] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [ ] 📦 构建过程或辅助工具的变动 - [x] 📝 文档内容更新 ## 关联的Issue [#299](https://gitcode.com/cann/ge/issues/299) ## 如何测试 本次补充和扩展以下测试: 1. Python UT: - proto/impl descriptor 快照和关联关系。 - proto-only、proto + schema-bound impl、C++ proto + Python impl 和 legacy impl 场景。 - canonical IR 与 execute 签名校验。 - schema-bound 输入和属性绑定、执行上下文作用域及失效检查。 - plugin 和 bridge/native artifact 加载检查。 2. C++ UT: - proto C POD view 解析和 owning 数据转换。 - 支持的属性类型及默认值转换。 - Operator creator 注册、冲突保护和卸载。 - Adapter capability、runtime entry、holder 和 callback 生命周期。 - loader 注册事务、失败回滚、幂等加载及 pending cleanup。 3. ST: - Python proto 和 impl 注册、创建及卸载。 - Python 自定义算子文件加载失败。 - 不可访问的非 Python自定义算子路径跳过处理。 建议执行: bash bash tests/run_test.sh --ut=python cmake --build build_ut --target ut_libge_multiparts_utest -j4 ctest --test-dir build_ut -R ut_libge_multiparts_utest --output-on-failure git diff --check ## 核对清单 <!-- [x] 表示选中 --> - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如:feat:, fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 ## 其他信息 - 本次完成 Python 原型到 C++ OperatorFactory 的注册,以及 Python 实现到 CustomOpFactory 的 Adapter 注册。 - 本次不执行 Python infer_meta,不包含 infer callback、编译期 shape/data type 回写或 RT2 runtime infer 链路;这些内容由后续 PR 完成。 - 本次保持 schema-bound execute 和迁移期 legacy execute(ctx) 的现有行为。 - Bridge ABI 当前按同批构建和整体替换使用,不承诺不同版本 V1 artifact 混用。 - 本次未修改公开 API,也未修改 build_fwk.sh 等公共构建脚本。 See merge request: cann/ge!4320 | 27 天前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 27 天前 | ||
| 1 个月前 | ||
| 1 个月前 | ||
| 27 天前 | ||
| 27 天前 | ||
| 27 天前 | ||
| 27 天前 | ||
| 27 天前 | ||
| 27 天前 | ||
| 1 个月前 | ||
| 27 天前 | ||
| 27 天前 | ||
| 27 天前 | ||
| 27 天前 |