已关闭
[Bug][arch35][norm] AddLayerNormQuant/SyncBatchNormGatherStatsFused kernel 使用 SyncAll 但 Tiling 未设置 SetScheduleMode(BATCH_MODE) #3872
tangweiwei2创建于 7月6日关闭于 7月14日
7月6日 将 xieshengwei1024 设为负责人
tangweiwei2
7月6日 评论:
7月6日 评论:
问题已收到,norm类算子已对齐,安排@xieshengwei1024跟踪


7月6日 将 tangweiwei2 设为负责人
7月7日 关联了pull request:修复SyncBatchNormGatherStatsFused kernel 使用 SyncAll 但 Tiling 未设置 SetScheduleMode(BATCH_MODE)
7月7日 关联了pull request:修复SyncBatchNormGatherStatsFused kernel 使用 SyncAll 但 Tiling 未设置 SetScheduleMode(BATCH_MODE)
7月14日 issue状态由 进行中 改变为 已解决
7月14日 关闭了 issue
7月14日 添加了label:resolved
问题描述 (Describe the current behavior)
在 arch35(Ascend950)场景下,norm 类算子
AddLayerNormQuant、SyncBatchNormGatherStatsFused的 kernel 中使用了SyncAll()进行全核同步,但其 op_host tiling 代码中均未调用SetScheduleMode(BATCH_MODE)(即SetScheduleMode(1))。SyncAll()要求所有参与同步的核同时启动并在同一调度批次内运行。若未设置 BatchMode,系统默认按核分批调度,会导致:SyncAll()处无限等待,引发死锁/挂起;涉及算子与代码位置
op_kernel/arch35/add_layer_norm_dynamic_quant_regbase_full_load_kernel.h:526Tiling4AddLayerNormQuantop_host/add_layer_norm_quant_tiling_arch35.cpp等op_kernel/sync_batch_norm_gather_stats_fused_first_axis_common.h:96,109,112,129,132Tiling4SyncBatchNormGatherStatsFusedop_host/sync_batch_norm_gather_stats_fused_tiling_base.cpp等这两个 norm 算子均通过
SyncAll()实现核间归约同步(各核计算 partial sum/sum of squares 后,全核交换并汇总 mean/variance)。两者均有明确的ascend950binary config,arch35 场景下会触发该问题。经确认,所有算子 tiling 文件全文无
SetScheduleMode调用:环境信息 (Environment)
重现步骤 (Steps to reproduce)
blockDim > 1),因未设置 BatchMode,核间调度存在批次差异;SyncAll()处可能发生挂起或归约结果异常。预期结果 (Describe the expected behavior)
各算子 tiling 中应调用
SetScheduleMode(1)设置为 BatchMode,确保所有核同时启动,使SyncAll()全核同步正确生效。参考仓库中已有正确实现,例如:norm/group_norm_grad/op_host/group_norm_grad_tiling_arch35.cpp:666:context_->SetScheduleMode(1);norm/layer_norm_grad_v3/op_host/layer_norm_grad_v3_grouped_reduce_big_m_tiling.cpp:197:context_->SetScheduleMode(1); // Set to batch mode, all cores start simultaneously修复建议
在各算子的 tiling 入口函数中添加:
context->SetScheduleMode(1); // kernel 使用 SyncAll 全核同步,需设置为 BatchMode具体位置:
Tiling4AddLayerNormQuant(add_layer_norm_quant_tiling_arch35.cpp)Tiling4SyncBatchNormGatherStatsFused(sync_batch_norm_gather_stats_fused_tiling_base.cpp)备注 (Special notes)
此问题为通过代码静态排查发现(模式:kernel 含
SyncAll但 tiling 缺SetScheduleMode)。同类问题在仓库其他算子类别(hash / conv / loss / pooling / quant / index 等)中也存在,已分别提 issue 跟踪。