Open
[确定性][AICORE] sparse_lightning_indexer_kl_loss_grad:test_01_nondet AIC ERROR 复现与定位 #587
Alice_zhouAdd on  1 day ago
Alice_zhouCollaborators
1 day ago Create

背景

  • 目标算子:sparse_lightning_indexer_kl_loss_grad。
  • 触发用例:sparse_lightning_indexer_kl_loss_grad_flash_dsv4_test_01_nondet;首轮全量网络执行中 test_01~test_05_nondet 均报 AIC ERROR。
  • 用例特征:B=14, N1=64, N2=1, S1=4096, S2=1022, D=128, dtype=bf16, sparse_size=512, layout=TND, cmp_ratio=4, mask_mode=3, is_deterministic=False。
  • 复现环境:
    • 155:100.105.89.155,Ascend950DT_9582,CANN 9.3.0;
    • 195:100.102.205.195,Ascend950PR_9589,CANN 9.3.0。

问题现象与复现结果

环境 用例 run_status 现场
155 test_01_nondet AIC ERROR AICERROR:,DUMPINFO:['extra-info/data-dump/0/exception_info.52.7.20261113153123606']
155(首轮全量) test_01~05_nondet AIC ERROR 5 条 nondet 全部失败,对应 5 对结果无效
195 test_01_nondet AIC ERROR 64 个 AIV core 报错 + Page fault,rtDeviceSynchronizeWithTimeout 阻塞(需 kill 进程)
195(全量 5 条,--timeout=150) test_01~05_nondet AIC ERROR(5/5) 5 条全部 aivec error 95 + Page fault + set/wait 不匹配,fault_va 各不相同

195 上的完整硬件错误(关键行):

aivec error, core id 0~69(共 64 个 AIV core), error code = 95 / 0
errcode:(95) The MTE instruction accesses an invalid GM address or the cross-device memory access timeout.
subErrType: 0x4  subErrStr: The set and wait instructions do not match.
dump info: pc start: 0x12005a85c44c, current: 0x12005a863688, aic error mask: 0x80395856, mte error: 0x80000000
Page fault info: device_id=0, fault_va=0x120158685000,
                 valid_range_start=0x120059800000, valid_range_size=17446416(bytes)
retCode=0x26, [aicore exception]
rtDeviceSynchronizeWithTimeout execution failed, reason=aicore exception
  • fault_va - valid_range_start = 0x120158685000 - 0x120059800000 = 3.98 GiB,即访问地址比合法 GM 区间高约 4 GiB,属于明确的越界访问。
  • subErrType 0x4: The set and wait instructions do not match 表示跨核 set/wait 同步配对错误。

195 全量 5 条结果(2026-11-14 15:01~15:14)

用例 run_status exception dump
test_01_nondet AIC ERROR exception_info.61.7.20261114150145351
test_02_nondet AIC ERROR exception_info.61.7.20261114150415581
test_03_nondet AIC ERROR exception_info.61.7.20261114150645667
test_04_nondet AIC ERROR exception_info.61.7.20261114150915798
test_05_nondet AIC ERROR exception_info.61.7.20261114151145981
  • 5 条各产生 1 次 Page fault,fault_va 分别为 0x120158676000、0x12015867a000、0x120158685000、0x12015868b000、0x120158695000;均比 valid_range_start=0x120059800000 高约 3.97~3.98 GiB,越界幅度高度一致。
  • 共 5 次 retCode=0x26 [aicore exception];set and wait instructions do not match 共 480 条(5 条用例累计)。
  • 5 个 fault_va 不同但偏移量几乎相同,说明越界来自固定的地址/偏移公式(约多算 4 GiB),而非某一组输入数据。

现场/代码分析

  1. 155 的异常 dump 元信息(SparseLightningIndexerKLLossGrad_fb79be136e8646ca6b3b80bbce33eddd.json):
    • coreType=MIX,taskRation="1:2"(1 AIC : 2 AIV);
    • intercoreSync=1,crossCoreSync=1,说明 kernel 依赖跨核同步;
    • 存在多组 tilingKey(0、1048576、2097152…),不同 tiling 走不同分支;
    • workspace.num=1、workspace.size=[-1](动态 workspace)。
  2. [AIC_INFO] args(...) 显示 kernel 入参为多组 GM 地址;Page fault 落在这些合法地址之外约 4 GiB,指向地址/偏移计算错误(而非简单的输入数据问题)。
  3. 算子封装层未透传任何确定性/调试开关:csrc/attention/sparse_lightning_indexer_kl_loss_grad.cpp:57-77 直接调用 aclnnSparseLightningIndexerKLLossGrad(..., layoutQ, layoutK, maskMode, cmpRatio, dq, dk, dw, softmaxOut),dq/dk/dw/softmaxOut 由 at::empty_like 分配。
  4. set/wait 不匹配 + crossCoreSync=1 组合,说明异常发生在跨核同步阶段;越界地址可能来自稀疏索引/CMP 路径的偏移计算,也可能是某个核在同步失败后继续访问导致。
  5. 结论:这是 跨机器、跨硬件型号(950DT / 950PR)可复现的算子内核缺陷(两侧均为 CANN 9.3.0),不是设备偶发或单机问题。

结论与建议

  1. AIC ERROR 在 155/195 均可稳定复现(155 首轮全量 5/5,195 全量 5/5),属算子内核缺陷;建议按高优先级处理。
  2. 建议算子 owner:
    • 用 fault_va=0x120158685000、pc start=0x12005a85c44c、current=0x12005a863688 解析 AIC/AIV PC;
    • 重点检查稀疏索引 + CMP(cmp_ratio=4、cmp_residual_k=[0..13])路径的 GM 偏移/边界计算;
    • 检查 MIX 1:2 下 set/wait 的配对逻辑,确认同步失败后是否存在继续访存;
    • 核对 workspace.size=-1 的动态 workspace 是否按 tiling 正确分配。
  3. 在修复前,包含 test_01~05_nondet 的 deterministic/nondet 性能对比结果不可用。

执行步骤

cd <WORKDIR>/TuringBigKernel/FusionOp_Test
export PATH=<CONDA_BIN>:$PATH
source activate <CONDA_ENV>
source <CANN_TOOLKIT>/set_env.sh
# 过滤后的 5 条 nondet 用例(test_01~05_nondet)
python3 dailyauto_fusion_david_fast.py \
  --timeout=1200 \
  --casefile=<CASE_DIR>/sligklg_aicore_repro.xlsx \
  --runtype=2 --deviceid=<DEVICE_ID> --need_lock_freq=False \
  --sheetname=Sheet1 --ti=0-5

附件

备注/限制

  • 195 上单条 AIC ERROR 后进程会阻塞在 rtDeviceSynchronizeWithTimeout;--timeout=150 时 runner 会在超时后 kill 子进程并继续下一条,因此可产出包含 5 条 AIC ERROR 的结果 xlsx(每条约 150s,5 条约 13 min)。已 kill 的阻塞进程不产生额外结果。
  • 关联性能汇总 issue:见 sparse_lightning_indexer_kl_loss_grad 网络用例确定性/非确定性性能对比 issue。
likedislike
Alice_zhouCollaborators
11 hours ago Comments:

已提单:DTS2026111403056

likedislike
Alice_zhouCollaborators
10 hours ago Comments:

DTS2026111403056

likedislike
AAlice_zhouCollaborators
7 hours ago Modify description of issue