Pull Request已成功合入, 合并人@ascend-robot
(感谢 yvjc 的贡献)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 | ✅ zichun_ye, daifu1234567 (2/2) | ✅ zichun_ye (1/1) |
| torch_npu/_inductor | ✅ zichun_ye, daifu1234567 (2/2) | ✅ zichun_ye (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
yvjc, thanks for your pull request. All authors of the commits have signed the CLA. 👍


Linking Issue Notice
@yvjc , the pull request must be linked to at least one issue.
If an issue has already been linked, but the needs-issue label remains, you can remove the label by commenting /check-issue .


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


Ascend docs pipeline is running...


✅ 跳过 docs ci 检查,没有需要检查的文档文件


Ascend docs pipeline is running...


✅ 跳过 docs ci 检查,没有需要检查的文档文件


Ascend docs pipeline is running...


Ascend docs pipeline is running...


✅ 跳过 docs ci 检查,没有需要检查的文档文件


✅ 跳过 docs ci 检查,没有需要检查的文档文件


变更摘要
此 PR 修复了 ANIR(Ascend NPU IR)路径下全量 lowering 回退模式(allfallback)未正确生效的问题。当环境变量 NPU_INDUCTOR_FALLBACK_LIST 设置为 allfallback 时,ANIR 的 fallback_to_aten_mode 未能被同步切换为 "all",导致其 lowering 注册流程未执行全量回退逻辑。该修复在 ANIR 配置模块中补齐了该模式判断,并在 lowering 注册函数中增加了相应的守卫条件,同时新增了针对 MLIR 和 Triton 后端的回退检测测试用例。
主要改动
- ANIR 配置新增
allfallback模式识别:在config.py中添加了对enable_full_lowering_fallback环境变量值为"allfallback"的检测,当匹配时将fallback_to_aten_mode强制设为"all",确保 ANIR 路径能正确进入全量回退模式。 - Lowering 注册函数增加守卫条件:在
npu_lowering.py的_register_npu_inductor_fallbacks()中,将环境变量回退列表的解析条件由if env_fallback_list改为if env_fallback_list and config.fallback_to_aten_mode != "all",避免在全量回退模式下仍尝试逐个解析算子名导致逻辑冲突。 - 新增
allfallback模式测试用例:新增测试文件test_inductor_all_fallback_mlir.py,分别验证 MLIR 后端和 Triton 后端在全量回退模式下,编译后的代码中不出现融合算子(如mlir_fused_add或unk_fused_add),确保回退行为符合预期。


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


/lgtm


/approve




https://gitcode.com/Ascend/pytorch/issues/2507
【合入来源】
【修改方案】
【资料变更】
不涉及
【接口变更】
不涉及
【功能验证】
测试用例通过
【CheckList】