Pull Request has been successfully merged by CANN-robot.
(Thank you for niulinkai's contribution.)🤖 正在生成合并请求摘要,请稍候…


🤖 AI 代码检视正在进行中,请稍候…


Thanks for your pull-request.
The full list of commands accepted by me can be found at here.
You can get sig-info at here.
For more, you also can visit HICANN.
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-cann/pypto | ✅ zhangyuebing, congqiannan (2/2) | ✅ zhangyuebing, congqiannan (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
2501_92924845, thanks for your pull request. All authors of the commits have signed the CLA. 👍


⚠️ 本次变更过大(450 个可审文件、37092 行,预估需 31 轮分片审查),已超出 AI 代码评审的处理范围,本次跳过。建议拆分为更小的 PR 以获得有效评审。


⚠️ 本次变更过大(450 个可审文件、37092 行,预估需 31 轮分片审查),已超出 AI 代码评审的处理范围,本次跳过。建议拆分为更小的 PR 以获得有效评审。


compile


流水线任务触发成功
任务链接 [f2a34ef6796c4cf586f1cd56a18aa0bd][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| pre_comment | ✅ SUCCESS | >>>>> | |
| UT_Test_Py3_ninja_simulation | ✅ SUCCESS | ||
| UT_Test_Py3_ninja | ✅ SUCCESS | ||
| UT_Test_Cpp_make_gnu_part_1 | ✅ SUCCESS | ||
| UT_Test_Cpp_make_gnu_part_2 | ✅ SUCCESS | ||
| UT_Test_Cpp_make_gnu_part_3 | ✅ SUCCESS | ||
| UT_Test_Cpp_make_clang_part1 | ✅ SUCCESS | ||
| UT_Test_Cpp_make_clang_part2 | ✅ SUCCESS | ||
| UT_Test_Cpp_make_clang_part3 | ✅ SUCCESS | ||
| UT_Test_kirinx90 | ✅ SUCCESS | ||
| UT_Test_kirin9030 | ✅ SUCCESS | ||
| UT_Test_report | ✅ SUCCESS | >>>>> | |
| PreSmoke_A900 | ❌ FAILED | >>>>> |


流水线任务触发成功
任务链接 [8d0584a2445e49318645cd57ea4f47f8][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| get_pr_file | ✅ SUCCESS | ||
| static-check | ✅ SUCCESS | ||
| compile | ❌ FAILED |


流水线任务触发成功
任务链接 [64b7261c72c94ed7b4f85c55049883ab][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| pre_comment | ✅ SUCCESS | >>>>> | |
| UT_Test_Py3_ninja_simulation | ✅ SUCCESS | ||
| UT_Test_Py3_ninja | ✅ SUCCESS | ||
| UT_Test_Cpp_make_gnu_part_1 | ✅ SUCCESS | ||
| UT_Test_Cpp_make_gnu_part_2 | ✅ SUCCESS | ||
| UT_Test_Cpp_make_gnu_part_3 | ✅ SUCCESS | ||
| UT_Test_Cpp_make_clang_part1 | ✅ SUCCESS | ||
| UT_Test_Cpp_make_clang_part2 | ✅ SUCCESS | ||
| UT_Test_Cpp_make_clang_part3 | ✅ SUCCESS | ||
| UT_Test_kirinx90 | ✅ SUCCESS | ||
| UT_Test_kirin9030 | ✅ SUCCESS | ||
| UT_Test_report | ✅ SUCCESS | >>>>> | |
| PreSmoke_A900 | ✅ SUCCESS | >>>>> |
[2026-08-20 12:19:37] CI执行结束


流水线任务触发成功
任务链接 [8d0584a2445e49318645cd57ea4f47f8][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| get_pr_file | ✅ SUCCESS | ||
| static-check | ✅ SUCCESS | ||
| compile | ✅ SUCCESS |
[2026-08-20 12:20:22] CI执行结束


/approve


/approve


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 入口。