Pull Request已成功合入, 合并人@ascend-robot
(感谢 cuiduo 的贡献)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
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| test | ✅ adrian07110, zichun_ye (2/2) | ✅ adrian07110, zichun_ye (2/1) |
| torch_npu/utils | ✅ adrian07110, zichun_ye (2/2) | ✅ adrian07110, zichun_ye (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
cuiduo, thanks for your pull request. All authors of the commits have signed the CLA. 👍


当前仓库存在以下 保护分支 :
| Protected Branch | Version | Release |
|---|---|---|
| master | ||
| v2.7.1 | ||
| v2.11.0 | ||
| v2.10.0 | ||
| v2.9.0 | ||
| v2.8.0 |
评论 /sync <branch1> <branch2> ... 可将当前 PR 修改同步到其它分支(创建同步 PR):
a) 如果当前 PR 是 Open 状态,同步操作将延迟到 PR 被合并时执行
b) 如果当前 PR 已经 Merged,将立即执行同步操作
注意:
- /sync 命令可以指定同步到多个分支,仅最后一个 /sync 命令生效
- 如果创建的同步 PR 不正确,可通过向同步 PR 的源分支提交轻量级 PR 完善,或使用 /close 命令关闭


compile


问题/功能描述
本次PR主要包含两项修改:一是为测试文件添加了必要的模块导入,以确保测试能够正常执行;二是修复了NPU张量重建函数中的一个潜在问题,通过改进空张量的创建方式并增加对“假模式”(Fake Mode)的支持,提升了代码的健壮性和对PyTorch新特性的兼容性。
修改方案描述
- 在测试文件
test/_inductor/test_sum_add.py中,添加了对torch_npu._inductor模块的导入,以确保测试中使用的torch.compile后端能够被正确识别和加载。 - 在
torch_npu/utils/storage.py的_rebuild_npu_tensor函数中,将创建空张量的方式从torch.tensor([])改为torch.empty((0,), ...),并指定了正确的存储设备。同时,增加了对 PyTorch “假模式”(Fake Mode)的检测,在该模式下为张量设置一个虚拟的目标设备属性,从而更好地支持导出等场景。


| 阶段 | 任务名 | 状态 | 详情 |
|---|---|---|---|
| 编译构建 | Build_X86 | ✅ | >>> |
| Build_ARM | ✅ | >>> | |
| Build_LibTorch_x86 | ✅ | >>> | |
| Build_X86_torchair | 🛑 | >>> | |
| Build_ARM_torchair | 🛑 | >>> | |
| 恶意代码检查 | Antipoison | ✅ | >>> |
| 编码安全与规范检查 | CodeCheck | ✅ | >>> |
| check_error | ✅ | >>> | |
| 开源片段检查 | SCA | ✅ | >>> |
| 开发者测试 | UT_X86_Part_01 | 🛑 | >>> |
| UT_X86_Part_02 | 🛑 | >>> | |
| UT_ARM_A3_Part_01 | 🛑 | >>> | |
| UT_ARM_A3_Part_02 | 🛑 | >>> | |
| UT_DIST_X86_Part_01 | 🛑 | >>> | |
| UT_DIST_X86_Part_02 | 🛑 | >>> | |
| UT_DIST_X86_Part_03 | 🛑 | >>> | |
| UT_DIST_X86_Part_04 | 🛑 | >>> | |
| UT_inductor_Part_01 | 🛑 | >>> | |
| UT_inductor_Part_02 | 🛑 | >>> | |
| UT_inductor_Part_03 | 🛑 | >>> | |
| UT_inductor_Part_04 | 🛑 | >>> | |
| UT_ARM_A2_Part_01 | ✅ | >>> | |
| UT_ARM_A2_Part_02 | ✅ | >>> | |
| 流水线 | PR-pipeline_pytorch | ✅ | >>> |


/approve


/approve


Review Guide
This pull-request passes review.
Committers who wrote a comment of /approve are: zichun_ye, adrian07110.
Reviewers who wrote a comment of /lgtm are: zichun_ye, adrian07110.


【合入来源】
【修改方案】
【资料变更】
【接口变更】
【功能验证】
【CheckList】