| fix(examples): Add success messages to basic examples Co-authored-by: zhaojunhan<zhaojunhan1@huawei.com> # message auto-generated for no-merge-commit merge: !5025 merge fix-examples-success-messages into master fix(examples): Add success messages to basic examples Created-by: zhaojunhan Commit-by: zhaojunhan Merged-by: cann-robot Description: - hello_world 和 basic_ops 用例执行成功后缺少明确提示,用户难以从终端输出判断用例是否已完成。 - 修复hello_world.py run_mode=sim配置不生效 - 修复多余logging日志打印 See merge request: cann/pypto!5025 | 4 months ago |
| feat(pass): Add slice contract feature for pass with some cases Co-authored-by: 2501_92924845<niulinkai@huawei.com> # message auto-generated for no-merge-commit merge: !5568 merge slice5close into master feat(pass): Add slice contract feature for pass with some cases Created-by: 2501_92924845 Commit-by: 2501_92924845 Merged-by: cann-robot Description: PR描述 1.背景 历史实现中,OP_VIEW 和 OP_ASSEMBLE 同时承担两类语义: 视图转换语义:描述 tensor 的 shape、offset、dyn offset、dyn valid shape 等逻辑视图关系。 搬运语义:在 tile graph 后段被 GenerateMoveOp 转换为 copy in / copy out 等真实搬运操作。 本需求将这两类语义拆开: OP_VIEW / OP_ASSEMBLE:保留为视图语义,表达逻辑视图关系。 OP_SLICE / OP_CONTRACT:表达搬运语义,分别对应原 copy in 方向和 copy out 方向的 tile 级搬运描述。 在 ExpandFunction 阶段,原先需要展开的 VIEW/ASSEMBLE 会被展开为 tile 级的 SLICE/CONTRACT。后续 tile graph pass 不能再默认 VIEW/ASSEMBLE 一定会生成真实搬运,而需要按新语义区分: 优化、合并、图结构分析类 pass 需要识别 view-like 和 assemble-like 两组 opcode。 内存推导和 move 生成类 pass 应以 SLICE/CONTRACT 作为真实搬运入口。 本设计覆盖 PVC2_OOO 策略中从 MergeViewAssemble 到 GenerateMoveOp 的相关 pass。 2.. 目标与非目标 2.1 目标 支持 ExpandFunction 后图中出现 OP_SLICE/OP_CONTRACT,并保证后续 pass 能正确识别、合并、拆分、分区和生成 move op。 将原来依赖 OP_VIEW/OP_ASSEMBLE 的搬运逻辑迁移到 OP_SLICE/OP_CONTRACT。 保留 OP_VIEW/OP_ASSEMBLE 的视图表达能力,避免把纯视图语义误转成 copy。 保持现有 offset、dyn offset、dyn valid shape、scope、atomic RMW 属性等关键信息在 pass 改写中正确传递。 兼容原有 pass 中 view/assemble 链路优化能力,使其覆盖 slice/contract 场景。 2.2 非目标 不改变用户侧 API 的 view/assemble 表达方式。 不改变 copy op 的最终执行语义。 不在 GenerateMoveOp 中继续把普通 OP_VIEW/OP_ASSEMBLE 当作搬运入口。 不引入新的 attribute 类型;OP_SLICE 复用 ViewOpAttribute,OP_CONTRACT 复用 AssembleOpAttribute。 2.3 相关验证 MergeViewAssemble UT:覆盖 view-view、slice-view、view-slice、assemble-contract 等链路合并,验证合并后 opcode 和 attribute 正确。 SplitReshape UT:覆盖 contract -> reshape -> slice、reduce_acc 前驱跳过、动态 shape 变轴跳过。 SplitLargeFanoutTensor UT:覆盖大 fanout 中 assemble-like producer 和 view-like consumer 的拆分、offset 更新和冗余删除。 AssignMemoryType UT:覆盖 slice/contract 的 original、requirement、convert 改写、LiteNPU reshape 特殊路径。 RemoveRedundantOp UT:覆盖 view/assemble-like perfect match、partial match、multi-contract-single-slice、single-contract-multi-slice。 ProcessAtomic UT:覆盖 AtomicRMW 属性下沉到 contract、offset 累加、VecDup 分支删除。 GraphPartition 与 IntraSubgraphAdapter UT:覆盖跨子图边界插入 slice/contract,以及 legacy view/assemble memory 不一致时的原地改写。 GenerateMoveOp UT:验证 OP_SLICE/OP_CONTRACT 正确生成 copy in/out,且普通 OP_VIEW/OP_ASSEMBLE 不再作为 move 入口。 See merge request: cann/pypto!5568 | 3 months ago |
| fix(front): Geglu kernel match torch.nn.functional.gelu default behavior Co-authored-by: seu_chang<liuchang169@huawei.com> # message auto-generated for no-merge-commit merge: !6013 merge master into master fix(front): Geglu kernel match torch.nn.functional.gelu default behavior Created-by: seu_chang Commit-by: seu_chang Merged-by: cann-robot Description: geglu golden 和 JIT 用的不是同一个公式,而且这个差异被 up 放大后正好卡在阈值边缘,所以偶现失败。 kernel改为精确 erf 公式:PyPTO 已有 pypto.erf(python/pypto/op/math.py:981),kernel 改为 x * 0.5 * (1 + erf(x / sqrt(2))) See merge request: cann/pypto!6013 | 2 months ago |
| feat(exported_custom_op): Add the minimal onnx demo pair and its system tests Co-authored-by: Nikita Larichev<nikita.larichev@h-partners.com> # message auto-generated for no-merge-commit merge: !6778 merge v4_07_demos_minimal into master feat(exported_custom_op): Add the minimal onnx demo pair and its system tests Created-by: Nikita17 Commit-by: Nikita Larichev Merged-by: cann-robot Description: The minimal demo pair for the custom-op export flow, split out of https://gitcode.com/cann/pypto/merge_requests/5158 for reviewability. add is the smallest single-op export, and build_so_and_setup_demo.py turns an exported .onnx into a placeable libcust_opapi.so. Between them they exercise every module of the support library added in #6780, which is what makes this the smallest useful demo set rather than an arbitrary subset. The demos sit under examples/03_advanced/exported_custom_op/, beside the other advanced examples, and import the library as exported_custom_op from <repo root>/tools. Changes: - Add examples/03_advanced/exported_custom_op/onnx/add/ — the five-file demo (kernel.py, op.py, model.py, plus the export_demo.py and run_demo.py entry points) and onnx/build_so_and_setup_demo.py, which builds the operator .so from an exported model and places it where ATC and GE find it - Add the system tests under tests/st/: test_build_so_loads.py proves the built .so is really loadable, and test_demo_sweep.py drives every demo's export and build stages as subprocesses, discovering demos by glob so a demo added later is swept the moment it lands - Extend examples/validate_examples.py's skip set: build_so_and_setup_demo.py consumes the previous step's output and cannot be run bare, and a demo's kernel.py, op.py and model.py are imported by its two entry points rather than launched. The collected count is unchanged for every pre-existing example - Depends on #6780: the demos reach the export session, the discovery logic and the .so build through the exported_custom_op package that PR introduces Related Issues: [#2869](https://gitcode.com/cann/pypto/issues/2869), [#5158](https://gitcode.com/cann/pypto/merge_requests/5158), [#6780](https://gitcode.com/cann/pypto/merge_requests/6780) See merge request: cann/pypto!6778 | 1 month ago |
| Fix basic operations CLI commands in the examples guides Co-authored-by: KaranocaVe<karanocave@qq.com> # message auto-generated for no-merge-commit merge: !6719 merge fix/2026-09-24-pypto-basic-ops-cli-doc-01 into master Fix basic operations CLI commands in the examples guides Created-by: KaranocaVe Commit-by: KaranocaVe Merged-by: cann-robot Description: # Fix basic operations CLI commands in the examples guides The top-level Chinese and English examples guides currently show two commands that examples/01_beginner/basic/basic_ops.py does not accept: text python3 examples/01_beginner/basic/basic_ops.py matmul::test_matmul python3 examples/01_beginner/basic/basic_ops.py --list The script accepts --tests/-t with matmul as one of its choices, and uses --help to display the available choices. This change updates both guides to use: text python3 examples/01_beginner/basic/basic_ops.py --tests matmul python3 examples/01_beginner/basic/basic_ops.py --help The change is documentation-only. At commit 289942aa3e0c0c0bc9e054c72bafb199200e392f, argparse accepts the corrected selector and rejects the two documented commands with exit code 2. The corrected commands were checked against the script's help output and parser controls. ## Files - examples/README.md - examples/README_en.md 关联 Issue: https://gitcode.com/cann/pypto/issues/3452 See merge request: cann/pypto!6719 | 1 month ago |
| Fix basic operations CLI commands in the examples guides Co-authored-by: KaranocaVe<karanocave@qq.com> # message auto-generated for no-merge-commit merge: !6719 merge fix/2026-09-24-pypto-basic-ops-cli-doc-01 into master Fix basic operations CLI commands in the examples guides Created-by: KaranocaVe Commit-by: KaranocaVe Merged-by: cann-robot Description: # Fix basic operations CLI commands in the examples guides The top-level Chinese and English examples guides currently show two commands that examples/01_beginner/basic/basic_ops.py does not accept: text python3 examples/01_beginner/basic/basic_ops.py matmul::test_matmul python3 examples/01_beginner/basic/basic_ops.py --list The script accepts --tests/-t with matmul as one of its choices, and uses --help to display the available choices. This change updates both guides to use: text python3 examples/01_beginner/basic/basic_ops.py --tests matmul python3 examples/01_beginner/basic/basic_ops.py --help The change is documentation-only. At commit 289942aa3e0c0c0bc9e054c72bafb199200e392f, argparse accepts the corrected selector and rejects the two documented commands with exit code 2. The corrected commands were checked against the script's help output and parser controls. ## Files - examples/README.md - examples/README_en.md 关联 Issue: https://gitcode.com/cann/pypto/issues/3452 See merge request: cann/pypto!6719 | 1 month ago |
| feat(exported_custom_op): Add the minimal onnx demo pair and its system tests Co-authored-by: Nikita Larichev<nikita.larichev@h-partners.com> # message auto-generated for no-merge-commit merge: !6778 merge v4_07_demos_minimal into master feat(exported_custom_op): Add the minimal onnx demo pair and its system tests Created-by: Nikita17 Commit-by: Nikita Larichev Merged-by: cann-robot Description: The minimal demo pair for the custom-op export flow, split out of https://gitcode.com/cann/pypto/merge_requests/5158 for reviewability. add is the smallest single-op export, and build_so_and_setup_demo.py turns an exported .onnx into a placeable libcust_opapi.so. Between them they exercise every module of the support library added in #6780, which is what makes this the smallest useful demo set rather than an arbitrary subset. The demos sit under examples/03_advanced/exported_custom_op/, beside the other advanced examples, and import the library as exported_custom_op from <repo root>/tools. Changes: - Add examples/03_advanced/exported_custom_op/onnx/add/ — the five-file demo (kernel.py, op.py, model.py, plus the export_demo.py and run_demo.py entry points) and onnx/build_so_and_setup_demo.py, which builds the operator .so from an exported model and places it where ATC and GE find it - Add the system tests under tests/st/: test_build_so_loads.py proves the built .so is really loadable, and test_demo_sweep.py drives every demo's export and build stages as subprocesses, discovering demos by glob so a demo added later is swept the moment it lands - Extend examples/validate_examples.py's skip set: build_so_and_setup_demo.py consumes the previous step's output and cannot be run bare, and a demo's kernel.py, op.py and model.py are imported by its two entry points rather than launched. The collected count is unchanged for every pre-existing example - Depends on #6780: the demos reach the export session, the discovery logic and the .so build through the exported_custom_op package that PR introduces Related Issues: [#2869](https://gitcode.com/cann/pypto/issues/2869), [#5158](https://gitcode.com/cann/pypto/merge_requests/5158), [#6780](https://gitcode.com/cann/pypto/merge_requests/6780) See merge request: cann/pypto!6778 | 1 month ago |