已合并
fix: 修复IndirectLoad SIMT post-Reduce广播侧输入寻址越界并精简IL用例集 #2209
xiebangrui2025创建于 19 天前
fix: 修复IndirectLoad SIMT post-Reduce广播侧输入寻址越界并精简IL用例集 #2209
已合并
xiebangrui2025创建于 19 天前
xiebangrui2025
xiebangrui2025成员
19 天前

描述

修复 IndirectLoad SIMT 模板在 post-Reduce 场景下广播视图侧输入的寻址越界缺陷,并按分层看护策略精简 IL E2E 用例集。

缺陷根因:SIMT lowering metadata 中 output 侧 GM load 的 use_logical_offset 此前被 has_post_reduce 整体关闭(indirect_load_utils.cpp),导致含 post-IL Reduce 的图内非稠密广播视图侧输入退化为 raw output_index 寻址。对广播侧输入(如 [8,2048,1]/[2048,1,0])按稠密索引读取会越界数倍至数千倍,表现为模拟器 SIGSEGV、板上 AIC error。

修复:output 侧 GM load 恒定按物理视图做坐标折叠(dense 快路径、零偏移、kIndexOffset 三类分支的生成代码与值等价性均保持不变,由既有 UT 与 E2E 全集回归验证)。该字段对 index 侧 load 仍有 mixed_index_views 真实语义,保持不动。

用例集收敛(88 → 56):

  • 删除 dtype 覆盖/大 shape/简单拓扑冗余 30 个(看护点已由等价用例或 UT 覆盖)
  • 下沉至既有 UT 已有等价断言的 4 个(StaticPowerOfTwo policy、ARA fallback 调度候选等)
  • 7 个巨型用户图用例缩形状(layernorm 839MB→1MB、graph_hint 表 135 万行→512 行等,拓扑与失败模式不变,运行时间约 100s→2s 量级)
  • CMake 注册目标与 run_autofuse_test.sh 线上清单逐一对齐(56=56)
  • 有意识放弃:bf16/uint32 在 IL gather 的运行时、超大 shape 多轮地址压力、StructuredMagic/post8/post10 融合后缀发射的独立运行时用例(后者如需可后续补 UT)

变更类型

关联的Issue

无

如何测试

  1. cmake --build build --target <indirect_load_*_e2e_v2 目标集> -j 20
  2. ctest --test-dir build/autofuse/tests -L st -L build_backend_test2 -R "indirect_load.*"
  3. UT:build/autofuse/tests/ut/test_main --gtest_filter="IndirectLoad*"

测试结果

  • 新增回归用例 indirect_load_user_position_bias_exp_sum(1:1 复刻用户上报图,含两个不同广播模式侧输入 + post-IL Sum,缩至 8×256×256):修复前模拟器 SIGSEGV + 16384 点精度断言全失败;修复后 PASSED
  • 新增 codegen UT GenerateSimtPostReduceMapsBroadcastLoadToColumn:post-Reduce 广播侧输入必须折叠坐标(修复前红,修复后绿)
  • 回退修复专项验证:UT 文本断言失败 + E2E SIGSEGV 复现,恢复修复后全绿(红→绿双向闭环)
  • 优化后全集:56 个 IL E2E(codegen + 模拟器运行 + 精度断言)100% 通过;26 个 IL codegen UT 全绿
  • optimize_ut 存在 2 个段错误,经无修改对照确认为存量问题,与本次变更无关

核对清单

其他信息

修复代码仅 1 处(indirect_load_utils.cpp,output load metadata 恒启用逻辑偏移);其余为测试用例新增/精简与清单同步。

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 xiebangrui2025 的贡献)
xiebangrui2025xiebangrui2025成员
19 天前 创建了 pull request,commit 5e7de7f2
CANN-robotCANN-robot成员
19 天前 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
19 天前 评论:

CLA Signature Pass

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

likedislike
CANN-robot
CANN-robot成员
19 天前 评论:

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 ✅ yangyongqiang0606, xchu42, wangxiaotian995 (3/2) ✅ yangyongqiang0606 (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)
likedislike
CANN-robotCANN-robot成员
19 天前 将niuyuhu,yangyongqiang0606,liyuewei,xchu42,zhang_shengjie,depeng1994,wqtshg_wt,peiyang,shengnan666,XuebinYang,sjtulxh,zhanj,zhujingjing,xuyafei,wangxiaotian995设为评审人
CANN-robotCANN-robot成员
19 天前 将niuyuhu,yangyongqiang0606,liyuewei,xchu42,zhang_shengjie,depeng1994,wqtshg_wt,peiyang,shengnan666,XuebinYang,sjtulxh,zhanj,zhujingjing,xuyafei,wangxiaotian995设为审查人
xiebangrui2025
xiebangrui2025成员
19 天前 评论:

compile

likedislike
xiebangrui2025xiebangrui2025成员
19 天前 预合并成功(commit_id: 32e04aaa02c4b1b1f1cac373ca2fd729bc90d669)
CANN-robot
CANN-robot成员
19 天前 评论:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robot成员
19 天前 添加了label:ci-pipeline-running
CANN-robotCANN-robot成员
19 天前 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
19 天前 添加了label:ci-pipeline-passed
xchu42
xchu42成员
19 天前 评论:

/lgtm

likedislike
wangxiaotian995成员
19 天前 评论:

/lgtm

likedislike
CANN-robotCANN-robot成员
19 天前 添加了label:lgtm
yangyongqiang
yangyongqiang成员
19 天前 评论:

/approve

likedislike
CANN-robotCANN-robot成员
19 天前 添加了label:approved
CANN-robotCANN-robot成员
19 天前 合入了pull request