Pull Request已成功合入, 合并人@ascend-robot
(感谢 rain-666 的贡献)变更摘要
此 PR 为 inductor 的 split_tiling 模块新增了 pointwise 算子的分组编译变体支持。主要针对 transpose 和 broadcast 类内核,当静态 split 轴驱动 grid、动态内轴保留在 tiling 空间时,仍能基于该动态 tiling 轴进行分组,从而在运行时根据轴大小选择最优的编译变体。同时新增了对应的单元测试类 TestPointwiseSymbolicGrouping 来覆盖这些场景。
主要改动
- 新增
_dynamic_pointwise_tiling_axis()方法:在非 reduction 内核中识别唯一的动态 pointwise tiling 轴——该轴必须在tiling_axis中且不在split_axis中,同时内核索引模式须被_pointwise_layout_kind()识别为 transpose/broadcast 等布局。 - 新增
_pointwise_layout_kind()方法:通过分析内核内存索引表达式的 stride 顺序,将 pointwise 内核的布局归类为"transpose"、"broadcast"、"transpose_broadcast"或None(纯 pointwise 不做分组)。 - 扩展
_build_group_features()方法:新增pointwise_layout参数,针对 broadcast 布局返回pointwise_broadcast_axis特征(分桶(16, 64, 256, 1024, 4096)),针对 transpose 布局返回pointwise_transpose_axis特征(分桶(64, 128, 256, 512))。 - 修改
_build_grouped_meta()方法:在无动态 split 轴的分支中,对 pointwise 模板调用_dynamic_pointwise_tiling_axis()获取主分组轴并传入_build_group_features(),使 pointwise 内核也能生成GroupedKernelMeta参与分组编译。 - 新增测试类
TestPointwiseSymbolicGrouping:包含 6 个测试用例,覆盖 transpose/broadcast 布局的分组 meta 构建、纯 pointwise 不回退分组、静态 grid block 保留、以及需要恰好一个动态轴等场景。


代码审查
I've completed my thorough review of both changed files. Let me now submit the closing summary.
审查总结
审查文件清单:
-
test/_inductor/test_inductor_dynamic_shapes.py— 已审查。新增了TestPointwiseSymbolicGrouping测试类(6 个测试方法)及辅助函数make_axis、新增了必要的 import。所有测试逻辑正确,mock 设置合理,无问题。 -
torch_npu/_inductor/codegen/split_tiling.py— 已审查。新增了_dynamic_pointwise_tiling_axis、_pointwise_layout_kind两个方法,修改了_build_group_features和_build_grouped_meta。发现 1 个 P3 问题。
按严重程度统计:
| 优先级 | 数量 |
|---|---|
| P0 | 0 |
| P1 | 0 |
| P2 | 0 |
| P3 | 1 |
总体风险评估:低风险。
该 PR 实现了一个纯增量的功能(pointwise symbolic grouping),新增代码逻辑清晰、测试覆盖全面(含 transpose、broadcast、transpose_broadcast、plain pointwise、tiling fallback、以及向后兼容的 default pointwise 共 6 个场景)。仅有一个可选的优化建议(P3),不影响正确性、安全性或线上行为。可以合入。
⚠️ 已识别出整体风险,但无法提取行内评论,请参考整体评估。


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


Linking Issue Notice
@rain-666 , 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.12.0-26.1.0 | ||
| v2.11.0-26.1.0 | ||
| v2.10.0-26.1.0 | ||
| v2.9.0-26.1.0 | ||
| v2.7.1-26.1.0 | ||
| v2.10.0 | ||
| v2.9.0 | ||
| v2.7.1 | ||
| v2.12.0 | ||
| v2.11.0 | ||
| ci-test |
评论 /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 检查,没有需要检查的文档文件


| 阶段 | 任务名 | 状态 | 详情 |
|---|---|---|---|
| 编译构建 | 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_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 | ✅ | >>> |
- compile、compile_inductor、compile_torchair : 运行流水线
- retry : 重试流水线所有失败子任务
- retry <任务名> : 仅重试指定失败子任务
- stop : 停止流水线


/lgtm


/lgtm
/approve




/sync master


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