已合并
fix: 完善 IndirectLoad SIMD/SIMT codegen 与回归测试 #1828
xiebangrui2025创建于 8月25日
fix: 完善 IndirectLoad SIMD/SIMT codegen 与回归测试 #1828
已合并
xiebangrui2025创建于 8月25日
xiebangrui2025
xiebangrui2025成员
8月25日

描述

完善 IndirectLoad 的 SIMD/SIMT/SK 调度与 regbase codegen,实现 SIMD/SIMT 地址计算和调用路径整理,修正 strided 参数生成中的类型转换问题,并修复 SIMD 场景下对公共 SIMT helper 的误判。

同步扩展 IndirectLoad 的 codegen/E2E 回归覆盖,涵盖广播、非连续布局、索引预处理、后融合 Reduce、embedding、LayerNorm、分叉拓扑及多种 SIMD/SIMT 组合;同时更新线上测试脚本,使线上集合与本地构建入口保持一致。

变更类型

关联的 Issue

无。

如何测试

  1. 构建 aihac_codegen、test_main 及相关 v35 IndirectLoad codegen/E2E target,统一使用 -j 20。
  2. 运行 IndirectLoad API UT,包含 SIMD strided 参数和 uint32_t 输入类型回归用例。
  3. 运行 IndirectLoad codegen 集合:修复后的 indirect_load_rank4_axis1_full_prefix_bessel_k0_sum_simd_codegen_v2 通过,相关 70 个 codegen target 中 69 个通过。
  4. 运行 indirect_load_rank4_axis1_full_prefix_bessel_k0_sum_simd_e2e_v2:生成代码编译和模拟器执行通过。

当前剩余的 indirect_load_user_add_gather_codegen_v2 失败来自双 IndirectLoad 图尚未被调度器支持(ValidateSingleIndirectLoadNode 明确报错),与本次 SIMD/SIMT codegen 修复无关。

核对清单

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 xiebangrui2025 的贡献)
xiebangrui2025xiebangrui2025成员
8月25日 创建了 pull request,commit ee182317
atomgit-bot
atomgit-bot
8月25日 评论:

变更摘要

本 PR 主要修复 Ascend950 场景下 IndirectLoad SIMT 的 kernel API 声明顺序问题,并支持非重叠 zero-stride 且带物理 gap 的 Broadcast 布局。ClassifyIndirectLoadLayout 新增 allow_non_overlapping_zero_stride 参数,使 SIMT 场景下此类布局由 kUnsupported 归类为 kStrided;同时调整 IndirectLoadAscIrCodegenImplV2::LoadApiHeaderFiles 的头文件返回顺序并补充 datacopy_reg_base.h。此外新增与给定 ASCGraph 严格等价的 C++ E2E ST,用同一宏注册 codegen 与 E2E 执行集合,覆盖 GraphHint reduce 用例。

主要改动

  • 扩展 ClassifyIndirectLoadLayout 布局分类: 新增默认值为 false 的 allow_non_overlapping_zero_stride 参数;当启用且布局同时存在 zero-stride 与物理 gap 时,将布局归类为 IndirectLoadLayoutKind::kStrided 并设置 layout.physical_repeats,使该 Broadcast 布局不再被判定为 kUnsupported。

  • SIMT 场景接入新布局支持: AnalyzeInputPath 中当 template_id == kIndirectLoadSimt 且存在 broadcast 时传入该参数;ValidateSimtTemplateRegion 将编译期 Scalar 视为由 SIMT 求值器生成为本地常量而不再要求显式绑定,仅 ScalarData 仍需 context/GM 绑定。

  • 修复 kernel API 声明顺序: LoadApiHeaderFiles 返回的头文件序列调整为以 datacopy_reg_base.h 开头,匹配 kernel 声明对基础头文件的依赖顺序。

  • 新增 GraphHint reduce E2E ST: indirect_load_store_backend_generator.cpp 新增 IL_GRAPH_HINT_REDUCE 分支,按原 ASCIR 图顺序构建 Data/Load/Broadcast/Scalar/Cast/Eq/Where/IndirectLoad/Sum/Store 节点并生成 SIMT kernel;新增 test_e2e_indirect_load_graph_hint_reduce_kernel.cpp 运行生成 kernel 并与参考结果比对。

  • 补充单元测试: 新增 kernel API 头文件声明顺序 UT,以及 SIMT 下 mixed zero-stride + physical gap 布局分类为 kStrided 的 UT。

likedislike
不准确?
atomgit-bot
atomgit-bot
8月25日 评论:

代码审查

✅ 未发现问题

likedislike
不准确?
CANN-robotCANN-robot成员
8月25日 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
8月25日 评论:

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.
You can self-configure the PR merge rules for this repository. For more details, please refer to 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/graph-autofusion ✅ 张德鹏, liyuewei, yangyongqiang0606 (3/2) ✅ 张德鹏 (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

xiebangrui2025, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
此处折叠了208条消息 查看更多
CANN-robotCANN-robot成员
8月27日 删除了label:ci-pipeline-failed
CANN-robotCANN-robot成员
8月27日 添加了label:ci-pipeline-passed
张德鹏成员
8月27日 评论:

/approve

likedislike
CANN-robotCANN-robot成员
8月27日 添加了label:approved
CANN-robotCANN-robot成员
8月27日 合入了pull request