| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
feat:add license headers to annotated args examples Co-authored-by: lfz<220252399@seu.edu.cn> # message auto-generated for no-merge-commit merge: !4683 merge fix1 into develop feat:add license headers to annotated args examples Created-by: lfz2812 Commit-by: lfz Merged-by: cann-robot Description: # Pull Request ## 描述 补充4个cmake文件中的license ## 变更类型 请选择本次引入的变更类型: <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [ ] ✨ 新功能 - [x] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [ ] 📦 构建过程或辅助工具的变动 - [ ] 📝 文档内容更新 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在当前页面的右侧'关联Issue'部分添加相应Issue链接,并勾选'合并后关闭已关联的 Issue'选项。 --> ## 如何测试 描述测试此变更的步骤和前提条件: 1. 2. ## 核对清单 <!-- [x] 表示选中 --> - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如: feat:, fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 ## 其他信息 在此添加任何其他关于本次 PR 的说明。 See merge request: cann/ge!4683 | 3 天前 | |
feat:add license headers to annotated args examples Co-authored-by: lfz<220252399@seu.edu.cn> # message auto-generated for no-merge-commit merge: !4683 merge fix1 into develop feat:add license headers to annotated args examples Created-by: lfz2812 Commit-by: lfz Merged-by: cann-robot Description: # Pull Request ## 描述 补充4个cmake文件中的license ## 变更类型 请选择本次引入的变更类型: <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [ ] ✨ 新功能 - [x] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [ ] 📦 构建过程或辅助工具的变动 - [ ] 📝 文档内容更新 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在当前页面的右侧'关联Issue'部分添加相应Issue链接,并勾选'合并后关闭已关联的 Issue'选项。 --> ## 如何测试 描述测试此变更的步骤和前提条件: 1. 2. ## 核对清单 <!-- [x] 表示选中 --> - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如: feat:, fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 ## 其他信息 在此添加任何其他关于本次 PR 的说明。 See merge request: cann/ge!4683 | 3 天前 | |
feat: Python 自定义算子原型执行样例 Co-authored-by: lfz<220252399@seu.edu.cn> # message auto-generated for no-merge-commit merge: !4519 merge develop4-pr3-base into develop feat: Python 自定义算子原型执行样例 Created-by: lfz2812 Commit-by: lfz Merged-by: cann-robot Description: # Pull Request ## 描述 完善 Python 自定义算子公开资料,并将现有 args_refresh_add_custom/python 样例升级为 Python 原型注册、infer-meta 和 PyPTO 执行的端到端样例。 主要变更: - 在 src/ge/add_custom.py 中使用 @register_op 注册 AddPythonCustomOp 原型和 infer-meta。 - infer-meta 校验输入 shape 和 data type,并通过 TensorDesc 返回输出元信息。 - 使用 @register_op_impl 注册 schema-bound execute(x, y) 实现。 - 使用 PyPTO 实现与 add_custom.asc 等价的 z = x + y NPU kernel。 - 通过 DLPack 将 GE device Tensor 零拷贝转换为 torch_npu Tensor,并在 GE 当前 stream 上执行 PyPTO kernel。 - 删除样例原有的 Bisheng 编译、AI Core binary 提取、_load_kernel()、ACL binary 加载和 kernel launch 流程。 - 更新 run.sh,仅生成和安装 ES Python API,并运行 Python Session 样例。 - 移除构图阶段的 _out_shape_locked 属性和手工设置输出 shape、format、data type 的逻辑,输出元信息由 Python infer-meta 提供。 - C++ REG_OP 仅作为 gen_esb 生成 ge.es.custom.AddPythonCustomOp 构造器的输入,不参与运行时原型注册。 - 将 C++ schema 输出名改为 output0,与 Python register_op 对普通非别名输出生成的默认名称保持一致,避免 canonical IR 兼容性检查失败。 - 增加 ge.runtime.TensorDesc 中文 API 文档,并说明其与 ge.graph.TensorDesc 的区别。 - 同步更新中英文设计文档和自定义算子样例说明。 ## 变更类型 请选择本次引入的变更类型: <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [x] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [x] 📦 构建过程或辅助工具的变动 - [x] 📝 文档内容更新 ## 关联的Issue [#299](https://gitcode.com/cann/ge/issues/299) ## 如何测试 已执行以下静态检查: bash python3 -m py_compile \ examples/custom_op/args_refresh_add_custom/python/src/ge/add_custom.py \ examples/custom_op/args_refresh_add_custom/python/src/run.py bash -n examples/custom_op/args_refresh_add_custom/python/run.sh git diff --check 已针对全部变更文件执行 pre-commit,以下检查均通过: - trim trailing whitespace - fix end of files - clang-format - ruff check - ruff format - codespell - OAT Compliance Check NPU 环境验收步骤: source ${ASCEND_HOME_PATH}/set_env.sh cd examples/custom_op/args_refresh_add_custom/python bash run.sh ## 核对清单 <!-- [x] 表示选中 --> - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如:feat:, fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 ## 其他信息 - args_refresh_add_custom/cpp/add_custom_kernel/add_custom.asc 继续供 C++ 样例使用,并作为 PyPTO 加法实现的逻辑参考;Python 样例运行时不再编译或加载该文件。 - 当前 PyPTO 样例支持 DT_FLOAT 和连续的确定 Storage Shape。 - GE 保持输入和输出 device memory 的所有权,DLPack deleter 仅释放 Python 侧临时元数据。 - C++ REG_OP 输出名必须与 Python canonical proto 保持一致。当前普通非别名输出使用默认名称 output0。 - 当前环境未配置完整的 CANN、PyPTO 和 torch_npu NPU 运行环境,真机执行需要在对应 NPU 环境完成。1. - See merge request: cann/ge!4519 | 5 天前 | |
feat: Python 自定义算子原型执行样例 Co-authored-by: lfz<220252399@seu.edu.cn> # message auto-generated for no-merge-commit merge: !4519 merge develop4-pr3-base into develop feat: Python 自定义算子原型执行样例 Created-by: lfz2812 Commit-by: lfz Merged-by: cann-robot Description: # Pull Request ## 描述 完善 Python 自定义算子公开资料,并将现有 args_refresh_add_custom/python 样例升级为 Python 原型注册、infer-meta 和 PyPTO 执行的端到端样例。 主要变更: - 在 src/ge/add_custom.py 中使用 @register_op 注册 AddPythonCustomOp 原型和 infer-meta。 - infer-meta 校验输入 shape 和 data type,并通过 TensorDesc 返回输出元信息。 - 使用 @register_op_impl 注册 schema-bound execute(x, y) 实现。 - 使用 PyPTO 实现与 add_custom.asc 等价的 z = x + y NPU kernel。 - 通过 DLPack 将 GE device Tensor 零拷贝转换为 torch_npu Tensor,并在 GE 当前 stream 上执行 PyPTO kernel。 - 删除样例原有的 Bisheng 编译、AI Core binary 提取、_load_kernel()、ACL binary 加载和 kernel launch 流程。 - 更新 run.sh,仅生成和安装 ES Python API,并运行 Python Session 样例。 - 移除构图阶段的 _out_shape_locked 属性和手工设置输出 shape、format、data type 的逻辑,输出元信息由 Python infer-meta 提供。 - C++ REG_OP 仅作为 gen_esb 生成 ge.es.custom.AddPythonCustomOp 构造器的输入,不参与运行时原型注册。 - 将 C++ schema 输出名改为 output0,与 Python register_op 对普通非别名输出生成的默认名称保持一致,避免 canonical IR 兼容性检查失败。 - 增加 ge.runtime.TensorDesc 中文 API 文档,并说明其与 ge.graph.TensorDesc 的区别。 - 同步更新中英文设计文档和自定义算子样例说明。 ## 变更类型 请选择本次引入的变更类型: <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [x] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [x] 📦 构建过程或辅助工具的变动 - [x] 📝 文档内容更新 ## 关联的Issue [#299](https://gitcode.com/cann/ge/issues/299) ## 如何测试 已执行以下静态检查: bash python3 -m py_compile \ examples/custom_op/args_refresh_add_custom/python/src/ge/add_custom.py \ examples/custom_op/args_refresh_add_custom/python/src/run.py bash -n examples/custom_op/args_refresh_add_custom/python/run.sh git diff --check 已针对全部变更文件执行 pre-commit,以下检查均通过: - trim trailing whitespace - fix end of files - clang-format - ruff check - ruff format - codespell - OAT Compliance Check NPU 环境验收步骤: source ${ASCEND_HOME_PATH}/set_env.sh cd examples/custom_op/args_refresh_add_custom/python bash run.sh ## 核对清单 <!-- [x] 表示选中 --> - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如:feat:, fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 ## 其他信息 - args_refresh_add_custom/cpp/add_custom_kernel/add_custom.asc 继续供 C++ 样例使用,并作为 PyPTO 加法实现的逻辑参考;Python 样例运行时不再编译或加载该文件。 - 当前 PyPTO 样例支持 DT_FLOAT 和连续的确定 Storage Shape。 - GE 保持输入和输出 device memory 的所有权,DLPack deleter 仅释放 Python 侧临时元数据。 - C++ REG_OP 输出名必须与 Python canonical proto 保持一致。当前普通非别名输出使用默认名称 output0。 - 当前环境未配置完整的 CANN、PyPTO 和 torch_npu NPU 运行环境,真机执行需要在对应 NPU 环境完成。1. - See merge request: cann/ge!4519 | 5 天前 |
AnnotatedArgs 声明式地址刷新自定义算子样例
本目录按在线、离线和语言组织样例,C++ 与 Python 分别提供独立实现:
- online/cpp:C++ 在线性能对比样例。
- online/python:Python 在线性能对比样例。
- offline/cpp:C++ AIR/OM 生成、AnnotatedArgs 声明和 ACL 执行样例。
- offline/python:Python 装饰器原型注册、infer-meta、地址声明以及离线 AIR/OM 执行样例。