已关闭
[Bug-Report|缺陷反馈]: [clipped_swiglu_grad] kernel含SyncAll但tiling未设置SetScheduleMode(1),存在死锁风险 #5800
tangweiwei2创建于  22 天前关闭于  9 天前
tangweiwei2成员
22 天前 创建

问题描述 / Describe the current behavior

clipped_swiglu_grad 的 kernel 在 arch35(Ascend950)路径上执行 SyncAll(),但 tiling 从未调用 SetScheduleMode(1)(batch mode)。未设 batch mode 时 block 分波启动,SyncAll 等待全量 block,在 blockDim 超过可用核数或多流共享核资源场景下会死锁。

  • kernel SyncAll 位置:activation/clipped_swiglu_grad/op_kernel/clipped_swiglu_grad_base.h:133 —— ClippedSwigluGradSchedBase::Process() 主循环后无条件调用 SyncAll()
  • arch35 路径确认:op_kernel/arch35/clipped_swiglu_grad_kernel.h 中 ClippedSwigluGradArch35Kernel 继承 SchedBase 且未覆写 Process(),launch 处直接调 op.Process() → 执行基类 Process 中的 SyncAll
  • tiling 缺失处:activation/clipped_swiglu_grad/op_host/clipped_swiglu_grad_tiling.cpp 全文无 SetScheduleMode;且 SetBlockDim(coreNumAll_) 使用全部核,batch mode 对 SyncAll 正确性尤为关键

环境信息 / Environment

  • 代码扫描范围:ops-nn 仓 master 分支,commit cc067338f,非 experimental 目录
  • 目标形态:arch35(Ascend950 / __CCE_AICORE__ == 310)路径
  • 来源:由总体扫描 issue #5791 按算子粒度拆分

重现步骤 / Steps to reproduce

  1. 确认 kernel 侧:clipped_swiglu_grad_base.h:133 的 SyncAll() 位于 SchedBase::Process(),arch35 kernel 继承执行,无任何条件保护;
  2. 确认 tiling 侧:clipped_swiglu_grad_tiling.cpp 无 SetScheduleMode 调用;
  3. 运行态验证(可选):在 Ascend950 上构造多流并发/核资源被抢占场景调用该算子,观察挂死。

预期结果 / Describe the expected behavior

kernel 含 SyncAll 的分支,其对应 tiling 应设置 context->SetScheduleMode(1)(batch mode),保证所有 block 同时启动。修复方式参考仓内惯例(如 unsorted_segment_sum、embedding_hash_table_export):

context->SetScheduleMode(1); // kernel 使用 SyncAll,需设置为 batch mode,所有核同时启动

静态扫描结论(无运行日志)。注:910B 路径(clipped_swiglu_grad.h 的 ClippedSwigluGradBase)同样继承该 Process,本问题实际影响 arch35 与 910B 两个路径。

备注 / Special notes

norm/bn_training_update_grad.h:353 注释引用本算子为"SyncAll 裸调用先例",但正确做法应如 foreach_norm(由 foreach_utils/op_host/foreach_reduce_regbase_tiling.cpp:315 设置 mode 1)。

likedislike
Ttangweiwei2成员
22 天前 添加了label:bug-report
Ttangweiwei2成员
22 天前 将 tangweiwei2 设为负责人
不喜欢雨天ༀ不喜欢雨天ༀ
20 天前 关联了pull request:fix(tiling): 为含 SyncAll 的 kernel 补齐 SetScheduleMode(1)
Sshilulu成员
18 天前 关联了pull request:fix(clipped_swiglu_grad): tiling 补充 SetScheduleMode 设置 batch mode,修复 SyncAll 死锁风险
Sshilulu成员
16 天前 关联了pull request:fix(clipped_swiglu_grad): tiling 补充 SetScheduleMode 设置 batch mode,修复 SyncAll 死锁风险
Cchenqi317成员
9 天前 issue状态由 进行中 改变为 已完成
Cchenqi317成员
9 天前 关闭了 issue