Pull Request has been successfully merged by CANN-robot.
(Thank you for lidongsheng's contribution.)变更摘要
本 PR 主要聚焦于 IR 层对 get_tensor_data 的支持:在 ComputeOutcast 中保留被标记为 IsGetTensorDataOutcast 的 operand,并在 hiddenFunc 构建阶段新增 CreateTensorDataImportOp,同时通过临时切换 CurrentFunction 保证该 op 生成在正确的函数上下文中。此外,IRContext 与 IRBuilder 新增了面向 Operation 的 GetDependToken 重载,在发射 tensor op 时填充 tokens_ 依赖 token,并补充了对应的 SSA 校验测试与 get_tensor_data 用例。
主要改动
ComputeOutcast的 outcast 判定扩展: 在framework/src/interface/tensor/ir_func_builder.cpp中,原neededByConsumer || isFuncOutput条件新增oOperand->IsGetTensorDataOutcast(),使与get_tensor_data相关的 operand 也能被加入 origin outcast,避免被误裁剪。hiddenFunc中创建 tensor data import op: 在FinalizeHiddenFunc中新增hiddenFunc->CreateTensorDataImportOp();同时在FinalizePathFunc中临时将CurrentFunction切换为hiddenFunc并在CreateAndFinalizePathFunc后恢复,保证 import op 在正确的函数上下文内创建。- 新增面向
Operation的依赖 token 获取: 在IRContext中新增GetDependToken(Operation& op),遍历op.GetDynamicAttributeList()收集依赖 token、去重并按名称排序;IRBuilder::EmitTensorStmts在发射 tensor op 语句时写入stmt->tokens_,并在irbuilder.h中暴露对应接口。 - 补充 SSA 校验辅助函数:
python/tests/ut/ir/test_common.py新增ssa_verify(func, desc=""),用于将函数包装为 program 并用IRVerifier校验 SSA 形式。 - 新增
get_tensor_data测试用例: 新增python/tests/ut/ir/test_tensor_data.py,覆盖动态 shape 下的grouped_matmul、view、matmul及结果写回场景,并对编译结果执行 SSA 校验。


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 | ✅ 尹杰, DCGDDD (2/2) | ✅ 尹杰 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
tsungl4, thanks for your pull request. All authors of the commits have signed the CLA. 👍


compile


流水线任务触发成功
任务链接 [e749d2a3db1b40debee76c33e8be869a][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| 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 | ||
| PreSmoke_A900 | ❌ FAILED | >>>>> |


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


compile


流水线任务触发成功
任务链接 [a79e27cb5d6e4d89b0e06844f308ad2a][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| 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 | ||
| PreSmoke_A900 | ✅ SUCCESS | >>>>> |
[2026-08-16 07:51:40] CI执行结束


流水线任务触发成功
任务链接 [f8d08ba081b94c9e84f9f09d99f55404][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| get_pr_file | ✅ SUCCESS | ||
| static-check | ✅ SUCCESS | ||
| compile | ✅ SUCCESS |
[2026-08-16 07:52:13] CI执行结束


/lgtm


/approve


Related Issue: #2559